From 12f79acc7e1361f30340b2d45ff6799088bfa120 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Thu, 23 May 2024 07:03:16 +0200 Subject: [PATCH] Enable quidem shadowing for decoupled testcases (#16431) * Altered `QueryTestBuilder` to be able to switch to a backing quidem test * added a small crc to ensure that the shadow testcase does not deviate from the original one * Packaged all decoupled related things into a a single `DecoupledExtension` to reduce copy-paste * `DecoupledTestConfig#quidemReason` must describe why its being used * `DecoupledTestConfig#separateDefaultModeTest` can be used to make multiple case files based on `NullHandling` state * fixed a cosmetic bug during decoupled join translation * enhanced `!druidPlan` to report the final logical plan in non-decoupled mode as well * add check to ensure that only supported params are present in a druidtest uri * enabled shadow testcases for previously disabled testcases --- .../sql/calcite/planner/PlannerConfig.java | 35 +++ .../sql/calcite/planner/QueryHandler.java | 4 + .../druid/sql/calcite/rel/DruidRel.java | 32 +++ .../calcite/rule/logical/DruidJoinRule.java | 3 +- .../apache/druid/quidem/DruidQTestInfo.java | 41 +++ .../quidem/DruidQuidemCommandHandler.java | 4 + .../sql/calcite/BaseCalciteQueryTest.java | 33 ++- .../sql/calcite/CalciteJoinQueryTest.java | 65 ++--- .../druid/sql/calcite/CalciteQueryTest.java | 22 +- .../druid/sql/calcite/DecoupledExtension.java | 50 +++- ...DecoupledPlanningCalciteJoinQueryTest.java | 4 - .../sql/calcite/DecoupledTestConfig.java | 20 +- .../apache/druid/sql/calcite/QTestCase.java | 121 +++++++++ .../druid/sql/calcite/QueryTestBuilder.java | 9 + .../druid/sql/calcite/QueryTestRunner.java | 28 ++ .../sql/calcite/SqlTestFrameworkConfig.java | 90 ++++++- .../calcite/SqlTestFrameworkConfigTest.java | 21 ++ .../sql/calcite/util/SqlTestFramework.java | 14 + .../numMerge.iq | 2 +- .../supplier.iq | 2 +- .../testCommaJoinLeftFunction.iq | 90 +++++++ ...InnerJoinWithLimit@NullHandling=default.iq | 115 +++++++++ ...pNOnInnerJoinWithLimit@NullHandling=sql.iq | 116 +++++++++ ...urces@all_disabled@NullHandling=default.iq | 163 ++++++++++++ ...taSources@all_disabled@NullHandling=sql.iq | 165 ++++++++++++ ...ources@all_enabled@NullHandling=default.iq | 163 ++++++++++++ ...ataSources@all_enabled@NullHandling=sql.iq | 165 ++++++++++++ ...ataSources@default@NullHandling=default.iq | 160 ++++++++++++ ...ineDataSources@default@NullHandling=sql.iq | 162 ++++++++++++ ...ue-column_disabled@NullHandling=default.iq | 163 ++++++++++++ ...-value-column_disabled@NullHandling=sql.iq | 165 ++++++++++++ ...-rewrites-disabled@NullHandling=default.iq | 163 ++++++++++++ ...lter-rewrites-disabled@NullHandling=sql.iq | 165 ++++++++++++ ...es@filter-rewrites@NullHandling=default.iq | 163 ++++++++++++ ...ources@filter-rewrites@NullHandling=sql.iq | 165 ++++++++++++ ...ces@join-to-filter@NullHandling=default.iq | 163 ++++++++++++ ...Sources@join-to-filter@NullHandling=sql.iq | 165 ++++++++++++ ...tLeft@all_disabled@NullHandling=default.iq | 90 +++++++ ...nCastLeft@all_disabled@NullHandling=sql.iq | 90 +++++++ ...stLeft@all_enabled@NullHandling=default.iq | 90 +++++++ ...inCastLeft@all_enabled@NullHandling=sql.iq | 90 +++++++ ...inCastLeft@default@NullHandling=default.iq | 87 +++++++ ...erJoinCastLeft@default@NullHandling=sql.iq | 87 +++++++ ...ue-column_disabled@NullHandling=default.iq | 90 +++++++ ...-value-column_disabled@NullHandling=sql.iq | 90 +++++++ ...-rewrites-disabled@NullHandling=default.iq | 90 +++++++ ...lter-rewrites-disabled@NullHandling=sql.iq | 90 +++++++ ...ft@filter-rewrites@NullHandling=default.iq | 90 +++++++ ...stLeft@filter-rewrites@NullHandling=sql.iq | 90 +++++++ ...eft@join-to-filter@NullHandling=default.iq | 90 +++++++ ...astLeft@join-to-filter@NullHandling=sql.iq | 90 +++++++ .../testInnerJoinLeftFunction@all_disabled.iq | 93 +++++++ .../testInnerJoinLeftFunction@all_enabled.iq | 93 +++++++ .../testInnerJoinLeftFunction@default.iq | 90 +++++++ ...unction@filter-on-value-column_disabled.iq | 93 +++++++ ...inLeftFunction@filter-rewrites-disabled.iq | 93 +++++++ ...stInnerJoinLeftFunction@filter-rewrites.iq | 93 +++++++ ...estInnerJoinLeftFunction@join-to-filter.iq | 93 +++++++ ...ccess@all_disabled@NullHandling=default.iq | 133 ++++++++++ ...ectAccess@all_disabled@NullHandling=sql.iq | 135 ++++++++++ ...Access@all_enabled@NullHandling=default.iq | 133 ++++++++++ ...rectAccess@all_enabled@NullHandling=sql.iq | 135 ++++++++++ ...rectAccess@default@NullHandling=default.iq | 130 ++++++++++ ...ftDirectAccess@default@NullHandling=sql.iq | 132 ++++++++++ ...ue-column_disabled@NullHandling=default.iq | 133 ++++++++++ ...-value-column_disabled@NullHandling=sql.iq | 135 ++++++++++ ...-rewrites-disabled@NullHandling=default.iq | 133 ++++++++++ ...lter-rewrites-disabled@NullHandling=sql.iq | 135 ++++++++++ ...ss@filter-rewrites@NullHandling=default.iq | 133 ++++++++++ ...Access@filter-rewrites@NullHandling=sql.iq | 135 ++++++++++ ...ess@join-to-filter@NullHandling=default.iq | 133 ++++++++++ ...tAccess@join-to-filter@NullHandling=sql.iq | 135 ++++++++++ ...ccess@all_disabled@NullHandling=default.iq | 133 ++++++++++ ...ectAccess@all_disabled@NullHandling=sql.iq | 135 ++++++++++ ...Access@all_enabled@NullHandling=default.iq | 133 ++++++++++ ...rectAccess@all_enabled@NullHandling=sql.iq | 135 ++++++++++ ...rectAccess@default@NullHandling=default.iq | 130 ++++++++++ ...ftDirectAccess@default@NullHandling=sql.iq | 132 ++++++++++ ...ue-column_disabled@NullHandling=default.iq | 133 ++++++++++ ...-value-column_disabled@NullHandling=sql.iq | 135 ++++++++++ ...-rewrites-disabled@NullHandling=default.iq | 133 ++++++++++ ...lter-rewrites-disabled@NullHandling=sql.iq | 135 ++++++++++ ...ss@filter-rewrites@NullHandling=default.iq | 133 ++++++++++ ...Access@filter-rewrites@NullHandling=sql.iq | 135 ++++++++++ ...ess@join-to-filter@NullHandling=default.iq | 133 ++++++++++ ...tAccess@join-to-filter@NullHandling=sql.iq | 135 ++++++++++ ...testInnerJoinQueryOfLookup@all_disabled.iq | 113 ++++++++ .../testInnerJoinQueryOfLookup@all_enabled.iq | 113 ++++++++ .../testInnerJoinQueryOfLookup@default.iq | 110 ++++++++ ...fLookup@filter-on-value-column_disabled.iq | 113 ++++++++ ...nQueryOfLookup@filter-rewrites-disabled.iq | 113 ++++++++ ...tInnerJoinQueryOfLookup@filter-rewrites.iq | 113 ++++++++ ...stInnerJoinQueryOfLookup@join-to-filter.iq | 113 ++++++++ ...JoinQueryOfLookupRemovable@all_disabled.iq | 96 +++++++ ...rJoinQueryOfLookupRemovable@all_enabled.iq | 96 +++++++ ...InnerJoinQueryOfLookupRemovable@default.iq | 93 +++++++ ...movable@filter-on-value-column_disabled.iq | 96 +++++++ ...ookupRemovable@filter-rewrites-disabled.iq | 96 +++++++ ...nQueryOfLookupRemovable@filter-rewrites.iq | 96 +++++++ ...inQueryOfLookupRemovable@join-to-filter.iq | 96 +++++++ ...iesWithFloorOnTime@NullHandling=default.iq | 155 +++++++++++ ...eseriesWithFloorOnTime@NullHandling=sql.iq | 156 +++++++++++ ...gateMultipleValues@NullHandling=default.iq | 155 +++++++++++ ...ggregateMultipleValues@NullHandling=sql.iq | 156 +++++++++++ ...iesWithFloorOnTime@NullHandling=default.iq | 138 ++++++++++ ...eseriesWithFloorOnTime@NullHandling=sql.iq | 139 ++++++++++ ...hInputRefCondition@NullHandling=default.iq | 126 +++++++++ ...nWithInputRefCondition@NullHandling=sql.iq | 186 ++++++++++++++ ...ccess@all_disabled@NullHandling=default.iq | 133 ++++++++++ ...ectAccess@all_disabled@NullHandling=sql.iq | 135 ++++++++++ ...Access@all_enabled@NullHandling=default.iq | 133 ++++++++++ ...rectAccess@all_enabled@NullHandling=sql.iq | 135 ++++++++++ ...rectAccess@default@NullHandling=default.iq | 130 ++++++++++ ...ftDirectAccess@default@NullHandling=sql.iq | 132 ++++++++++ ...ue-column_disabled@NullHandling=default.iq | 133 ++++++++++ ...-value-column_disabled@NullHandling=sql.iq | 135 ++++++++++ ...-rewrites-disabled@NullHandling=default.iq | 133 ++++++++++ ...lter-rewrites-disabled@NullHandling=sql.iq | 135 ++++++++++ ...ss@filter-rewrites@NullHandling=default.iq | 133 ++++++++++ ...Access@filter-rewrites@NullHandling=sql.iq | 135 ++++++++++ ...ess@join-to-filter@NullHandling=default.iq | 133 ++++++++++ ...tAccess@join-to-filter@NullHandling=sql.iq | 135 ++++++++++ ...ccess@all_disabled@NullHandling=default.iq | 139 ++++++++++ ...ectAccess@all_disabled@NullHandling=sql.iq | 141 ++++++++++ ...Access@all_enabled@NullHandling=default.iq | 139 ++++++++++ ...rectAccess@all_enabled@NullHandling=sql.iq | 141 ++++++++++ ...rectAccess@default@NullHandling=default.iq | 136 ++++++++++ ...ftDirectAccess@default@NullHandling=sql.iq | 138 ++++++++++ ...ue-column_disabled@NullHandling=default.iq | 139 ++++++++++ ...-value-column_disabled@NullHandling=sql.iq | 141 ++++++++++ ...-rewrites-disabled@NullHandling=default.iq | 139 ++++++++++ ...lter-rewrites-disabled@NullHandling=sql.iq | 141 ++++++++++ ...ss@filter-rewrites@NullHandling=default.iq | 139 ++++++++++ ...Access@filter-rewrites@NullHandling=sql.iq | 141 ++++++++++ ...ess@join-to-filter@NullHandling=default.iq | 139 ++++++++++ ...tAccess@join-to-filter@NullHandling=sql.iq | 141 ++++++++++ ...ccess@all_disabled@NullHandling=default.iq | 133 ++++++++++ ...ectAccess@all_disabled@NullHandling=sql.iq | 135 ++++++++++ ...Access@all_enabled@NullHandling=default.iq | 133 ++++++++++ ...rectAccess@all_enabled@NullHandling=sql.iq | 135 ++++++++++ ...rectAccess@default@NullHandling=default.iq | 130 ++++++++++ ...ftDirectAccess@default@NullHandling=sql.iq | 132 ++++++++++ ...ue-column_disabled@NullHandling=default.iq | 133 ++++++++++ ...-value-column_disabled@NullHandling=sql.iq | 135 ++++++++++ ...-rewrites-disabled@NullHandling=default.iq | 133 ++++++++++ ...lter-rewrites-disabled@NullHandling=sql.iq | 135 ++++++++++ ...ss@filter-rewrites@NullHandling=default.iq | 133 ++++++++++ ...Access@filter-rewrites@NullHandling=sql.iq | 135 ++++++++++ ...ess@join-to-filter@NullHandling=default.iq | 133 ++++++++++ ...tAccess@join-to-filter@NullHandling=sql.iq | 135 ++++++++++ ...SubqueryWithSelectorFilter@all_disabled.iq | 100 ++++++++ ...nSubqueryWithSelectorFilter@all_enabled.iq | 100 ++++++++ ...tJoinSubqueryWithSelectorFilter@default.iq | 97 +++++++ ...rFilter@filter-on-value-column_disabled.iq | 100 ++++++++ ...SelectorFilter@filter-rewrites-disabled.iq | 100 ++++++++ ...queryWithSelectorFilter@filter-rewrites.iq | 100 ++++++++ ...bqueryWithSelectorFilter@join-to-filter.iq | 100 ++++++++ ...onSortedOrUniqueDictionary@all_disabled.iq | 87 +++++++ ...NonSortedOrUniqueDictionary@all_enabled.iq | 87 +++++++ ...WithNonSortedOrUniqueDictionary@default.iq | 84 ++++++ ...tionary@filter-on-value-column_disabled.iq | 87 +++++++ ...iqueDictionary@filter-rewrites-disabled.iq | 87 +++++++ ...ortedOrUniqueDictionary@filter-rewrites.iq | 87 +++++++ ...SortedOrUniqueDictionary@join-to-filter.iq | 87 +++++++ ...UniqueDictionaryOrderByDim@all_disabled.iq | 89 +++++++ ...rUniqueDictionaryOrderByDim@all_enabled.iq | 89 +++++++ ...tedOrUniqueDictionaryOrderByDim@default.iq | 86 +++++++ ...erByDim@filter-on-value-column_disabled.iq | 89 +++++++ ...naryOrderByDim@filter-rewrites-disabled.iq | 89 +++++++ ...queDictionaryOrderByDim@filter-rewrites.iq | 89 +++++++ ...iqueDictionaryOrderByDim@join-to-filter.iq | 89 +++++++ ...onFns@all_disabled@NullHandling=default.iq | 139 ++++++++++ ...actionFns@all_disabled@NullHandling=sql.iq | 140 ++++++++++ ...ionFns@all_enabled@NullHandling=default.iq | 139 ++++++++++ ...ractionFns@all_enabled@NullHandling=sql.iq | 140 ++++++++++ ...ractionFns@default@NullHandling=default.iq | 136 ++++++++++ ...hExtractionFns@default@NullHandling=sql.iq | 137 ++++++++++ ...ue-column_disabled@NullHandling=default.iq | 139 ++++++++++ ...-value-column_disabled@NullHandling=sql.iq | 140 ++++++++++ ...-rewrites-disabled@NullHandling=default.iq | 139 ++++++++++ ...lter-rewrites-disabled@NullHandling=sql.iq | 140 ++++++++++ ...ns@filter-rewrites@NullHandling=default.iq | 139 ++++++++++ ...ionFns@filter-rewrites@NullHandling=sql.iq | 140 ++++++++++ ...Fns@join-to-filter@NullHandling=default.iq | 139 ++++++++++ ...tionFns@join-to-filter@NullHandling=sql.iq | 140 ++++++++++ ...mnOnMVFilterJoinExpression@all_disabled.iq | 126 +++++++++ ...umnOnMVFilterJoinExpression@all_enabled.iq | 126 +++++++++ ...lColumnOnMVFilterJoinExpression@default.iq | 123 +++++++++ ...ression@filter-on-value-column_disabled.iq | 126 +++++++++ ...JoinExpression@filter-rewrites-disabled.iq | 126 +++++++++ ...nMVFilterJoinExpression@filter-rewrites.iq | 126 +++++++++ ...OnMVFilterJoinExpression@join-to-filter.iq | 126 +++++++++ ...VFilterMultiJoinExpression@all_disabled.iq | 202 +++++++++++++++ ...MVFilterMultiJoinExpression@all_enabled.iq | 202 +++++++++++++++ ...mnOnMVFilterMultiJoinExpression@default.iq | 199 ++++++++++++++ ...ression@filter-on-value-column_disabled.iq | 202 +++++++++++++++ ...JoinExpression@filter-rewrites-disabled.iq | 202 +++++++++++++++ ...lterMultiJoinExpression@filter-rewrites.iq | 202 +++++++++++++++ ...ilterMultiJoinExpression@join-to-filter.iq | 202 +++++++++++++++ ...ndOtherAggregators@NullHandling=default.iq | 108 ++++++++ ...ingAndOtherAggregators@NullHandling=sql.iq | 108 ++++++++ ...PushdownExtraction@NullHandling=default.iq | 84 ++++++ ...imitPushdownExtraction@NullHandling=sql.iq | 85 ++++++ .../testGroupBySortPushDown.iq | 76 ++++++ ...pByTimeFloorAndDim@NullHandling=default.iq | 147 +++++++++++ ...GroupByTimeFloorAndDim@NullHandling=sql.iq | 146 +++++++++++ ...estGroupByWithLiteralInSubqueryGrouping.iq | 110 ++++++++ ...gregatorsUsingJoin@NullHandling=default.iq | 231 +++++++++++++++++ ...erAggregatorsUsingJoin@NullHandling=sql.iq | 242 ++++++++++++++++++ ...ojectDoesNotRename@NullHandling=default.iq | 152 +++++++++++ ...tyProjectDoesNotRename@NullHandling=sql.iq | 151 +++++++++++ ...eatedIdenticalVirtualExpressionGrouping.iq | 71 +++++ ...smatchWithLiterals@NullHandling=default.iq | 110 ++++++++ ...peMismatchWithLiterals@NullHandling=sql.iq | 111 ++++++++ ...ingWithScanAndSort@NullHandling=default.iq | 191 ++++++++++++++ ...ndowingWithScanAndSort@NullHandling=sql.iq | 202 +++++++++++++++ 216 files changed, 25612 insertions(+), 88 deletions(-) create mode 100644 sql/src/test/java/org/apache/druid/quidem/DruidQTestInfo.java create mode 100644 sql/src/test/java/org/apache/druid/sql/calcite/QTestCase.java create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinLeftFunction.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testExactTopNOnInnerJoinWithLimit@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testExactTopNOnInnerJoinWithLimit@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_enabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_enabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@default@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@default@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@join-to-filter@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@join-to-filter@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@all_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@all_enabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-on-value-column_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-rewrites-disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-rewrites.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@join-to-filter.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@all_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@all_enabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-on-value-column_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-rewrites-disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-rewrites.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@join-to-filter.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@all_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@all_enabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-on-value-column_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-rewrites-disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-rewrites.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@join-to-filter.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnTimeseriesWithFloorOnTime@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnTimeseriesWithFloorOnTime@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinWithInputRefCondition@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinWithInputRefCondition@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_enabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@join-to-filter.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@all_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@all_enabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-on-value-column_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites-disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@join-to-filter.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_enabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-on-value-column_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites-disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@join-to-filter.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@default@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@default@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@all_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@all_enabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-on-value-column_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-rewrites-disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-rewrites.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@join-to-filter.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@all_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@all_enabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-on-value-column_disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites-disabled.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@join-to-filter.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByLimitPushdownExtraction@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByLimitPushdownExtraction@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupBySortPushDown.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByWithLiteralInSubqueryGrouping.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testRepeatedIdenticalVirtualExpressionGrouping.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testSubqueryTypeMismatchWithLiterals@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testSubqueryTypeMismatchWithLiterals@NullHandling=sql.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testWindowingWithScanAndSort@NullHandling=default.iq create mode 100644 sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testWindowingWithScanAndSort@NullHandling=sql.iq diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java index 75887bcbec1..6e2e6685a08 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java @@ -20,10 +20,12 @@ package org.apache.druid.sql.calcite.planner; import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.druid.error.DruidException; import org.apache.druid.java.util.common.UOE; import org.apache.druid.query.QueryContexts; import org.joda.time.DateTimeZone; +import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -428,4 +430,37 @@ public class PlannerConfig return config; } } + + /** + * Translates {@link PlannerConfig} settings into its equivalent QueryContext map. + * + * @throws DruidException if the translation is not possible. + */ + public Map getNonDefaultAsQueryContext() + { + Map overrides = new HashMap<>(); + PlannerConfig def = new PlannerConfig(); + if (def.useApproximateCountDistinct != useApproximateCountDistinct) { + overrides.put( + CTX_KEY_USE_APPROXIMATE_COUNT_DISTINCT, + String.valueOf(useApproximateCountDistinct) + ); + } + if (def.useGroupingSetForExactDistinct != useGroupingSetForExactDistinct) { + overrides.put( + CTX_KEY_USE_GROUPING_SET_FOR_EXACT_DISTINCT, + String.valueOf(useGroupingSetForExactDistinct) + ); + } + + PlannerConfig newConfig = PlannerConfig.builder().withOverrides(overrides).build(); + if (!equals(newConfig)) { + throw DruidException.defensive( + "Not all PlannerConfig options are not persistable as QueryContext keys!\nold: %s\nnew: %s", + this, + newConfig + ); + } + return overrides; + } } diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryHandler.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryHandler.java index 8a7bf4a6f74..9f15d382286 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryHandler.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryHandler.java @@ -588,7 +588,11 @@ public abstract class QueryHandler extends SqlStatementHandler.BaseStatementHand .plus(rootQueryRel.collation), parameterized ); + handlerContext.hook().captureDruidRel(druidRel); + + Hook.JAVA_PLAN.run(druidRel); + if (explain != null) { return planExplanation(possiblyLimitedRoot, druidRel, true); } else { diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidRel.java b/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidRel.java index ac6c0854749..798b0bb407b 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidRel.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidRel.java @@ -19,14 +19,19 @@ package org.apache.druid.sql.calcite.rel; +import com.google.common.collect.Iterables; import org.apache.calcite.plan.RelOptCluster; import org.apache.calcite.plan.RelTraitSet; +import org.apache.calcite.plan.volcano.RelSubset; import org.apache.calcite.rel.AbstractRelNode; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.RelShuttleImpl; import org.apache.calcite.rel.RelWriter; import org.apache.druid.server.QueryResponse; import org.apache.druid.sql.calcite.planner.PlannerContext; import javax.annotation.Nullable; + import java.util.Set; public abstract class DruidRel> extends AbstractRelNode @@ -122,4 +127,31 @@ public abstract class DruidRel> extends AbstractRelNode * Get the set of names of table datasources read by this DruidRel */ public abstract Set getDataSourceNames(); + + public final RelNode unwrapLogicalPlan() + { + return accept(new LogicalPlanUnwrapperShuttle()); + } + + private static class LogicalPlanUnwrapperShuttle extends RelShuttleImpl + { + @Override + public RelNode visit(RelNode other) + { + return super.visit(visitNode(other)); + } + + private RelNode visitNode(RelNode other) + { + if (other instanceof RelSubset) { + final RelSubset subset = (RelSubset) other; + return visitNode(Iterables.getFirst(subset.getRels(), null)); + } + if (other instanceof DruidRel) { + DruidRel druidRel = (DruidRel) other; + return druidRel.getPartialDruidQuery().leafRel(); + } + return other; + } + } } diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/DruidJoinRule.java b/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/DruidJoinRule.java index ded383cbefb..1a50ae1fbcd 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/DruidJoinRule.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/rule/logical/DruidJoinRule.java @@ -54,7 +54,6 @@ public class DruidJoinRule extends ConverterRule // reject the query in case the anaysis detected any issues throw InvalidSqlInput.exception(analysis.errorStr); } - return new DruidJoin( join.getCluster(), newTrait, @@ -67,7 +66,7 @@ public class DruidJoinRule extends ConverterRule join.getRight(), DruidLogicalConvention.instance() ), - join.getCondition(), + analysis.getConditionWithUnsupportedSubConditionsIgnored(join.getCluster().getRexBuilder()), join.getVariablesSet(), join.getJoinType() ); diff --git a/sql/src/test/java/org/apache/druid/quidem/DruidQTestInfo.java b/sql/src/test/java/org/apache/druid/quidem/DruidQTestInfo.java new file mode 100644 index 00000000000..9d655da3448 --- /dev/null +++ b/sql/src/test/java/org/apache/druid/quidem/DruidQTestInfo.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.quidem; + +import java.io.File; + +public class DruidQTestInfo +{ + public final File caseDir; + public final String testName; + public final String comment; + + public DruidQTestInfo(File caseDir, String testName, String comment) + { + this.caseDir = caseDir; + this.testName = testName; + this.comment = comment; + } + + public File getIQFile() + { + return new File(caseDir, testName + ".iq"); + } +} diff --git a/sql/src/test/java/org/apache/druid/quidem/DruidQuidemCommandHandler.java b/sql/src/test/java/org/apache/druid/quidem/DruidQuidemCommandHandler.java index f6577e3903f..8c2b99d80b6 100644 --- a/sql/src/test/java/org/apache/druid/quidem/DruidQuidemCommandHandler.java +++ b/sql/src/test/java/org/apache/druid/quidem/DruidQuidemCommandHandler.java @@ -33,6 +33,7 @@ import org.apache.calcite.sql.SqlExplainLevel; import org.apache.calcite.util.Util; import org.apache.druid.query.Query; import org.apache.druid.sql.calcite.BaseCalciteQueryTest; +import org.apache.druid.sql.calcite.rel.DruidRel; import org.apache.druid.sql.calcite.util.QueryLogHook; import java.sql.ResultSet; @@ -171,6 +172,9 @@ public class DruidQuidemCommandHandler implements CommandHandler } for (RelNode node : logged) { + if (node instanceof DruidRel) { + node = ((DruidRel) node).unwrapLogicalPlan(); + } String str = RelOptUtil.dumpPlan("", node, SqlExplainFormat.TEXT, SqlExplainLevel.EXPPLAN_ATTRIBUTES); x.echo(ImmutableList.of(str)); } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java index b2ba9fca7fe..dfee7d0e3a2 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java @@ -106,6 +106,7 @@ import org.joda.time.chrono.ISOChronology; import org.junit.Assert; import org.junit.internal.matchers.ThrowableMessageMatcher; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Named; import org.junit.jupiter.api.extension.RegisterExtension; import javax.annotation.Nullable; @@ -933,6 +934,12 @@ public class BaseCalciteQueryTest extends CalciteTestBase { return baseQueryContext; } + + @Override + public SqlTestFramework queryFramework() + { + return BaseCalciteQueryTest.this.queryFramework(); + } } public enum ResultMatchMode @@ -1268,51 +1275,51 @@ public class BaseCalciteQueryTest extends CalciteTestBase { return new Object[] { // default behavior - QUERY_CONTEXT_DEFAULT, + Named.of("default", QUERY_CONTEXT_DEFAULT), // all rewrites enabled - new ImmutableMap.Builder() + Named.of("all_enabled", new ImmutableMap.Builder() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, true) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, true) .put(QueryContexts.REWRITE_JOIN_TO_FILTER_ENABLE_KEY, true) - .build(), + .build()), // filter-on-value-column rewrites disabled, everything else enabled - new ImmutableMap.Builder() + Named.of("filter-on-value-column_disabled", new ImmutableMap.Builder() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, false) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, true) .put(QueryContexts.REWRITE_JOIN_TO_FILTER_ENABLE_KEY, true) - .build(), + .build()), // filter rewrites fully disabled, join-to-filter enabled - new ImmutableMap.Builder() + Named.of("join-to-filter", new ImmutableMap.Builder() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, false) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, false) .put(QueryContexts.REWRITE_JOIN_TO_FILTER_ENABLE_KEY, true) - .build(), + .build()), // filter rewrites disabled, but value column filters still set to true // (it should be ignored and this should // behave the same as the previous context) - new ImmutableMap.Builder() + Named.of("filter-rewrites-disabled", new ImmutableMap.Builder() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, true) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, false) .put(QueryContexts.REWRITE_JOIN_TO_FILTER_ENABLE_KEY, true) - .build(), + .build()), // filter rewrites fully enabled, join-to-filter disabled - new ImmutableMap.Builder() + Named.of("filter-rewrites", new ImmutableMap.Builder() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, true) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, true) .put(QueryContexts.REWRITE_JOIN_TO_FILTER_ENABLE_KEY, false) - .build(), + .build()), // all rewrites disabled - new ImmutableMap.Builder() + Named.of("all_disabled", new ImmutableMap.Builder() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, false) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, false) .put(QueryContexts.REWRITE_JOIN_TO_FILTER_ENABLE_KEY, false) - .build(), + .build()), }; } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteJoinQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteJoinQueryTest.java index a822d8b8f10..346563083fb 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteJoinQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteJoinQueryTest.java @@ -83,7 +83,7 @@ import org.apache.druid.segment.join.JoinType; import org.apache.druid.segment.virtual.ListFilteredVirtualColumn; import org.apache.druid.server.QueryLifecycle; import org.apache.druid.server.security.Access; -import org.apache.druid.sql.calcite.DecoupledTestConfig.NativeQueryIgnore; +import org.apache.druid.sql.calcite.DecoupledTestConfig.QuidemTestCaseReason; import org.apache.druid.sql.calcite.NotYetSupported.Modes; import org.apache.druid.sql.calcite.SqlTestFrameworkConfig.MinTopNThreshold; import org.apache.druid.sql.calcite.expression.DruidExpression; @@ -94,7 +94,6 @@ import org.apache.druid.sql.calcite.util.CalciteTests; import org.joda.time.DateTimeZone; import org.joda.time.Period; import org.junit.Assert; -import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -108,6 +107,7 @@ import java.util.Map; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assumptions.assumeFalse; public class CalciteJoinQueryTest extends BaseCalciteQueryTest { @@ -179,12 +179,11 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - // Adjust topN threshold, so that the topN engine keeps only 1 slot for aggregates, which should be enough // to compute the query with limit 1. @SqlTestFrameworkConfig.MinTopNThreshold(1) @Test - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.EQUIV_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN, separateDefaultModeTest = true) public void testExactTopNOnInnerJoinWithLimit() { Map context = new HashMap<>(QUERY_CONTEXT_DEFAULT); @@ -492,7 +491,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest } @Test - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_FILTER_LOCATIONS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_FILTER_LOCATIONS, separateDefaultModeTest = true) public void testJoinOnTimeseriesWithFloorOnTime() { // Cannot vectorize JOIN operator. @@ -547,7 +546,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest } @Test - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_FILTER_LOCATIONS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_FILTER_LOCATIONS, separateDefaultModeTest = true) public void testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime() { // Cannot vectorize JOIN operator. @@ -614,7 +613,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest } @Test - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_FILTER_LOCATIONS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_FILTER_LOCATIONS, separateDefaultModeTest = true) public void testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues() { // Cannot vectorize JOIN operator. @@ -1529,7 +1528,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.FINALIZING_FIELD_ACCESS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.FINALIZING_FIELD_ACCESS) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testInnerJoinQueryOfLookup(Map queryContext) @@ -1609,7 +1608,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest } } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.DEFINETLY_WORSE_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.DEFINETLY_WORSE_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testInnerJoinQueryOfLookupRemovable(Map queryContext) @@ -1648,7 +1647,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.EQUIV_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testInnerJoinTwoLookupsToTableUsingNumericColumn(Map queryContext) @@ -1976,7 +1974,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest } @Test - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_FILTER_LOCATIONS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_FILTER_LOCATIONS) public void testCommaJoinLeftFunction() { testQuery( @@ -2151,7 +2149,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_FILTER_LOCATIONS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_FILTER_LOCATIONS, separateDefaultModeTest = true) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testInnerJoinCastLeft(Map queryContext) @@ -2280,7 +2278,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_FILTER_LOCATIONS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_FILTER_LOCATIONS) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testInnerJoinLeftFunction(Map queryContext) @@ -2733,7 +2731,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_FILTER_LOCATIONS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_FILTER_LOCATIONS, separateDefaultModeTest = true) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testUsingSubqueryWithExtractionFns(Map queryContext) @@ -2937,7 +2935,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_LEFT_DIRECT_ACCESS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_LEFT_DIRECT_ACCESS, separateDefaultModeTest = true) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess(Map queryContext) @@ -3049,7 +3047,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_LEFT_DIRECT_ACCESS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_LEFT_DIRECT_ACCESS, separateDefaultModeTest = true) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess(Map queryContext) @@ -3151,7 +3149,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_LEFT_DIRECT_ACCESS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_LEFT_DIRECT_ACCESS, separateDefaultModeTest = true) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess(Map queryContext) @@ -3253,7 +3251,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_LEFT_DIRECT_ACCESS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_LEFT_DIRECT_ACCESS, separateDefaultModeTest = true) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess(Map queryContext) @@ -3355,9 +3353,9 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.EQUIV_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN, separateDefaultModeTest = true) public void testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources(Map queryContext) { cannotVectorize(); @@ -3440,7 +3438,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_LEFT_DIRECT_ACCESS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_LEFT_DIRECT_ACCESS, separateDefaultModeTest = true) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess(Map queryContext) @@ -3589,7 +3587,12 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest { // JoinFilterAnalyzer bug causes incorrect results on this test in replace-with-default mode. // This test case was originally added in https://github.com/apache/druid/pull/11434 with a note about this. - Assumptions.assumeFalse(NullHandling.replaceWithDefault() && QueryContext.of(queryContext).getEnableJoinFilterRewrite()); + assumeFalse(NullHandling.replaceWithDefault() && QueryContext.of(queryContext).getEnableJoinFilterRewrite()); + + assumeFalse( + testBuilder().isDecoupledMode() && NullHandling.replaceWithDefault(), + "join condition not support in decoupled mode" + ); // Cannot vectorize due to 'concat' expression. cannotVectorize(); @@ -3670,9 +3673,9 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.EQUIV_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN) public void testLeftJoinSubqueryWithSelectorFilter(Map queryContext) { // Cannot vectorize due to 'concat' expression. @@ -3876,7 +3879,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.EQUIV_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testInnerJoinSubqueryWithSelectorFilter(Map queryContext) @@ -4152,7 +4154,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.EQUIV_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testSemiAndAntiJoinSimultaneouslyUsingExplicitJoins(Map queryContext) @@ -4701,7 +4702,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest cannotVectorize(); // We don't handle non-equi join conditions for non-sql compatible mode. - Assumptions.assumeFalse(NullHandling.replaceWithDefault()); + assumeFalse(NullHandling.replaceWithDefault()); testQuery( "SELECT x.m1, y.m1 FROM foo x INNER JOIN foo y ON x.m1 > y.m1", @@ -4764,7 +4765,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest cannotVectorize(); // We don't handle non-equi join conditions for non-sql compatible mode. - Assumptions.assumeFalse(NullHandling.replaceWithDefault()); + assumeFalse(NullHandling.replaceWithDefault()); testQuery( "SELECT x.m1, y.m1 FROM foo x INNER JOIN foo y ON x.m1 = y.m1 AND x.m1 + y.m1 = 6.0", @@ -5152,9 +5153,9 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.EQUIV_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN) public void testTopNOnStringWithNonSortedOrUniqueDictionary(Map queryContext) { testQuery( @@ -5193,9 +5194,9 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.EQUIV_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN) public void testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim(Map queryContext) { @@ -5234,7 +5235,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.SLIGHTLY_WORSE_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testVirtualColumnOnMVFilterJoinExpression(Map queryContext) @@ -5291,7 +5292,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.DEFINETLY_WORSE_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.DEFINETLY_WORSE_PLAN) @MethodSource("provideQueryContexts") @ParameterizedTest(name = "{0}") public void testVirtualColumnOnMVFilterMultiJoinExpression(Map queryContext) @@ -5652,6 +5653,8 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest @ParameterizedTest(name = "{0}") public void testRegressionFilteredAggregatorsSubqueryJoins(Map queryContext) { + assumeFalse(testBuilder().isDecoupledMode() && NullHandling.replaceWithDefault(), "not support in decoupled mode"); + cannotVectorize(); testQuery( "select\n" + @@ -6027,7 +6030,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest } @Test - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.JOIN_FILTER_LOCATIONS) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.JOIN_FILTER_LOCATIONS, separateDefaultModeTest = true) public void testJoinWithInputRefCondition() { cannotVectorize(); diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java index 5d5aab11135..f21fba9ab45 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java @@ -114,7 +114,7 @@ import org.apache.druid.segment.column.ColumnType; import org.apache.druid.segment.column.RowSignature; import org.apache.druid.segment.join.JoinType; import org.apache.druid.segment.virtual.ExpressionVirtualColumn; -import org.apache.druid.sql.calcite.DecoupledTestConfig.NativeQueryIgnore; +import org.apache.druid.sql.calcite.DecoupledTestConfig.QuidemTestCaseReason; import org.apache.druid.sql.calcite.NotYetSupported.Modes; import org.apache.druid.sql.calcite.expression.DruidExpression; import org.apache.druid.sql.calcite.filtration.Filtration; @@ -7495,7 +7495,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.AGG_COL_EXCHANGE) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.AGG_COL_EXCHANGE, separateDefaultModeTest = true) @Test public void testExactCountDistinctWithGroupingAndOtherAggregators() { @@ -7550,7 +7550,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.AGG_COL_EXCHANGE) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.AGG_COL_EXCHANGE, separateDefaultModeTest = true) @Test public void testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin() { @@ -8749,7 +8749,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.AGG_COL_EXCHANGE) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.AGG_COL_EXCHANGE) @Test public void testGroupBySortPushDown() { @@ -8845,7 +8845,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.IMPROVED_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.IMPROVED_PLAN, separateDefaultModeTest = true) @Test public void testGroupByLimitPushdownExtraction() { @@ -9292,7 +9292,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.SLIGHTLY_WORSE_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_PLAN, separateDefaultModeTest = true) @SqlTestFrameworkConfig.NumMergeBuffers(3) @Test public void testQueryWithSelectProjectAndIdentityProjectDoesNotRename() @@ -11134,7 +11134,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.IMPROVED_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.IMPROVED_PLAN, separateDefaultModeTest = true) @Test public void testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim() { @@ -13269,7 +13269,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.IMPROVED_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.IMPROVED_PLAN) @Test public void testGroupByWithLiteralInSubqueryGrouping() { @@ -13458,7 +13458,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.IMPROVED_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.IMPROVED_PLAN) @Test public void testRepeatedIdenticalVirtualExpressionGrouping() { @@ -15032,7 +15032,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest ); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.AGGREGATE_REMOVE_NOT_FIRED) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.AGGREGATE_REMOVE_NOT_FIRED, separateDefaultModeTest = true) @Test public void testSubqueryTypeMismatchWithLiterals() { @@ -15752,7 +15752,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest .run(); } - @DecoupledTestConfig(nativeQueryIgnore = NativeQueryIgnore.SLIGHTLY_WORSE_PLAN) + @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_PLAN, separateDefaultModeTest = true) @Test public void testWindowingWithScanAndSort() { diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledExtension.java b/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledExtension.java index ec1e64df95c..094a23cb1d6 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledExtension.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledExtension.java @@ -20,14 +20,20 @@ package org.apache.druid.sql.calcite; import com.google.common.collect.ImmutableMap; +import org.apache.druid.common.config.NullHandling; import org.apache.druid.query.QueryContexts; +import org.apache.druid.quidem.DruidQTestInfo; +import org.apache.druid.quidem.ProjectPathUtils; import org.apache.druid.server.security.AuthConfig; import org.apache.druid.sql.calcite.BaseCalciteQueryTest.CalciteTestConfig; import org.apache.druid.sql.calcite.planner.PlannerConfig; import org.apache.druid.sql.calcite.util.SqlTestFramework; -import org.junit.jupiter.api.extension.Extension; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; -public class DecoupledExtension implements Extension +import java.io.File; + +public class DecoupledExtension implements BeforeEachCallback { private BaseCalciteQueryTest baseTest; @@ -36,6 +42,15 @@ public class DecoupledExtension implements Extension this.baseTest = baseTest; } + private File qCaseDir; + + @Override + public void beforeEach(ExtensionContext context) + { + Class testClass = context.getTestClass().get(); + qCaseDir = ProjectPathUtils.getPathFromProjectRoot("sql/src/test/quidem/" + testClass.getName()); + } + private static final ImmutableMap CONTEXT_OVERRIDES = ImmutableMap.builder() .putAll(BaseCalciteQueryTest.QUERY_CONTEXT_DEFAULT) .put(PlannerConfig.CTX_NATIVE_QUERY_SQL_PLANNING_MODE, PlannerConfig.NATIVE_QUERY_SQL_PLANNING_MODE_DECOUPLED) @@ -47,8 +62,11 @@ public class DecoupledExtension implements Extension DecoupledTestConfig decTestConfig = BaseCalciteQueryTest.queryFrameworkRule .getAnnotation(DecoupledTestConfig.class); + boolean runQuidem = (decTestConfig != null && decTestConfig.quidemReason().isPresent()); + CalciteTestConfig testConfig = baseTest.new CalciteTestConfig(CONTEXT_OVERRIDES) { + @Override public SqlTestFramework.PlannerFixture plannerFixture(PlannerConfig plannerConfig, AuthConfig authConfig) { @@ -56,16 +74,36 @@ public class DecoupledExtension implements Extension return baseTest.queryFramework().plannerFixture(plannerConfig, authConfig); } + + @Override + public DruidQTestInfo getQTestInfo() + { + if (runQuidem) { + final String testName; + if (decTestConfig.separateDefaultModeTest()) { + if (NullHandling.sqlCompatible()) { + testName = BaseCalciteQueryTest.queryFrameworkRule.testName() + "@NullHandling=sql"; + } else { + testName = BaseCalciteQueryTest.queryFrameworkRule.testName() + "@NullHandling=default"; + } + } else { + testName = BaseCalciteQueryTest.queryFrameworkRule.testName(); + } + return new DruidQTestInfo( + qCaseDir, + testName, + "quidem testcase reason: " + decTestConfig.quidemReason() + ); + } else { + return null; + } + } }; QueryTestBuilder builder = new QueryTestBuilder(testConfig) .cannotVectorize(baseTest.cannotVectorize) .skipVectorize(baseTest.skipVectorize); - if (decTestConfig != null && decTestConfig.nativeQueryIgnore().isPresent()) { - builder.verifyNativeQueries(x -> false); - } - return builder; } } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledPlanningCalciteJoinQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledPlanningCalciteJoinQueryTest.java index dba11b35ffe..d8abfbb2075 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledPlanningCalciteJoinQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledPlanningCalciteJoinQueryTest.java @@ -19,7 +19,6 @@ package org.apache.druid.sql.calcite; -import org.apache.druid.sql.calcite.DisableUnless.DisableUnlessRule; import org.apache.druid.sql.calcite.NotYetSupported.NotYetSupportedProcessor; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.RegisterExtension; @@ -32,9 +31,6 @@ import static org.junit.Assert.assertNotNull; @ExtendWith(NotYetSupportedProcessor.class) public class DecoupledPlanningCalciteJoinQueryTest extends CalciteJoinQueryTest { - @RegisterExtension - public DisableUnlessRule sqlCompatOnly = DisableUnless.SQL_COMPATIBLE; - @RegisterExtension DecoupledExtension decoupledExtension = new DecoupledExtension(this); diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledTestConfig.java b/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledTestConfig.java index 511db82b76b..9bd57e10afb 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledTestConfig.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/DecoupledTestConfig.java @@ -22,9 +22,6 @@ package org.apache.druid.sql.calcite; import org.apache.calcite.rel.rules.CoreRules; import org.apache.druid.query.QueryContexts; import org.apache.druid.query.aggregation.post.FinalizingFieldAccessPostAggregator; -import org.apache.druid.query.scan.ScanQuery; -import org.apache.druid.query.timeseries.TimeseriesQuery; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -42,9 +39,9 @@ public @interface DecoupledTestConfig * * The value of this field should describe the root cause of the difference. */ - NativeQueryIgnore nativeQueryIgnore() default NativeQueryIgnore.NONE; + QuidemTestCaseReason quidemReason() default QuidemTestCaseReason.NONE; - enum NativeQueryIgnore + enum QuidemTestCaseReason { NONE, /** @@ -68,16 +65,6 @@ public @interface DecoupledTestConfig * Worse plan; may loose vectorization; but no extra queries */ SLIGHTLY_WORSE_PLAN, - /** - * {@link TimeseriesQuery} to {@link ScanQuery} change. - * - * Not yet sure if this is improvement; or some issue - */ - TS_TO_SCAN, - /** - * GroupBy doesn't sorted?! - */ - GBY_DOESNT_SORT, /** * Equvivalent plan. * @@ -107,6 +94,7 @@ public @interface DecoupledTestConfig { return this != NONE; } - }; + } + boolean separateDefaultModeTest() default false; } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/QTestCase.java b/sql/src/test/java/org/apache/druid/sql/calcite/QTestCase.java new file mode 100644 index 00000000000..67f5bf3c2eb --- /dev/null +++ b/sql/src/test/java/org/apache/druid/sql/calcite/QTestCase.java @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.sql.calcite; + +import com.google.common.hash.HashCode; +import com.google.common.hash.Hashing; +import com.google.common.io.Files; +import org.apache.druid.java.util.common.FileUtils; +import org.apache.druid.java.util.common.StringUtils; +import org.apache.druid.quidem.DruidQTestInfo; +import org.apache.druid.quidem.DruidQuidemTestBase; +import org.apache.druid.quidem.DruidQuidemTestBase.DruidQuidemRunner; +import org.apache.druid.sql.calcite.QueryTestRunner.QueryRunStep; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +public class QTestCase +{ + private StringBuffer sb; + private DruidQTestInfo testInfo; + + public QTestCase(DruidQTestInfo testInfo) + { + this.testInfo = testInfo; + sb = new StringBuffer(); + sb.append("# "); + sb.append(testInfo.comment); + sb.append("\n"); + } + + public void println(String str) + { + sb.append(str); + sb.append("\n"); + } + + public QueryRunStep toRunner() + { + return new QueryRunStep(null) + { + + @Override + public void run() + { + try { + if (DruidQuidemRunner.isOverwrite()) { + writeCaseTo(testInfo.getIQFile()); + } else { + isValidTestCaseFile(testInfo.getIQFile()); + } + + DruidQuidemRunner runner = new DruidQuidemTestBase.DruidQuidemRunner(); + runner.run(testInfo.getIQFile()); + } + catch (Exception e) { + throw new RuntimeException("Error running quidem test", e); + } + } + }; + } + + protected void isValidTestCaseFile(File iqFile) + { + if (!iqFile.exists()) { + throw new IllegalStateException("testcase doesn't exists; run with (-Dquidem.overwrite) : " + iqFile); + } + try { + String header = makeHeader(); + String testCaseFirstLine = Files.asCharSource(iqFile, StandardCharsets.UTF_8).readFirstLine(); + if (!header.equals(testCaseFirstLine)) { + throw new IllegalStateException( + "backing quidem testcase doesn't match test - run with (-Dquidem.overwrite) : " + iqFile + ); + } + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + private String makeHeader() + { + HashCode hash = Hashing.crc32().hashBytes(sb.toString().getBytes(StandardCharsets.UTF_8)); + return StringUtils.format("# %s case-crc:%s", testInfo.testName, hash); + + } + + public void writeCaseTo(File file) throws IOException + { + FileUtils.mkdirp(file.getParentFile()); + try (FileOutputStream fos = new FileOutputStream(file)) { + fos.write(makeHeader().getBytes(StandardCharsets.UTF_8)); + fos.write('\n'); + fos.write(sb.toString().getBytes(StandardCharsets.UTF_8)); + } + catch (IOException e) { + throw new RuntimeException("Error writing testcase to: " + file, e); + } + } + +} diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/QueryTestBuilder.java b/sql/src/test/java/org/apache/druid/sql/calcite/QueryTestBuilder.java index ff7e9b5a6ba..9484fd3d892 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/QueryTestBuilder.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/QueryTestBuilder.java @@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Preconditions; import org.apache.druid.query.Query; import org.apache.druid.query.QueryContexts; +import org.apache.druid.quidem.DruidQTestInfo; import org.apache.druid.segment.column.RowSignature; import org.apache.druid.server.security.AuthConfig; import org.apache.druid.server.security.AuthenticationResult; @@ -34,6 +35,7 @@ import org.apache.druid.sql.calcite.QueryTestRunner.QueryResults; import org.apache.druid.sql.calcite.planner.PlannerConfig; import org.apache.druid.sql.calcite.util.CalciteTestBase; import org.apache.druid.sql.calcite.util.CalciteTests; +import org.apache.druid.sql.calcite.util.SqlTestFramework; import org.apache.druid.sql.calcite.util.SqlTestFramework.PlannerFixture; import org.apache.druid.sql.http.SqlParameter; import java.util.ArrayList; @@ -75,6 +77,13 @@ public class QueryTestBuilder boolean isRunningMSQ(); Map baseQueryContext(); + + default DruidQTestInfo getQTestInfo() + { + return null; + } + + SqlTestFramework queryFramework(); } protected final QueryTestConfig config; diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/QueryTestRunner.java b/sql/src/test/java/org/apache/druid/sql/calcite/QueryTestRunner.java index 5dc7cbd6f1a..5873659927f 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/QueryTestRunner.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/QueryTestRunner.java @@ -23,6 +23,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedMap; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.sql.SqlExplainFormat; @@ -34,6 +35,7 @@ import org.apache.druid.java.util.common.StringUtils; import org.apache.druid.java.util.common.guava.Sequence; import org.apache.druid.query.Query; import org.apache.druid.query.QueryContexts; +import org.apache.druid.quidem.DruidQTestInfo; import org.apache.druid.segment.column.RowSignature; import org.apache.druid.server.security.ResourceAction; import org.apache.druid.sql.DirectStatement; @@ -56,6 +58,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -657,6 +660,31 @@ public class QueryTestRunner public QueryTestRunner(QueryTestBuilder builder) { QueryTestConfig config = builder.config; + DruidQTestInfo iqTestInfo = config.getQTestInfo(); + if (iqTestInfo != null) { + QTestCase qt = new QTestCase(iqTestInfo); + Map queryContext = ImmutableSortedMap.naturalOrder() + .putAll(builder.getQueryContext()) + .putAll(builder.plannerConfig.getNonDefaultAsQueryContext()) + .build(); + for (Entry entry : queryContext.entrySet()) { + qt.println(StringUtils.format("!set %s %s", entry.getKey(), entry.getValue())); + } + qt.println("!set outputformat mysql"); + qt.println("!use " + builder.config.queryFramework().getDruidTestURI()); + + qt.println(builder.sql + ";"); + if (builder.expectedResults != null) { + qt.println("!ok"); + } + qt.println("!logicalPlan"); + qt.println("!druidPlan"); + if (builder.expectedQueries != null) { + qt.println("!nativePlan"); + } + runSteps.add(qt.toRunner()); + return; + } if (builder.expectedResultsVerifier == null && builder.expectedResults != null) { builder.expectedResultsVerifier = config.defaultResultsVerifier( builder.expectedResults, diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfig.java b/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfig.java index d320f4985a8..a3311d32c87 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfig.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfig.java @@ -19,10 +19,14 @@ package org.apache.druid.sql.calcite; +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; import org.apache.druid.java.util.common.IAE; import org.apache.druid.java.util.common.StringUtils; import org.apache.druid.query.topn.TopNQueryConfig; @@ -30,6 +34,7 @@ import org.apache.druid.sql.calcite.util.CacheTestHelperModule.ResultCacheMode; import org.apache.druid.sql.calcite.util.SqlTestFramework; import org.apache.druid.sql.calcite.util.SqlTestFramework.QueryComponentSupplier; import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier; +import org.apache.http.client.utils.URIBuilder; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -45,14 +50,19 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Constructor; import java.lang.reflect.Method; +import java.net.URI; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Objects; import java.util.Set; import java.util.function.Function; +import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -146,6 +156,13 @@ public class SqlTestFrameworkConfig Class value(); } + private static final Set KNOWN_CONFIG_KEYS = ImmutableSet.builder() + .add(NumMergeBuffers.PROCESSOR.getConfigName()) + .add(MinTopNThreshold.PROCESSOR.getConfigName()) + .add(ResultCache.PROCESSOR.getConfigName()) + .add(ComponentSupplier.PROCESSOR.getConfigName()) + .build(); + public final int numMergeBuffers; public final int minTopNThreshold; public final ResultCacheMode resultCache; @@ -166,6 +183,7 @@ public class SqlTestFrameworkConfig public SqlTestFrameworkConfig(Map queryParams) { + validateConfigKeys(queryParams.keySet()); try { numMergeBuffers = NumMergeBuffers.PROCESSOR.fromMap(queryParams); minTopNThreshold = MinTopNThreshold.PROCESSOR.fromMap(queryParams); @@ -177,6 +195,15 @@ public class SqlTestFrameworkConfig } } + private void validateConfigKeys(Set keySet) + { + Set diff = Sets.difference(keySet, KNOWN_CONFIG_KEYS); + if (diff.isEmpty()) { + return; + } + throw new IAE("Invalid configuration key(s) specified [%s]; valid options are [%s]", diff, KNOWN_CONFIG_KEYS); + } + @Override public int hashCode() { @@ -244,6 +271,7 @@ public class SqlTestFrameworkConfig SqlTestFrameworkConfigStore configStore = new SqlTestFrameworkConfigStore(); private SqlTestFrameworkConfig config; private Method method; + private String testName; @Override public void afterAll(ExtensionContext context) @@ -259,12 +287,31 @@ public class SqlTestFrameworkConfig private void setConfig(ExtensionContext context) { + testName = buildTestCaseName(context); method = context.getTestMethod().get(); Class testClass = context.getTestClass().get(); List annotations = collectAnnotations(testClass, method); config = new SqlTestFrameworkConfig(annotations); } + /** + * Returns a string identifying the testcase. + * + * + */ + public String buildTestCaseName(ExtensionContext context) + { + List names = new ArrayList(); + Pattern pattern = Pattern.compile("\\([^)]*\\)"); + // this will add all name pieces - except the "last" which would be the + // Class level name + do { + names.add(0, pattern.matcher(context.getDisplayName()).replaceAll("")); + context = context.getParent().get(); + } while (context.getTestMethod().isPresent()); + return Joiner.on("@").join(names); + } + public SqlTestFrameworkConfig getConfig() { return config; @@ -282,7 +329,7 @@ public class SqlTestFrameworkConfig public String testName() { - return method.getName(); + return testName; } } @@ -292,8 +339,8 @@ public class SqlTestFrameworkConfig ConfigurationInstance(SqlTestFrameworkConfig config, QueryComponentSupplier testHost) { - SqlTestFramework.Builder builder = new SqlTestFramework.Builder(testHost) + .withConfig(config) .catalogResolver(testHost.createCatalogResolver()) .minTopNThreshold(config.minTopNThreshold) .mergeBufferCount(config.numMergeBuffers) @@ -321,6 +368,38 @@ public class SqlTestFrameworkConfig } } + public URI getDruidTestURI() + { + try { + Map params = getNonDefaultMap(); + URIBuilder ub = new URIBuilder("druidtest:///"); + for (Entry entry : params.entrySet()) { + ub.setParameter(entry.getKey(), entry.getValue()); + } + ub.setPath("///"); + return ub.build(); + } + catch (URISyntaxException e) { + throw new RuntimeException(e); + } + } + + private Map getNonDefaultMap() + { + Map map = new HashMap<>(); + SqlTestFrameworkConfig def = new SqlTestFrameworkConfig(Collections.emptyList()); + if (def.numMergeBuffers != numMergeBuffers) { + map.put("numMergeBuffers", String.valueOf(numMergeBuffers)); + } + if (def.minTopNThreshold != minTopNThreshold) { + map.put("minTopNThreshold", String.valueOf(minTopNThreshold)); + } + if (!equals(new SqlTestFrameworkConfig(map))) { + throw new IAE("Can't reproduce config via map!"); + } + return map; + } + abstract static class ConfigOptionProcessor { final Class annotationClass; @@ -330,6 +409,11 @@ public class SqlTestFrameworkConfig this.annotationClass = annotationClass; } + public final String getConfigName() + { + return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, annotationClass.getSimpleName()); + } + @SuppressWarnings("unchecked") public final T fromAnnotations(List annotations) throws Exception { @@ -358,7 +442,7 @@ public class SqlTestFrameworkConfig public final T fromMap(Map map) throws Exception { - String key = annotationClass.getSimpleName(); + String key = getConfigName(); String value = map.get(key); if (value == null) { return defaultValue(); diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfigTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfigTest.java index 7618ccf67ea..3a7dd2d22d3 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfigTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfigTest.java @@ -19,7 +19,9 @@ package org.apache.druid.sql.calcite; +import com.google.common.collect.ImmutableMap; import nl.jqno.equalsverifier.EqualsVerifier; +import org.apache.druid.java.util.common.IAE; import org.apache.druid.sql.calcite.SqlTestFrameworkConfig.MinTopNThreshold; import org.apache.druid.sql.calcite.SqlTestFrameworkConfig.NumMergeBuffers; import org.apache.druid.sql.calcite.SqlTestFrameworkConfig.ResultCache; @@ -30,6 +32,7 @@ import java.lang.annotation.Annotation; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; public class SqlTestFrameworkConfigTest { @@ -118,4 +121,22 @@ public class SqlTestFrameworkConfigTest assertEquals(1, config.numMergeBuffers); assertEquals(ResultCacheMode.DISABLED, config.resultCache); } + + @Test + public void testInvalidConfigKeySpecified() + { + ImmutableMap configMap = ImmutableMap.builder() + .put("nonExistent", "someValue") + .build(); + IAE e = assertThrows( + IAE.class, + () -> new SqlTestFrameworkConfig(configMap) + ); + + assertEquals( + "Invalid configuration key(s) specified [[nonExistent]]; valid options are [[numMergeBuffers, minTopNThreshold, resultCache, componentSupplier]]", + e.getMessage() + ); + } + } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java b/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java index f0d6431615d..c64888414b6 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java @@ -50,6 +50,7 @@ import org.apache.druid.server.SpecificSegmentsQuerySegmentWalker; import org.apache.druid.server.security.AuthConfig; import org.apache.druid.server.security.AuthorizerMapper; import org.apache.druid.sql.SqlStatementFactory; +import org.apache.druid.sql.calcite.SqlTestFrameworkConfig; import org.apache.druid.sql.calcite.TempDirProducer; import org.apache.druid.sql.calcite.aggregation.SqlAggregationModule; import org.apache.druid.sql.calcite.planner.CalciteRulesManager; @@ -70,6 +71,7 @@ import org.apache.druid.timeline.DataSegment; import java.io.Closeable; import java.io.IOException; +import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -403,6 +405,7 @@ public class SqlTestFramework private int mergeBufferCount; private CatalogResolver catalogResolver = CatalogResolver.NULL_RESOLVER; private List overrideModules = new ArrayList<>(); + private SqlTestFrameworkConfig config; public Builder(QueryComponentSupplier componentSupplier) { @@ -437,6 +440,12 @@ public class SqlTestFramework { return new SqlTestFramework(this); } + + public Builder withConfig(SqlTestFrameworkConfig config) + { + this.config = config; + return this; + } } /** @@ -692,4 +701,9 @@ public class SqlTestFramework throw new RE(e); } } + + public URI getDruidTestURI() + { + return builder.config.getDruidTestURI(); + } } diff --git a/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/numMerge.iq b/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/numMerge.iq index 4862d3425d4..2c42ea49c78 100644 --- a/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/numMerge.iq +++ b/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/numMerge.iq @@ -1,4 +1,4 @@ -!use druidtest://?NumMergeBuffers=3 +!use druidtest://?numMergeBuffers=3 !set outputformat mysql SELECT diff --git a/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/supplier.iq b/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/supplier.iq index 2825903dd7f..97c76bf297e 100644 --- a/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/supplier.iq +++ b/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/supplier.iq @@ -1,4 +1,4 @@ -!use druidtest://?ComponentSupplier=NestedComponentSupplier +!use druidtest://?componentSupplier=NestedComponentSupplier !set outputformat mysql select count(1) from nested; diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinLeftFunction.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinLeftFunction.iq new file mode 100644 index 00000000000..7cbc21bd551 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinLeftFunction.iq @@ -0,0 +1,90 @@ +# testCommaJoinLeftFunction case-crc:0f0b74b8 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.dim1, foo.dim2, l.k, l.v +FROM foo, lookup.lookyloo l +WHERE SUBSTRING(foo.dim2, 1, 1) = l.k +; ++------+------+---+----+ +| dim1 | dim2 | k | v | ++------+------+---+----+ +| | a | a | xa | +| 1 | a | a | xa | +| def | abc | a | xa | ++------+------+---+----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4]) + LogicalJoin(condition=[=($2, $3)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2], $f2=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4], druid=[logical]) + DruidJoin(condition=[=($2, $3)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], $f2=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.k", "j0.v" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testExactTopNOnInnerJoinWithLimit@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testExactTopNOnInnerJoinWithLimit@NullHandling=default.iq new file mode 100644 index 00000000000..655e998e70c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testExactTopNOnInnerJoinWithLimit@NullHandling=default.iq @@ -0,0 +1,115 @@ +# testExactTopNOnInnerJoinWithLimit@NullHandling=default case-crc:1b8b1878 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set useApproximateTopN false +!set outputformat mysql +!use druidtest:///?minTopNThreshold=1 +select f1."dim4", sum("m1") from numfoo f1 inner join ( + select "dim4" from numfoo where dim4 <> 'a' group by 1 +) f2 on f1."dim4" = f2."dim4" group by 1 limit 1; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 15.0 | ++------+--------+ +(1 row) + +!ok +LogicalSort(fetch=[1]) + LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim4=[$4], m1=[$14]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalAggregate(group=[{4}]) + LogicalFilter(condition=[<>($4, 'a')]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidSort(fetch=[1], druid=[logical]) + DruidAggregate(group=[{0}], EXPR$1=[SUM($1)], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim4=[$4], m1=[$14], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidAggregate(group=[{4}], druid=[logical]) + DruidFilter(condition=[<>($4, 'a')]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "dim4", + "value" : "a" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim4", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0._d0\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + }, + "threshold" : 1, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "doubleSum", + "name" : "a0", + "fieldName" : "m1" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testExactTopNOnInnerJoinWithLimit@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testExactTopNOnInnerJoinWithLimit@NullHandling=sql.iq new file mode 100644 index 00000000000..f7f6ae51c54 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testExactTopNOnInnerJoinWithLimit@NullHandling=sql.iq @@ -0,0 +1,116 @@ +# testExactTopNOnInnerJoinWithLimit@NullHandling=sql case-crc:1b8b1878 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set useApproximateTopN false +!set outputformat mysql +!use druidtest:///?minTopNThreshold=1 +select f1."dim4", sum("m1") from numfoo f1 inner join ( + select "dim4" from numfoo where dim4 <> 'a' group by 1 +) f2 on f1."dim4" = f2."dim4" group by 1 limit 1; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 15.0 | ++------+--------+ +(1 row) + +!ok +LogicalSort(fetch=[1]) + LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim4=[$4], m1=[$14]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalAggregate(group=[{4}]) + LogicalFilter(condition=[<>($4, 'a')]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidSort(fetch=[1], druid=[logical]) + DruidAggregate(group=[{0}], EXPR$1=[SUM($1)], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim4=[$4], m1=[$14], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidAggregate(group=[{4}], druid=[logical]) + DruidFilter(condition=[<>($4, 'a')]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "equals", + "column" : "dim4", + "matchValueType" : "STRING", + "matchValue" : "a" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim4", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0._d0\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + }, + "threshold" : 1, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "doubleSum", + "name" : "a0", + "fieldName" : "m1" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..f9c384b6ad2 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=default.iq @@ -0,0 +1,163 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=default case-crc:9802d63b +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..99b6b8653fc --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=sql.iq @@ -0,0 +1,165 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_disabled@NullHandling=sql case-crc:9802d63b +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=default.iq new file mode 100644 index 00000000000..191120de0f7 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=default.iq @@ -0,0 +1,163 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=default case-crc:06fe6714 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=sql.iq new file mode 100644 index 00000000000..8b2a57ef9c5 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=sql.iq @@ -0,0 +1,165 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@all_enabled@NullHandling=sql case-crc:06fe6714 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=default.iq new file mode 100644 index 00000000000..c327a62751a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=default.iq @@ -0,0 +1,160 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=default case-crc:2e780a44 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=sql.iq new file mode 100644 index 00000000000..404071a7b2a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=sql.iq @@ -0,0 +1,162 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@default@NullHandling=sql case-crc:2e780a44 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..614328ce40a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=default.iq @@ -0,0 +1,163 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=default case-crc:ec1996e8 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..f100ba33fd5 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=sql.iq @@ -0,0 +1,165 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-on-value-column_disabled@NullHandling=sql case-crc:ec1996e8 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=default.iq new file mode 100644 index 00000000000..03d22e1c0d5 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=default.iq @@ -0,0 +1,163 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=default case-crc:ddcd7387 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..ad90e641a99 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=sql.iq @@ -0,0 +1,165 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites-disabled@NullHandling=sql case-crc:ddcd7387 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=default.iq new file mode 100644 index 00000000000..bfb82dce17d --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=default.iq @@ -0,0 +1,163 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=default case-crc:cf16e9a6 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=sql.iq new file mode 100644 index 00000000000..a2866beb2ed --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=sql.iq @@ -0,0 +1,165 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@filter-rewrites@NullHandling=sql case-crc:cf16e9a6 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=default.iq new file mode 100644 index 00000000000..da25c7a6524 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=default.iq @@ -0,0 +1,163 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=default case-crc:830604f9 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=sql.iq new file mode 100644 index 00000000000..20124df76e2 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=sql.iq @@ -0,0 +1,165 @@ +# testGroupByOverGroupByOverInnerJoinOnTwoInlineDataSources@join-to-filter@NullHandling=sql case-crc:830604f9 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT dim1 from (SELECT dim1,__time FROM (SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1) GROUP BY 1,2) GROUP BY dim1 +; ++------+ +| dim1 | ++------+ +| 10.1 | ++------+ +(1 row) + +!ok +LogicalAggregate(group=[{0}]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalAggregate(group=[{1}]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidAggregate(group=[{1}], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..4581d237a81 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_disabled@NullHandling=default.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@all_disabled@NullHandling=default case-crc:8cd9e460 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..588444b911a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_disabled@NullHandling=sql.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@all_disabled@NullHandling=sql case-crc:8cd9e460 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_enabled@NullHandling=default.iq new file mode 100644 index 00000000000..98f34424e83 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_enabled@NullHandling=default.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@all_enabled@NullHandling=default case-crc:57e7eb69 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_enabled@NullHandling=sql.iq new file mode 100644 index 00000000000..5d6e4aa2941 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@all_enabled@NullHandling=sql.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@all_enabled@NullHandling=sql case-crc:57e7eb69 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@default@NullHandling=default.iq new file mode 100644 index 00000000000..85dffdbac3d --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@default@NullHandling=default.iq @@ -0,0 +1,87 @@ +# testInnerJoinCastLeft@default@NullHandling=default case-crc:55da2e8b +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@default@NullHandling=sql.iq new file mode 100644 index 00000000000..28cc7fc8f79 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@default@NullHandling=sql.iq @@ -0,0 +1,87 @@ +# testInnerJoinCastLeft@default@NullHandling=sql case-crc:55da2e8b +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..b787c9f6b2c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=default.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=default case-crc:7f9dea41 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..3ca909dbbe7 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=sql.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@filter-on-value-column_disabled@NullHandling=sql case-crc:7f9dea41 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=default.iq new file mode 100644 index 00000000000..23363f31d94 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=default.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=default case-crc:1723b06b +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..20f06ae17de --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=sql.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@filter-rewrites-disabled@NullHandling=sql case-crc:1723b06b +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites@NullHandling=default.iq new file mode 100644 index 00000000000..7ec2378fe2a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites@NullHandling=default.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@filter-rewrites@NullHandling=default case-crc:fb3b0939 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites@NullHandling=sql.iq new file mode 100644 index 00000000000..fca3275f788 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@filter-rewrites@NullHandling=sql.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@filter-rewrites@NullHandling=sql case-crc:fb3b0939 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@join-to-filter@NullHandling=default.iq new file mode 100644 index 00000000000..a17fe3fbce4 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@join-to-filter@NullHandling=default.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@join-to-filter@NullHandling=default case-crc:2b873437 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR NOT NULL], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@join-to-filter@NullHandling=sql.iq new file mode 100644 index 00000000000..94cf3420227 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinCastLeft@join-to-filter@NullHandling=sql.iq @@ -0,0 +1,90 @@ +# testInnerJoinCastLeft@join-to-filter@NullHandling=sql case-crc:2b873437 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.m1, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON CAST(foo.m1 AS VARCHAR) = l.k +; ++----+---+---+ +| m1 | k | v | ++----+---+---+ ++----+---+---+ +(0 rows) + +!ok +LogicalProject(m1=[$0], k=[$2], v=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(m1=[$5], m10=[CAST($5):VARCHAR]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(m1=[$0], k=[$2], v=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(m1=[$5], m10=[CAST($5):VARCHAR], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "CAST(\"m1\", 'STRING')", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "FLOAT", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "j0.k", "j0.v", "m1" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "FLOAT" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@all_disabled.iq new file mode 100644 index 00000000000..e5bd0124fcf --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@all_disabled.iq @@ -0,0 +1,93 @@ +# testInnerJoinLeftFunction@all_disabled case-crc:a8494934 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.dim1, foo.dim2, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON SUBSTRING(foo.dim2, 1, 1) = l.k +; ++------+------+---+----+ +| dim1 | dim2 | k | v | ++------+------+---+----+ +| | a | a | xa | +| 1 | a | a | xa | +| def | abc | a | xa | ++------+------+---+----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4]) + LogicalJoin(condition=[=($2, $3)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4], druid=[logical]) + DruidJoin(condition=[=($2, $3)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.k", "j0.v" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@all_enabled.iq new file mode 100644 index 00000000000..659a20e4533 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@all_enabled.iq @@ -0,0 +1,93 @@ +# testInnerJoinLeftFunction@all_enabled case-crc:51164f2b +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.dim1, foo.dim2, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON SUBSTRING(foo.dim2, 1, 1) = l.k +; ++------+------+---+----+ +| dim1 | dim2 | k | v | ++------+------+---+----+ +| | a | a | xa | +| 1 | a | a | xa | +| def | abc | a | xa | ++------+------+---+----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4]) + LogicalJoin(condition=[=($2, $3)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4], druid=[logical]) + DruidJoin(condition=[=($2, $3)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.k", "j0.v" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@default.iq new file mode 100644 index 00000000000..44f2c01da3c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@default.iq @@ -0,0 +1,90 @@ +# testInnerJoinLeftFunction@default case-crc:cbea2a3d +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.dim1, foo.dim2, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON SUBSTRING(foo.dim2, 1, 1) = l.k +; ++------+------+---+----+ +| dim1 | dim2 | k | v | ++------+------+---+----+ +| | a | a | xa | +| 1 | a | a | xa | +| def | abc | a | xa | ++------+------+---+----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4]) + LogicalJoin(condition=[=($2, $3)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4], druid=[logical]) + DruidJoin(condition=[=($2, $3)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.k", "j0.v" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-on-value-column_disabled.iq new file mode 100644 index 00000000000..cb70cfd6786 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-on-value-column_disabled.iq @@ -0,0 +1,93 @@ +# testInnerJoinLeftFunction@filter-on-value-column_disabled case-crc:e04823f2 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.dim1, foo.dim2, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON SUBSTRING(foo.dim2, 1, 1) = l.k +; ++------+------+---+----+ +| dim1 | dim2 | k | v | ++------+------+---+----+ +| | a | a | xa | +| 1 | a | a | xa | +| def | abc | a | xa | ++------+------+---+----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4]) + LogicalJoin(condition=[=($2, $3)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4], druid=[logical]) + DruidJoin(condition=[=($2, $3)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.k", "j0.v" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-rewrites-disabled.iq new file mode 100644 index 00000000000..c6a24964fbf --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-rewrites-disabled.iq @@ -0,0 +1,93 @@ +# testInnerJoinLeftFunction@filter-rewrites-disabled case-crc:49782da2 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.dim1, foo.dim2, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON SUBSTRING(foo.dim2, 1, 1) = l.k +; ++------+------+---+----+ +| dim1 | dim2 | k | v | ++------+------+---+----+ +| | a | a | xa | +| 1 | a | a | xa | +| def | abc | a | xa | ++------+------+---+----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4]) + LogicalJoin(condition=[=($2, $3)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4], druid=[logical]) + DruidJoin(condition=[=($2, $3)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.k", "j0.v" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-rewrites.iq new file mode 100644 index 00000000000..238d9fcddb9 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@filter-rewrites.iq @@ -0,0 +1,93 @@ +# testInnerJoinLeftFunction@filter-rewrites case-crc:88fbe7a0 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.dim1, foo.dim2, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON SUBSTRING(foo.dim2, 1, 1) = l.k +; ++------+------+---+----+ +| dim1 | dim2 | k | v | ++------+------+---+----+ +| | a | a | xa | +| 1 | a | a | xa | +| def | abc | a | xa | ++------+------+---+----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4]) + LogicalJoin(condition=[=($2, $3)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4], druid=[logical]) + DruidJoin(condition=[=($2, $3)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.k", "j0.v" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@join-to-filter.iq new file mode 100644 index 00000000000..f5a8444cd95 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinLeftFunction@join-to-filter.iq @@ -0,0 +1,93 @@ +# testInnerJoinLeftFunction@join-to-filter case-crc:d8b2c6e1 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo.dim1, foo.dim2, l.k, l.v +FROM foo +INNER JOIN lookup.lookyloo l ON SUBSTRING(foo.dim2, 1, 1) = l.k +; ++------+------+---+----+ +| dim1 | dim2 | k | v | ++------+------+---+----+ +| | a | a | xa | +| 1 | a | a | xa | +| def | abc | a | xa | ++------+------+---+----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4]) + LogicalJoin(condition=[=($2, $3)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], k=[$3], v=[$4], druid=[logical]) + DruidJoin(condition=[=($2, $3)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], $f8=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.k", "j0.v" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..b673cb7d722 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default case-crc:c8387bad +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..eecc02c743b --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql case-crc:c8387bad +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default.iq new file mode 100644 index 00000000000..4067edb5bcb --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default case-crc:3117d34a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql.iq new file mode 100644 index 00000000000..1996db4d5d0 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql case-crc:3117d34a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default.iq new file mode 100644 index 00000000000..6062daaf9a6 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default.iq @@ -0,0 +1,130 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default case-crc:8573b42e +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql.iq new file mode 100644 index 00000000000..538c1612255 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql.iq @@ -0,0 +1,132 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql case-crc:8573b42e +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..5c905acff34 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default case-crc:aba2d8ac +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..3fb25cee412 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql case-crc:aba2d8ac +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq new file mode 100644 index 00000000000..273ab55d1a0 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default case-crc:6bf67b17 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..92e569b8a86 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql case-crc:6bf67b17 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq new file mode 100644 index 00000000000..fb0b6d4fa2a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default case-crc:bf731e2a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq new file mode 100644 index 00000000000..3f7bf11759c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql case-crc:bf731e2a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default.iq new file mode 100644 index 00000000000..c8718ddff9b --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default case-crc:a0b23b27 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq new file mode 100644 index 00000000000..afdb2ecd889 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql case-crc:a0b23b27 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..bb7b19ce9db --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default case-crc:bc06e265 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..585ba59b372 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql case-crc:bc06e265 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default.iq new file mode 100644 index 00000000000..589d7222a59 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default case-crc:19717e46 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql.iq new file mode 100644 index 00000000000..83c9355ff1b --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql case-crc:19717e46 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default.iq new file mode 100644 index 00000000000..7df3873f942 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default.iq @@ -0,0 +1,130 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default case-crc:cddd4617 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql.iq new file mode 100644 index 00000000000..51c017fa088 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql.iq @@ -0,0 +1,132 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql case-crc:cddd4617 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..a5611b67b16 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default case-crc:e72bd235 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..a30b72faf1a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql case-crc:e72bd235 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq new file mode 100644 index 00000000000..a9dc4345572 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default case-crc:50015dc5 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..b068148f553 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql case-crc:50015dc5 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq new file mode 100644 index 00000000000..2b4c57c3931 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default case-crc:ae732a4e +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq new file mode 100644 index 00000000000..7671fed30ed --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql case-crc:ae732a4e +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default.iq new file mode 100644 index 00000000000..90f380fbc42 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default case-crc:a3f1513a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq new file mode 100644 index 00000000000..03bf0675958 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql case-crc:a3f1513a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 INNER JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[inner]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[inner]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@all_disabled.iq new file mode 100644 index 00000000000..fbff0879b5c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@all_disabled.iq @@ -0,0 +1,113 @@ +# testInnerJoinQueryOfLookup@all_disabled case-crc:d41a4a0d +# quidem testcase reason: FINALIZING_FIELD_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.v, t1.v +FROM foo +INNER JOIN + (SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1 + ON foo.dim2 = t1.k; ++------+------+------+------+ +| dim1 | dim2 | v | v | ++------+------+------+------+ +| | a | xabc | xabc | +| 1 | a | xabc | xabc | ++------+------+------+------+ +(2 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)]) + LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical]) + DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "k", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0:a", + "fieldName" : "v", + "maxStringBytes" : 10, + "aggregateMultipleValues" : true + } ], + "postAggregations" : [ { + "type" : "finalizingFieldAccess", + "name" : "a0", + "fieldName" : "a0:a" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@all_enabled.iq new file mode 100644 index 00000000000..3409cd00e56 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@all_enabled.iq @@ -0,0 +1,113 @@ +# testInnerJoinQueryOfLookup@all_enabled case-crc:93392df4 +# quidem testcase reason: FINALIZING_FIELD_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.v, t1.v +FROM foo +INNER JOIN + (SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1 + ON foo.dim2 = t1.k; ++------+------+------+------+ +| dim1 | dim2 | v | v | ++------+------+------+------+ +| | a | xabc | xabc | +| 1 | a | xabc | xabc | ++------+------+------+------+ +(2 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)]) + LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical]) + DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "k", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0:a", + "fieldName" : "v", + "maxStringBytes" : 10, + "aggregateMultipleValues" : true + } ], + "postAggregations" : [ { + "type" : "finalizingFieldAccess", + "name" : "a0", + "fieldName" : "a0:a" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@default.iq new file mode 100644 index 00000000000..0c4f8abd6f9 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@default.iq @@ -0,0 +1,110 @@ +# testInnerJoinQueryOfLookup@default case-crc:ee151062 +# quidem testcase reason: FINALIZING_FIELD_ACCESS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.v, t1.v +FROM foo +INNER JOIN + (SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1 + ON foo.dim2 = t1.k; ++------+------+------+------+ +| dim1 | dim2 | v | v | ++------+------+------+------+ +| | a | xabc | xabc | +| 1 | a | xabc | xabc | ++------+------+------+------+ +(2 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)]) + LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical]) + DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "k", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0:a", + "fieldName" : "v", + "maxStringBytes" : 10, + "aggregateMultipleValues" : true + } ], + "postAggregations" : [ { + "type" : "finalizingFieldAccess", + "name" : "a0", + "fieldName" : "a0:a" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-on-value-column_disabled.iq new file mode 100644 index 00000000000..3d61195af63 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-on-value-column_disabled.iq @@ -0,0 +1,113 @@ +# testInnerJoinQueryOfLookup@filter-on-value-column_disabled case-crc:dbd4147e +# quidem testcase reason: FINALIZING_FIELD_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.v, t1.v +FROM foo +INNER JOIN + (SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1 + ON foo.dim2 = t1.k; ++------+------+------+------+ +| dim1 | dim2 | v | v | ++------+------+------+------+ +| | a | xabc | xabc | +| 1 | a | xabc | xabc | ++------+------+------+------+ +(2 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)]) + LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical]) + DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "k", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0:a", + "fieldName" : "v", + "maxStringBytes" : 10, + "aggregateMultipleValues" : true + } ], + "postAggregations" : [ { + "type" : "finalizingFieldAccess", + "name" : "a0", + "fieldName" : "a0:a" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-rewrites-disabled.iq new file mode 100644 index 00000000000..30b667f33cb --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-rewrites-disabled.iq @@ -0,0 +1,113 @@ +# testInnerJoinQueryOfLookup@filter-rewrites-disabled case-crc:57dd8dfa +# quidem testcase reason: FINALIZING_FIELD_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.v, t1.v +FROM foo +INNER JOIN + (SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1 + ON foo.dim2 = t1.k; ++------+------+------+------+ +| dim1 | dim2 | v | v | ++------+------+------+------+ +| | a | xabc | xabc | +| 1 | a | xabc | xabc | ++------+------+------+------+ +(2 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)]) + LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical]) + DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "k", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0:a", + "fieldName" : "v", + "maxStringBytes" : 10, + "aggregateMultipleValues" : true + } ], + "postAggregations" : [ { + "type" : "finalizingFieldAccess", + "name" : "a0", + "fieldName" : "a0:a" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-rewrites.iq new file mode 100644 index 00000000000..279e3a590c0 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@filter-rewrites.iq @@ -0,0 +1,113 @@ +# testInnerJoinQueryOfLookup@filter-rewrites case-crc:10d0367d +# quidem testcase reason: FINALIZING_FIELD_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.v, t1.v +FROM foo +INNER JOIN + (SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1 + ON foo.dim2 = t1.k; ++------+------+------+------+ +| dim1 | dim2 | v | v | ++------+------+------+------+ +| | a | xabc | xabc | +| 1 | a | xabc | xabc | ++------+------+------+------+ +(2 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)]) + LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical]) + DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "k", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0:a", + "fieldName" : "v", + "maxStringBytes" : 10, + "aggregateMultipleValues" : true + } ], + "postAggregations" : [ { + "type" : "finalizingFieldAccess", + "name" : "a0", + "fieldName" : "a0:a" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@join-to-filter.iq new file mode 100644 index 00000000000..52c6bc9980a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookup@join-to-filter.iq @@ -0,0 +1,113 @@ +# testInnerJoinQueryOfLookup@join-to-filter case-crc:967213e2 +# quidem testcase reason: FINALIZING_FIELD_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.v, t1.v +FROM foo +INNER JOIN + (SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1 + ON foo.dim2 = t1.k; ++------+------+------+------+ +| dim1 | dim2 | v | v | ++------+------+------+------+ +| | a | xabc | xabc | +| 1 | a | xabc | xabc | ++------+------+------+------+ +(2 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)]) + LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical]) + DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "k", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0:a", + "fieldName" : "v", + "maxStringBytes" : 10, + "aggregateMultipleValues" : true + } ], + "postAggregations" : [ { + "type" : "finalizingFieldAccess", + "name" : "a0", + "fieldName" : "a0:a" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@all_disabled.iq new file mode 100644 index 00000000000..c8d92aff808 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@all_disabled.iq @@ -0,0 +1,96 @@ +# testInnerJoinQueryOfLookupRemovable@all_disabled case-crc:f9e61e4e +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.sk +FROM foo +INNER JOIN + (SELECT k, SUBSTRING(v, 1, 3) sk FROM lookup.lookyloo) t1 + ON foo.dim2 = t1.k; ++------+------+-----+ +| dim1 | dim2 | sk | ++------+------+-----+ +| | a | xa | +| 1 | a | xa | +| def | abc | xab | ++------+------+-----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], sk=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(k=[$0], sk=[SUBSTRING($1, 1, 3)]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], sk=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(k=[$0], sk=[SUBSTRING($1, 1, 3)], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"v\", 0, 3)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "k", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@all_enabled.iq new file mode 100644 index 00000000000..95cdbe25858 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@all_enabled.iq @@ -0,0 +1,96 @@ +# testInnerJoinQueryOfLookupRemovable@all_enabled case-crc:110c167a +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.sk +FROM foo +INNER JOIN + (SELECT k, SUBSTRING(v, 1, 3) sk FROM lookup.lookyloo) t1 + ON foo.dim2 = t1.k; ++------+------+-----+ +| dim1 | dim2 | sk | ++------+------+-----+ +| | a | xa | +| 1 | a | xa | +| def | abc | xab | ++------+------+-----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], sk=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(k=[$0], sk=[SUBSTRING($1, 1, 3)]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], sk=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(k=[$0], sk=[SUBSTRING($1, 1, 3)], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"v\", 0, 3)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "k", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@default.iq new file mode 100644 index 00000000000..3fb227e9c34 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@default.iq @@ -0,0 +1,93 @@ +# testInnerJoinQueryOfLookupRemovable@default case-crc:56875820 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.sk +FROM foo +INNER JOIN + (SELECT k, SUBSTRING(v, 1, 3) sk FROM lookup.lookyloo) t1 + ON foo.dim2 = t1.k; ++------+------+-----+ +| dim1 | dim2 | sk | ++------+------+-----+ +| | a | xa | +| 1 | a | xa | +| def | abc | xab | ++------+------+-----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], sk=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(k=[$0], sk=[SUBSTRING($1, 1, 3)]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], sk=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(k=[$0], sk=[SUBSTRING($1, 1, 3)], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"v\", 0, 3)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "k", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-on-value-column_disabled.iq new file mode 100644 index 00000000000..94433129db0 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-on-value-column_disabled.iq @@ -0,0 +1,96 @@ +# testInnerJoinQueryOfLookupRemovable@filter-on-value-column_disabled case-crc:1624eceb +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.sk +FROM foo +INNER JOIN + (SELECT k, SUBSTRING(v, 1, 3) sk FROM lookup.lookyloo) t1 + ON foo.dim2 = t1.k; ++------+------+-----+ +| dim1 | dim2 | sk | ++------+------+-----+ +| | a | xa | +| 1 | a | xa | +| def | abc | xab | ++------+------+-----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], sk=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(k=[$0], sk=[SUBSTRING($1, 1, 3)]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], sk=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(k=[$0], sk=[SUBSTRING($1, 1, 3)], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"v\", 0, 3)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "k", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-rewrites-disabled.iq new file mode 100644 index 00000000000..87be9556a35 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-rewrites-disabled.iq @@ -0,0 +1,96 @@ +# testInnerJoinQueryOfLookupRemovable@filter-rewrites-disabled case-crc:d2cf1525 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.sk +FROM foo +INNER JOIN + (SELECT k, SUBSTRING(v, 1, 3) sk FROM lookup.lookyloo) t1 + ON foo.dim2 = t1.k; ++------+------+-----+ +| dim1 | dim2 | sk | ++------+------+-----+ +| | a | xa | +| 1 | a | xa | +| def | abc | xab | ++------+------+-----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], sk=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(k=[$0], sk=[SUBSTRING($1, 1, 3)]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], sk=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(k=[$0], sk=[SUBSTRING($1, 1, 3)], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"v\", 0, 3)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "k", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-rewrites.iq new file mode 100644 index 00000000000..207003ad6f3 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@filter-rewrites.iq @@ -0,0 +1,96 @@ +# testInnerJoinQueryOfLookupRemovable@filter-rewrites case-crc:f6c15132 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.sk +FROM foo +INNER JOIN + (SELECT k, SUBSTRING(v, 1, 3) sk FROM lookup.lookyloo) t1 + ON foo.dim2 = t1.k; ++------+------+-----+ +| dim1 | dim2 | sk | ++------+------+-----+ +| | a | xa | +| 1 | a | xa | +| def | abc | xab | ++------+------+-----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], sk=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(k=[$0], sk=[SUBSTRING($1, 1, 3)]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], sk=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(k=[$0], sk=[SUBSTRING($1, 1, 3)], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"v\", 0, 3)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "k", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@join-to-filter.iq new file mode 100644 index 00000000000..c2fc24a6307 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinQueryOfLookupRemovable@join-to-filter.iq @@ -0,0 +1,96 @@ +# testInnerJoinQueryOfLookupRemovable@join-to-filter case-crc:dfb4dee9 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, dim2, t1.sk +FROM foo +INNER JOIN + (SELECT k, SUBSTRING(v, 1, 3) sk FROM lookup.lookyloo) t1 + ON foo.dim2 = t1.k; ++------+------+-----+ +| dim1 | dim2 | sk | ++------+------+-----+ +| | a | xa | +| 1 | a | xa | +| def | abc | xab | ++------+------+-----+ +(3 rows) + +!ok +LogicalProject(dim1=[$0], dim2=[$1], sk=[$3]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim1=[$1], dim2=[$2]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(k=[$0], sk=[SUBSTRING($1, 1, 3)]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidProject(dim1=[$0], dim2=[$1], sk=[$3], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim1=[$1], dim2=[$2], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(k=[$0], sk=[SUBSTRING($1, 1, 3)], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"v\", 0, 3)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "k", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim2\" == \"j0.k\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "dim2", "j0.v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=default.iq new file mode 100644 index 00000000000..c395fdf3ba9 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=default.iq @@ -0,0 +1,155 @@ +# testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=default case-crc:6c775193 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT CAST(__time AS BIGINT), m1, ANY_VALUE(dim3, 100) FROM foo WHERE (CAST(TIME_FLOOR(__time, 'PT1H') AS BIGINT) + 1, m1) IN + ( + SELECT CAST(TIME_FLOOR(__time, 'PT1H') AS BIGINT) + 1 AS t1, MIN(m1) AS t2 FROM foo WHERE dim3 = 'b' + AND __time BETWEEN '1994-04-29 00:00:00' AND '2020-01-11 00:00:00' GROUP BY 1 + ) +GROUP BY 1, 2 +; ++--------------+-----+--------+ +| EXPR$0 | m1 | EXPR$2 | ++--------------+-----+--------+ +| 946684800000 | 1.0 | [a, b] | +| 946771200000 | 2.0 | [b, c] | ++--------------+-----+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3)]) + LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100]) + LogicalJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + LogicalProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], t2=[MIN($1)]) + LogicalProject(t1=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], m1=[$5]) + LogicalFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3)], druid=[logical]) + DruidProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], druid=[logical]) + DruidJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + DruidProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], t2=[MIN($1)], druid=[logical]) + DruidProject(t1=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], m1=[$5], druid=[logical]) + DruidFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "(timestamp_floor(\"__time\",'PT1H',null,'UTC') + 1)", + "outputType" : "LONG" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "dim3", "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING", "FLOAT", "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1994-04-29T00:00:00.000Z/2020-01-11T00:00:00.001Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "(timestamp_floor(\"__time\",'PT1H',null,'UTC') + 1)", + "outputType" : "LONG" + } ], + "filter" : { + "type" : "selector", + "dimension" : "dim3", + "value" : "b" + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "aggregations" : [ { + "type" : "floatMin", + "name" : "a0", + "fieldName" : "m1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"v0\" == \"j0.d0\") && (\"m1\" == \"j0.a0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + }, { + "type" : "default", + "dimension" : "m1", + "outputName" : "d1", + "outputType" : "FLOAT" + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0", + "fieldName" : "dim3", + "maxStringBytes" : 100, + "aggregateMultipleValues" : true + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=sql.iq new file mode 100644 index 00000000000..4c8cbccbacf --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=sql.iq @@ -0,0 +1,156 @@ +# testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTime@NullHandling=sql case-crc:6c775193 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT CAST(__time AS BIGINT), m1, ANY_VALUE(dim3, 100) FROM foo WHERE (CAST(TIME_FLOOR(__time, 'PT1H') AS BIGINT) + 1, m1) IN + ( + SELECT CAST(TIME_FLOOR(__time, 'PT1H') AS BIGINT) + 1 AS t1, MIN(m1) AS t2 FROM foo WHERE dim3 = 'b' + AND __time BETWEEN '1994-04-29 00:00:00' AND '2020-01-11 00:00:00' GROUP BY 1 + ) +GROUP BY 1, 2 +; ++--------------+-----+--------+ +| EXPR$0 | m1 | EXPR$2 | ++--------------+-----+--------+ +| 946684800000 | 1.0 | [a, b] | +| 946771200000 | 2.0 | [b, c] | ++--------------+-----+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3)]) + LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100]) + LogicalJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + LogicalProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], t2=[MIN($1)]) + LogicalProject(t1=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], m1=[$5]) + LogicalFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3)], druid=[logical]) + DruidProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], druid=[logical]) + DruidJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + DruidProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], t2=[MIN($1)], druid=[logical]) + DruidProject(t1=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], m1=[$5], druid=[logical]) + DruidFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "(timestamp_floor(\"__time\",'PT1H',null,'UTC') + 1)", + "outputType" : "LONG" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "dim3", "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING", "FLOAT", "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1994-04-29T00:00:00.000Z/2020-01-11T00:00:00.001Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "(timestamp_floor(\"__time\",'PT1H',null,'UTC') + 1)", + "outputType" : "LONG" + } ], + "filter" : { + "type" : "equals", + "column" : "dim3", + "matchValueType" : "STRING", + "matchValue" : "b" + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "aggregations" : [ { + "type" : "floatMin", + "name" : "a0", + "fieldName" : "m1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"v0\" == \"j0.d0\") && (\"m1\" == \"j0.a0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + }, { + "type" : "default", + "dimension" : "m1", + "outputName" : "d1", + "outputType" : "FLOAT" + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0", + "fieldName" : "dim3", + "maxStringBytes" : 100, + "aggregateMultipleValues" : true + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=default.iq new file mode 100644 index 00000000000..5478c6b9381 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=default.iq @@ -0,0 +1,155 @@ +# testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=default case-crc:86f4769d +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT CAST(__time AS BIGINT), m1, ANY_VALUE(dim3, 100, false) FROM foo WHERE (CAST(TIME_FLOOR(__time, 'PT1H') AS BIGINT) + 1, m1) IN + ( + SELECT CAST(TIME_FLOOR(__time, 'PT1H') AS BIGINT) + 1 AS t1, MIN(m1) AS t2 FROM foo WHERE dim3 = 'b' + AND __time BETWEEN '1994-04-29 00:00:00' AND '2020-01-11 00:00:00' GROUP BY 1 + ) +GROUP BY 1, 2 +; ++--------------+-----+--------+ +| EXPR$0 | m1 | EXPR$2 | ++--------------+-----+--------+ +| 946684800000 | 1.0 | a | +| 946771200000 | 2.0 | b | ++--------------+-----+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3, $4)]) + LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], $f4=[false]) + LogicalJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + LogicalProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], t2=[MIN($1)]) + LogicalProject(t1=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], m1=[$5]) + LogicalFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3, $4)], druid=[logical]) + DruidProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], $f4=[false], druid=[logical]) + DruidJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + DruidProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], t2=[MIN($1)], druid=[logical]) + DruidProject(t1=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], m1=[$5], druid=[logical]) + DruidFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "(timestamp_floor(\"__time\",'PT1H',null,'UTC') + 1)", + "outputType" : "LONG" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "dim3", "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING", "FLOAT", "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1994-04-29T00:00:00.000Z/2020-01-11T00:00:00.001Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "(timestamp_floor(\"__time\",'PT1H',null,'UTC') + 1)", + "outputType" : "LONG" + } ], + "filter" : { + "type" : "selector", + "dimension" : "dim3", + "value" : "b" + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "aggregations" : [ { + "type" : "floatMin", + "name" : "a0", + "fieldName" : "m1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"v0\" == \"j0.d0\") && (\"m1\" == \"j0.a0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + }, { + "type" : "default", + "dimension" : "m1", + "outputName" : "d1", + "outputType" : "FLOAT" + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0", + "fieldName" : "dim3", + "maxStringBytes" : 100, + "aggregateMultipleValues" : false + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=sql.iq new file mode 100644 index 00000000000..5e815f2c3cb --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=sql.iq @@ -0,0 +1,156 @@ +# testJoinOnGroupByInsteadOfTimeseriesWithFloorOnTimeWithNoAggregateMultipleValues@NullHandling=sql case-crc:86f4769d +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT CAST(__time AS BIGINT), m1, ANY_VALUE(dim3, 100, false) FROM foo WHERE (CAST(TIME_FLOOR(__time, 'PT1H') AS BIGINT) + 1, m1) IN + ( + SELECT CAST(TIME_FLOOR(__time, 'PT1H') AS BIGINT) + 1 AS t1, MIN(m1) AS t2 FROM foo WHERE dim3 = 'b' + AND __time BETWEEN '1994-04-29 00:00:00' AND '2020-01-11 00:00:00' GROUP BY 1 + ) +GROUP BY 1, 2 +; ++--------------+-----+--------+ +| EXPR$0 | m1 | EXPR$2 | ++--------------+-----+--------+ +| 946684800000 | 1.0 | a | +| 946771200000 | 2.0 | b | ++--------------+-----+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3, $4)]) + LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], $f4=[false]) + LogicalJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + LogicalProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], t2=[MIN($1)]) + LogicalProject(t1=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], m1=[$5]) + LogicalFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3, $4)], druid=[logical]) + DruidProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], $f4=[false], druid=[logical]) + DruidJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + DruidProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], t2=[MIN($1)], druid=[logical]) + DruidProject(t1=[+(CAST(TIME_FLOOR($0, 'PT1H')):BIGINT NOT NULL, 1)], m1=[$5], druid=[logical]) + DruidFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "(timestamp_floor(\"__time\",'PT1H',null,'UTC') + 1)", + "outputType" : "LONG" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "dim3", "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING", "FLOAT", "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1994-04-29T00:00:00.000Z/2020-01-11T00:00:00.001Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "(timestamp_floor(\"__time\",'PT1H',null,'UTC') + 1)", + "outputType" : "LONG" + } ], + "filter" : { + "type" : "equals", + "column" : "dim3", + "matchValueType" : "STRING", + "matchValue" : "b" + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "aggregations" : [ { + "type" : "floatMin", + "name" : "a0", + "fieldName" : "m1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"v0\" == \"j0.d0\") && (\"m1\" == \"j0.a0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + }, { + "type" : "default", + "dimension" : "m1", + "outputName" : "d1", + "outputType" : "FLOAT" + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0", + "fieldName" : "dim3", + "maxStringBytes" : 100, + "aggregateMultipleValues" : false + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnTimeseriesWithFloorOnTime@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnTimeseriesWithFloorOnTime@NullHandling=default.iq new file mode 100644 index 00000000000..7167a4ce8db --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnTimeseriesWithFloorOnTime@NullHandling=default.iq @@ -0,0 +1,138 @@ +# testJoinOnTimeseriesWithFloorOnTime@NullHandling=default case-crc:5df8fd08 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT CAST(__time AS BIGINT), m1, ANY_VALUE(dim3, 100, true) FROM foo WHERE (TIME_FLOOR(__time, 'PT1H'), m1) IN + ( + SELECT TIME_FLOOR(__time, 'PT1H') AS t1, MIN(m1) AS t2 FROM foo WHERE dim3 = 'b' + AND __time BETWEEN '1994-04-29 00:00:00' AND '2020-01-11 00:00:00' GROUP BY 1 + ) +GROUP BY 1, 2 +; ++--------------+-----+--------+ +| EXPR$0 | m1 | EXPR$2 | ++--------------+-----+--------+ +| 946684800000 | 1.0 | [a, b] | +| 946771200000 | 2.0 | [b, c] | ++--------------+-----+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3, $4)]) + LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], $f4=[true]) + LogicalJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + LogicalProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[TIME_FLOOR($0, 'PT1H')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], t2=[MIN($1)]) + LogicalProject(t1=[TIME_FLOOR($0, 'PT1H')], m1=[$5]) + LogicalFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3, $4)], druid=[logical]) + DruidProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], $f4=[true], druid=[logical]) + DruidJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + DruidProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[TIME_FLOOR($0, 'PT1H')], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], t2=[MIN($1)], druid=[logical]) + DruidProject(t1=[TIME_FLOOR($0, 'PT1H')], m1=[$5], druid=[logical]) + DruidFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "timestamp_floor(\"__time\",'PT1H',null,'UTC')", + "outputType" : "LONG" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "dim3", "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING", "FLOAT", "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "timeseries", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1994-04-29T00:00:00.000Z/2020-01-11T00:00:00.001Z" ] + }, + "filter" : { + "type" : "selector", + "dimension" : "dim3", + "value" : "b" + }, + "granularity" : "HOUR", + "aggregations" : [ { + "type" : "floatMin", + "name" : "a0", + "fieldName" : "m1" + } ] + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"v0\" == \"j0.d0\") && (\"m1\" == \"j0.a0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + }, { + "type" : "default", + "dimension" : "m1", + "outputName" : "d1", + "outputType" : "FLOAT" + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0", + "fieldName" : "dim3", + "maxStringBytes" : 100, + "aggregateMultipleValues" : true + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnTimeseriesWithFloorOnTime@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnTimeseriesWithFloorOnTime@NullHandling=sql.iq new file mode 100644 index 00000000000..073386da08c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinOnTimeseriesWithFloorOnTime@NullHandling=sql.iq @@ -0,0 +1,139 @@ +# testJoinOnTimeseriesWithFloorOnTime@NullHandling=sql case-crc:5df8fd08 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT CAST(__time AS BIGINT), m1, ANY_VALUE(dim3, 100, true) FROM foo WHERE (TIME_FLOOR(__time, 'PT1H'), m1) IN + ( + SELECT TIME_FLOOR(__time, 'PT1H') AS t1, MIN(m1) AS t2 FROM foo WHERE dim3 = 'b' + AND __time BETWEEN '1994-04-29 00:00:00' AND '2020-01-11 00:00:00' GROUP BY 1 + ) +GROUP BY 1, 2 +; ++--------------+-----+--------+ +| EXPR$0 | m1 | EXPR$2 | ++--------------+-----+--------+ +| 946684800000 | 1.0 | [a, b] | +| 946771200000 | 2.0 | [b, c] | ++--------------+-----+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3, $4)]) + LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], $f4=[true]) + LogicalJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + LogicalProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[TIME_FLOOR($0, 'PT1H')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], t2=[MIN($1)]) + LogicalProject(t1=[TIME_FLOOR($0, 'PT1H')], m1=[$5]) + LogicalFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0, 1}], EXPR$2=[ANY_VALUE($2, $3, $4)], druid=[logical]) + DruidProject(EXPR$0=[CAST($0):BIGINT NOT NULL], m1=[$2], dim3=[$1], $f3=[100], $f4=[true], druid=[logical]) + DruidJoin(condition=[AND(=($3, $4), =($2, $5))], joinType=[inner]) + DruidProject(__time=[$0], dim3=[$3], m1=[$5], $f3=[TIME_FLOOR($0, 'PT1H')], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], t2=[MIN($1)], druid=[logical]) + DruidProject(t1=[TIME_FLOOR($0, 'PT1H')], m1=[$5], druid=[logical]) + DruidFilter(condition=[AND(=($3, 'b'), SEARCH($0, Sarg[[1994-04-29 00:00:00:TIMESTAMP(3)..2020-01-11 00:00:00:TIMESTAMP(3)]]:TIMESTAMP(3)))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "timestamp_floor(\"__time\",'PT1H',null,'UTC')", + "outputType" : "LONG" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "dim3", "m1", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING", "FLOAT", "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "timeseries", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1994-04-29T00:00:00.000Z/2020-01-11T00:00:00.001Z" ] + }, + "filter" : { + "type" : "equals", + "column" : "dim3", + "matchValueType" : "STRING", + "matchValue" : "b" + }, + "granularity" : "HOUR", + "aggregations" : [ { + "type" : "floatMin", + "name" : "a0", + "fieldName" : "m1" + } ] + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"v0\" == \"j0.d0\") && (\"m1\" == \"j0.a0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "__time", + "outputName" : "d0", + "outputType" : "LONG" + }, { + "type" : "default", + "dimension" : "m1", + "outputName" : "d1", + "outputType" : "FLOAT" + } ], + "aggregations" : [ { + "type" : "stringAny", + "name" : "a0", + "fieldName" : "dim3", + "maxStringBytes" : 100, + "aggregateMultipleValues" : true + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinWithInputRefCondition@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinWithInputRefCondition@NullHandling=default.iq new file mode 100644 index 00000000000..babde45b3ce --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinWithInputRefCondition@NullHandling=default.iq @@ -0,0 +1,126 @@ +# testJoinWithInputRefCondition@NullHandling=default case-crc:9a6c217b +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT COUNT(*) FILTER (WHERE FLOOR(100) NOT IN (SELECT m1 FROM foo)) FROM foo; ++--------+ +| EXPR$0 | ++--------+ +| 6 | ++--------+ +(1 row) + +!ok +LogicalAggregate(group=[{}], EXPR$0=[COUNT() FILTER $0]) + LogicalProject($f0=[IS NULL($2)]) + LogicalJoin(condition=[=(CAST(FLOOR(100)):FLOAT NOT NULL, $1)], joinType=[left]) + LogicalProject(DUMMY=[0]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{5}], i=[LITERAL_AGG(true)]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{}], EXPR$0=[COUNT() FILTER $0], druid=[logical]) + DruidProject($f0=[IS NULL($2)], druid=[logical]) + DruidJoin(condition=[=(CAST(FLOOR(100)):FLOAT NOT NULL, $1)], joinType=[left]) + DruidProject(DUMMY=[0], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{5}], i=[LITERAL_AGG(true)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "timeseries", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "0", + "outputType" : "LONG" + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "m1", + "outputName" : "d0", + "outputType" : "FLOAT" + } ], + "postAggregations" : [ { + "type" : "expression", + "name" : "a0", + "expression" : "1", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(CAST(floor(100), 'DOUBLE') == \"j0.d0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "selector", + "dimension" : "j0.a0", + "value" : null + }, + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinWithInputRefCondition@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinWithInputRefCondition@NullHandling=sql.iq new file mode 100644 index 00000000000..7b233392a0e --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testJoinWithInputRefCondition@NullHandling=sql.iq @@ -0,0 +1,186 @@ +# testJoinWithInputRefCondition@NullHandling=sql case-crc:9a6c217b +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT COUNT(*) FILTER (WHERE FLOOR(100) NOT IN (SELECT m1 FROM foo)) FROM foo; ++--------+ +| EXPR$0 | ++--------+ +| 6 | ++--------+ +(1 row) + +!ok +LogicalAggregate(group=[{}], EXPR$0=[COUNT() FILTER $0]) + LogicalProject($f0=[OR(=($1, 0), AND(IS NULL($4), >=($2, $1)))]) + LogicalJoin(condition=[=(CAST(FLOOR(100)):FLOAT NOT NULL, $3)], joinType=[left]) + LogicalJoin(condition=[true], joinType=[inner]) + LogicalProject(DUMMY=[0]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($5)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{5}], i=[LITERAL_AGG(true)]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{}], EXPR$0=[COUNT() FILTER $0], druid=[logical]) + DruidProject($f0=[OR(=($1, 0), AND(IS NULL($4), >=($2, $1)))], druid=[logical]) + DruidJoin(condition=[=(CAST(FLOOR(100)):FLOAT NOT NULL, $3)], joinType=[left]) + DruidJoin(condition=[true], joinType=[inner]) + DruidProject(DUMMY=[0], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{}], c=[COUNT()], ck=[COUNT($5)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{5}], i=[LITERAL_AGG(true)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "timeseries", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "0", + "outputType" : "LONG" + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "timeseries", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + }, { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a1" + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "null", + "column" : "m1" + } + }, + "name" : "a1" + } ] + } + }, + "rightPrefix" : "j0.", + "condition" : "1", + "joinType" : "INNER" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "m1", + "outputName" : "d0", + "outputType" : "FLOAT" + } ], + "postAggregations" : [ { + "type" : "expression", + "name" : "a0", + "expression" : "1", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "(CAST(floor(100), 'DOUBLE') == \"_j0.d0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "or", + "fields" : [ { + "type" : "equals", + "column" : "j0.a0", + "matchValueType" : "LONG", + "matchValue" : 0 + }, { + "type" : "and", + "fields" : [ { + "type" : "null", + "column" : "_j0.a0" + }, { + "type" : "expression", + "expression" : "(\"j0.a1\" >= \"j0.a0\")" + } ] + } ] + }, + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..8eded902fac --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=default case-crc:812bafe2 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..a0843c687b5 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_disabled@NullHandling=sql case-crc:812bafe2 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default.iq new file mode 100644 index 00000000000..876e3754f56 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=default case-crc:8fd5adf2 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql.iq new file mode 100644 index 00000000000..9522671d998 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@all_enabled@NullHandling=sql case-crc:8fd5adf2 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default.iq new file mode 100644 index 00000000000..62ceac66ee5 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default.iq @@ -0,0 +1,130 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=default case-crc:96a161fe +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql.iq new file mode 100644 index 00000000000..aef0110abb0 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql.iq @@ -0,0 +1,132 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@default@NullHandling=sql case-crc:96a161fe +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..a7a738f3b55 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default case-crc:c04e449a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..77ef79c876d --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql case-crc:c04e449a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq new file mode 100644 index 00000000000..4efc038a380 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default case-crc:758d5732 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..854f0e04cab --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql case-crc:758d5732 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq new file mode 100644 index 00000000000..4a656b3bc07 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=default case-crc:108e478f +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq new file mode 100644 index 00000000000..4689ba66915 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@filter-rewrites@NullHandling=sql case-crc:108e478f +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default.iq new file mode 100644 index 00000000000..0a10654bbdc --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=default case-crc:9aafecc7 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq new file mode 100644 index 00000000000..f102203a979 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSourcesWithOuterWhere_withLeftDirectAccess@join-to-filter@NullHandling=sql case-crc:9aafecc7 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..c899ca42f50 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=default case-crc:8c906e38 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..b72648d4ba3 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=sql.iq @@ -0,0 +1,141 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_disabled@NullHandling=sql case-crc:8c906e38 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=default.iq new file mode 100644 index 00000000000..ae82abfaed8 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=default case-crc:82cd66be +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=sql.iq new file mode 100644 index 00000000000..efd79e34532 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=sql.iq @@ -0,0 +1,141 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@all_enabled@NullHandling=sql case-crc:82cd66be +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=default.iq new file mode 100644 index 00000000000..04d616a090a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=default.iq @@ -0,0 +1,136 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=default case-crc:0d6a36b1 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=sql.iq new file mode 100644 index 00000000000..43ac841557c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=sql.iq @@ -0,0 +1,138 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@default@NullHandling=sql case-crc:0d6a36b1 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..d39d77e3a82 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default case-crc:39d6e0f2 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..4b96abc1555 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq @@ -0,0 +1,141 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql case-crc:39d6e0f2 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq new file mode 100644 index 00000000000..7bf6fa02d00 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default case-crc:18bc3b01 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..0803b427982 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq @@ -0,0 +1,141 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql case-crc:18bc3b01 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq new file mode 100644 index 00000000000..4068aa57724 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=default case-crc:f4e03dc8 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq new file mode 100644 index 00000000000..949d14d853d --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq @@ -0,0 +1,141 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@filter-rewrites@NullHandling=sql case-crc:f4e03dc8 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=default.iq new file mode 100644 index 00000000000..9c1d562f682 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=default case-crc:12f185e2 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq new file mode 100644 index 00000000000..9bd4ecafd97 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq @@ -0,0 +1,141 @@ +# testLeftJoinOnTwoInlineDataSourcesWithTimeFilter_withLeftDirectAccess@join-to-filter@NullHandling=sql case-crc:12f185e2 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' AND "__time" >= '1999' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 WHERE t1.dim1 = '10.1' +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR]) + LogicalFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], druid=[logical]) + DruidFilter(condition=[AND(=($1, '10.1'), >=($0, 1999-01-01 00:00:00))]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "1999-01-01T00:00:00.000Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..d3f88c96550 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=default case-crc:4fbedf89 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..1c91a6ca4d4 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_disabled@NullHandling=sql case-crc:4fbedf89 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default.iq new file mode 100644 index 00000000000..8674874c92a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=default case-crc:b8a4cfcc +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql.iq new file mode 100644 index 00000000000..efff7d66405 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@all_enabled@NullHandling=sql case-crc:b8a4cfcc +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default.iq new file mode 100644 index 00000000000..9302fc9bb4f --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default.iq @@ -0,0 +1,130 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=default case-crc:894a632a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql.iq new file mode 100644 index 00000000000..cf60b23d50c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql.iq @@ -0,0 +1,132 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@default@NullHandling=sql case-crc:894a632a +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinLeftTableScanDirect true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..935e4701f1e --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=default case-crc:3fd983bc +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..c74ae449b9e --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-on-value-column_disabled@NullHandling=sql case-crc:3fd983bc +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq new file mode 100644 index 00000000000..9acd3ab4655 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=default case-crc:af2a3a3c +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..0294f2a6027 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites-disabled@NullHandling=sql case-crc:af2a3a3c +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq new file mode 100644 index 00000000000..6e0f9288ca2 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=default case-crc:f53ef0f5 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq new file mode 100644 index 00000000000..a5119dd551a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@filter-rewrites@NullHandling=sql case-crc:f53ef0f5 +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default.iq new file mode 100644 index 00000000000..128b3ddfa23 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default.iq @@ -0,0 +1,133 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=default case-crc:76a9a03f +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "selector", + "dimension" : "dim1", + "value" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq new file mode 100644 index 00000000000..2562afd6020 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql.iq @@ -0,0 +1,135 @@ +# testLeftJoinOnTwoInlineDataSources_withLeftDirectAccess@join-to-filter@NullHandling=sql case-crc:76a9a03f +# quidem testcase reason: JOIN_LEFT_DIRECT_ACCESS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableJoinLeftTableScanDirect true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with abc as +( + SELECT dim1, "__time", m1 from foo WHERE "dim1" = '10.1' +) +SELECT t1.dim1, t1."__time" from abc as t1 LEFT JOIN abc as t2 on t1.dim1 = t2.dim1 +; ++------+---------------------+ +| dim1 | __time | ++------+---------------------+ +| 10.1 | 2000-01-02 00:00:00 | ++------+---------------------+ +(1 row) + +!ok +LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1]) + LogicalJoin(condition=[=($0, $2)], joinType=[left]) + LogicalProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + LogicalProject(dim1=[$1]) + LogicalFilter(condition=[=($1, '10.1')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$1], druid=[logical]) + DruidJoin(condition=[=($0, $2)], joinType=[left]) + DruidProject(dim1=[CAST('10.1':VARCHAR):VARCHAR], __time=[$0], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidProject(dim1=[$1], druid=[logical]) + DruidFilter(condition=[=($1, '10.1')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "__time", "v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "filter" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "10.1" + }, + "columns" : [ "dim1" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.dim1\")", + "joinType" : "LEFT" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "_v0", + "expression" : "'10.1'", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "__time", "_v0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_disabled.iq new file mode 100644 index 00000000000..f69e5c22b5e --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_disabled.iq @@ -0,0 +1,100 @@ +# testLeftJoinSubqueryWithSelectorFilter@all_disabled case-crc:6d5ce04a +# quidem testcase reason: EQUIV_PLAN +!set computeInnerJoinCostAsFilter false +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, l1.k +FROM foo +LEFT JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k +WHERE l1.k = 'abc' +; ++------+-----+ +| dim1 | k | ++------+-----+ +| abc | abc | ++------+-----+ +(1 row) + +!ok +LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner]) + LogicalProject(dim1=[$1]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(k=[||($0, '')]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner]) + DruidProject(dim1=[$1], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(k=[||($0, '')], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "concat(\"k\",'')", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "j0.d0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_enabled.iq new file mode 100644 index 00000000000..0fcfdbe725d --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_enabled.iq @@ -0,0 +1,100 @@ +# testLeftJoinSubqueryWithSelectorFilter@all_enabled case-crc:74a61554 +# quidem testcase reason: EQUIV_PLAN +!set computeInnerJoinCostAsFilter false +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, l1.k +FROM foo +LEFT JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k +WHERE l1.k = 'abc' +; ++------+-----+ +| dim1 | k | ++------+-----+ +| abc | abc | ++------+-----+ +(1 row) + +!ok +LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner]) + LogicalProject(dim1=[$1]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(k=[||($0, '')]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner]) + DruidProject(dim1=[$1], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(k=[||($0, '')], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "concat(\"k\",'')", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "j0.d0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@default.iq new file mode 100644 index 00000000000..b2f470dcb74 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@default.iq @@ -0,0 +1,97 @@ +# testLeftJoinSubqueryWithSelectorFilter@default case-crc:cbdfab50 +# quidem testcase reason: EQUIV_PLAN +!set computeInnerJoinCostAsFilter false +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, l1.k +FROM foo +LEFT JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k +WHERE l1.k = 'abc' +; ++------+-----+ +| dim1 | k | ++------+-----+ +| abc | abc | ++------+-----+ +(1 row) + +!ok +LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner]) + LogicalProject(dim1=[$1]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(k=[||($0, '')]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner]) + DruidProject(dim1=[$1], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(k=[||($0, '')], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "concat(\"k\",'')", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "j0.d0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled.iq new file mode 100644 index 00000000000..e0b664541d4 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled.iq @@ -0,0 +1,100 @@ +# testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled case-crc:ca23bb81 +# quidem testcase reason: EQUIV_PLAN +!set computeInnerJoinCostAsFilter false +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, l1.k +FROM foo +LEFT JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k +WHERE l1.k = 'abc' +; ++------+-----+ +| dim1 | k | ++------+-----+ +| abc | abc | ++------+-----+ +(1 row) + +!ok +LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner]) + LogicalProject(dim1=[$1]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(k=[||($0, '')]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner]) + DruidProject(dim1=[$1], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(k=[||($0, '')], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "concat(\"k\",'')", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "j0.d0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled.iq new file mode 100644 index 00000000000..f9e5916b799 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled.iq @@ -0,0 +1,100 @@ +# testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled case-crc:c16b9934 +# quidem testcase reason: EQUIV_PLAN +!set computeInnerJoinCostAsFilter false +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, l1.k +FROM foo +LEFT JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k +WHERE l1.k = 'abc' +; ++------+-----+ +| dim1 | k | ++------+-----+ +| abc | abc | ++------+-----+ +(1 row) + +!ok +LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner]) + LogicalProject(dim1=[$1]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(k=[||($0, '')]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner]) + DruidProject(dim1=[$1], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(k=[||($0, '')], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "concat(\"k\",'')", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "j0.d0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites.iq new file mode 100644 index 00000000000..07aac4aeaca --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites.iq @@ -0,0 +1,100 @@ +# testLeftJoinSubqueryWithSelectorFilter@filter-rewrites case-crc:1fe88b1a +# quidem testcase reason: EQUIV_PLAN +!set computeInnerJoinCostAsFilter false +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, l1.k +FROM foo +LEFT JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k +WHERE l1.k = 'abc' +; ++------+-----+ +| dim1 | k | ++------+-----+ +| abc | abc | ++------+-----+ +(1 row) + +!ok +LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner]) + LogicalProject(dim1=[$1]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(k=[||($0, '')]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner]) + DruidProject(dim1=[$1], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(k=[||($0, '')], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "concat(\"k\",'')", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "j0.d0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@join-to-filter.iq new file mode 100644 index 00000000000..2b975eab86a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@join-to-filter.iq @@ -0,0 +1,100 @@ +# testLeftJoinSubqueryWithSelectorFilter@join-to-filter case-crc:04e8d03a +# quidem testcase reason: EQUIV_PLAN +!set computeInnerJoinCostAsFilter false +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim1, l1.k +FROM foo +LEFT JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k +WHERE l1.k = 'abc' +; ++------+-----+ +| dim1 | k | ++------+-----+ +| abc | abc | ++------+-----+ +(1 row) + +!ok +LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner]) + LogicalProject(dim1=[$1]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(k=[||($0, '')]) + LogicalTableScan(table=[[lookup, lookyloo]]) + +!logicalPlan +DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner]) + DruidProject(dim1=[$1], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(k=[||($0, '')], druid=[logical]) + DruidTableScan(table=[[lookup, lookyloo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "foo" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "lookup", + "lookup" : "lookyloo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "concat(\"k\",'')", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim1", "j0.d0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@all_disabled.iq new file mode 100644 index 00000000000..fb598d994ca --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@all_disabled.iq @@ -0,0 +1,87 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionary@all_disabled case-crc:6743a794 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 2 LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| a | 9 | +| b | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$1], dir0=[ASC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$1], dir0=[ASC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "numeric", + "metric" : "a0" + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@all_enabled.iq new file mode 100644 index 00000000000..e234dcfef44 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@all_enabled.iq @@ -0,0 +1,87 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionary@all_enabled case-crc:f4532a33 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 2 LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| a | 9 | +| b | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$1], dir0=[ASC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$1], dir0=[ASC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "numeric", + "metric" : "a0" + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@default.iq new file mode 100644 index 00000000000..31280e8a5d3 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@default.iq @@ -0,0 +1,84 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionary@default case-crc:2b5c4879 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 2 LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| a | 9 | +| b | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$1], dir0=[ASC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$1], dir0=[ASC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "numeric", + "metric" : "a0" + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-on-value-column_disabled.iq new file mode 100644 index 00000000000..51897f2bb88 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-on-value-column_disabled.iq @@ -0,0 +1,87 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionary@filter-on-value-column_disabled case-crc:8c22741e +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 2 LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| a | 9 | +| b | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$1], dir0=[ASC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$1], dir0=[ASC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "numeric", + "metric" : "a0" + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites-disabled.iq new file mode 100644 index 00000000000..3beccf7f108 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites-disabled.iq @@ -0,0 +1,87 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites-disabled case-crc:1728364a +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 2 LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| a | 9 | +| b | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$1], dir0=[ASC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$1], dir0=[ASC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "numeric", + "metric" : "a0" + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites.iq new file mode 100644 index 00000000000..4a811104ee7 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites.iq @@ -0,0 +1,87 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionary@filter-rewrites case-crc:9f95d078 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 2 LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| a | 9 | +| b | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$1], dir0=[ASC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$1], dir0=[ASC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "numeric", + "metric" : "a0" + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@join-to-filter.iq new file mode 100644 index 00000000000..ef1d84fe2cf --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionary@join-to-filter.iq @@ -0,0 +1,87 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionary@join-to-filter case-crc:358d0e27 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 2 LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| a | 9 | +| b | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$1], dir0=[ASC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$1], dir0=[ASC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "numeric", + "metric" : "a0" + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_disabled.iq new file mode 100644 index 00000000000..a750d0b0955 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_disabled.iq @@ -0,0 +1,89 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_disabled case-crc:ace8ed41 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 1 DESC LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 9 | +| a | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$0], dir0=[DESC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$0], dir0=[DESC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_enabled.iq new file mode 100644 index 00000000000..7b561820d8f --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_enabled.iq @@ -0,0 +1,89 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@all_enabled case-crc:0e40f98f +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 1 DESC LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 9 | +| a | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$0], dir0=[DESC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$0], dir0=[DESC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@default.iq new file mode 100644 index 00000000000..e74437f5309 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@default.iq @@ -0,0 +1,86 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@default case-crc:1100fa9d +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 1 DESC LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 9 | +| a | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$0], dir0=[DESC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$0], dir0=[DESC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-on-value-column_disabled.iq new file mode 100644 index 00000000000..06c2f09c060 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-on-value-column_disabled.iq @@ -0,0 +1,89 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-on-value-column_disabled case-crc:ac75d0d3 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 1 DESC LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 9 | +| a | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$0], dir0=[DESC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$0], dir0=[DESC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites-disabled.iq new file mode 100644 index 00000000000..7ed1f8bf28b --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites-disabled.iq @@ -0,0 +1,89 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites-disabled case-crc:374272b7 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 1 DESC LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 9 | +| a | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$0], dir0=[DESC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$0], dir0=[DESC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites.iq new file mode 100644 index 00000000000..7faa207dbe5 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites.iq @@ -0,0 +1,89 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@filter-rewrites case-crc:40d7e399 +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 1 DESC LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 9 | +| a | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$0], dir0=[DESC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$0], dir0=[DESC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@join-to-filter.iq new file mode 100644 index 00000000000..f93a30fe0c1 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@join-to-filter.iq @@ -0,0 +1,89 @@ +# testTopNOnStringWithNonSortedOrUniqueDictionaryOrderByDim@join-to-filter case-crc:a676ed8c +# quidem testcase reason: EQUIV_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT druid.broadcast.dim4, COUNT(*) +FROM druid.numfoo +INNER JOIN druid.broadcast ON numfoo.dim4 = broadcast.dim4 +GROUP BY 1 ORDER BY 1 DESC LIMIT 4; ++------+--------+ +| dim4 | EXPR$1 | ++------+--------+ +| b | 9 | +| a | 9 | ++------+--------+ +(2 rows) + +!ok +LogicalSort(sort0=[$0], dir0=[DESC], fetch=[4]) + LogicalAggregate(group=[{1}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($0, $1)], joinType=[inner]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim4=[$4]) + LogicalTableScan(table=[[druid, broadcast]]) + +!logicalPlan +DruidSort(sort0=[$0], dir0=[DESC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($0, $1)], joinType=[inner]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim4=[$4], druid=[logical]) + DruidTableScan(table=[[druid, broadcast]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "table", + "name" : "numfoo" + }, + "right" : { + "type" : "globalTable", + "name" : "broadcast" + }, + "rightPrefix" : "j0.", + "condition" : "(\"dim4\" == \"j0.dim4\")", + "joinType" : "INNER" + }, + "dimension" : { + "type" : "default", + "dimension" : "j0.dim4", + "outputName" : "d0", + "outputType" : "STRING" + }, + "metric" : { + "type" : "inverted", + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + } + }, + "threshold" : 4, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..bc0fcae56d4 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=default case-crc:9a0f41b6 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "dim1", + "value" : null + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..915925987a1 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=sql.iq @@ -0,0 +1,140 @@ +# testUsingSubqueryWithExtractionFns@all_disabled@NullHandling=sql case-crc:9a0f41b6 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=default.iq new file mode 100644 index 00000000000..612567cb0a3 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=default case-crc:0562e77f +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "dim1", + "value" : null + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=sql.iq new file mode 100644 index 00000000000..b08fd8766fd --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=sql.iq @@ -0,0 +1,140 @@ +# testUsingSubqueryWithExtractionFns@all_enabled@NullHandling=sql case-crc:0562e77f +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@default@NullHandling=default.iq new file mode 100644 index 00000000000..4f3ddcb829f --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@default@NullHandling=default.iq @@ -0,0 +1,136 @@ +# testUsingSubqueryWithExtractionFns@default@NullHandling=default case-crc:7fdb7eb2 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "dim1", + "value" : null + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@default@NullHandling=sql.iq new file mode 100644 index 00000000000..e158564b801 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@default@NullHandling=sql.iq @@ -0,0 +1,137 @@ +# testUsingSubqueryWithExtractionFns@default@NullHandling=sql case-crc:7fdb7eb2 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=default.iq new file mode 100644 index 00000000000..021473e3f44 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=default case-crc:8312764a +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "dim1", + "value" : null + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..ac02ef44b47 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=sql.iq @@ -0,0 +1,140 @@ +# testUsingSubqueryWithExtractionFns@filter-on-value-column_disabled@NullHandling=sql case-crc:8312764a +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=default.iq new file mode 100644 index 00000000000..5d2e94ea90f --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=default case-crc:75a02bd6 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "dim1", + "value" : null + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=sql.iq new file mode 100644 index 00000000000..44563315f01 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=sql.iq @@ -0,0 +1,140 @@ +# testUsingSubqueryWithExtractionFns@filter-rewrites-disabled@NullHandling=sql case-crc:75a02bd6 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=default.iq new file mode 100644 index 00000000000..c771a5e6a9f --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=default case-crc:59cbfae8 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "dim1", + "value" : null + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=sql.iq new file mode 100644 index 00000000000..4e31bf0d985 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=sql.iq @@ -0,0 +1,140 @@ +# testUsingSubqueryWithExtractionFns@filter-rewrites@NullHandling=sql case-crc:59cbfae8 +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=default.iq new file mode 100644 index 00000000000..e8201c2800a --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=default.iq @@ -0,0 +1,139 @@ +# testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=default case-crc:7dafda1a +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "dim1", + "value" : null + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=sql.iq new file mode 100644 index 00000000000..62bfdc1a0c5 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=sql.iq @@ -0,0 +1,140 @@ +# testUsingSubqueryWithExtractionFns@join-to-filter@NullHandling=sql case-crc:7dafda1a +# quidem testcase reason: JOIN_FILTER_LOCATIONS +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*) FROM druid.foo WHERE substring(dim2, 1, 1) IN (SELECT substring(dim1, 1, 1) FROM druid.foo WHERE dim1 <> '')group by dim2; ++------+--------+ +| dim2 | EXPR$1 | ++------+--------+ +| a | 2 | +| abc | 1 | ++------+--------+ +(2 rows) + +!ok +LogicalAggregate(group=[{0}], EXPR$1=[COUNT()]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}]) + LogicalProject(EXPR$0=[SUBSTRING($1, 1, 1)]) + LogicalFilter(condition=[<>($1, '')]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{0}], EXPR$1=[COUNT()], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim2=[$2], $f1=[SUBSTRING($2, 1, 1)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(EXPR$0=[SUBSTRING($1, 1, 1)], druid=[logical]) + DruidFilter(condition=[<>($1, '')]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "substring(\"dim2\", 0, 1)", + "outputType" : "STRING" + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim2", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "equals", + "column" : "dim1", + "matchValueType" : "STRING", + "matchValue" : "" + } + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "extraction", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@all_disabled.iq new file mode 100644 index 00000000000..389fb0eeaef --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@all_disabled.iq @@ -0,0 +1,126 @@ +# testVirtualColumnOnMVFilterJoinExpression@all_disabled case-crc:1d9875df +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN druid.numfoo as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim3", "j0.dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@all_enabled.iq new file mode 100644 index 00000000000..01e268234fc --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@all_enabled.iq @@ -0,0 +1,126 @@ +# testVirtualColumnOnMVFilterJoinExpression@all_enabled case-crc:83f9a216 +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN druid.numfoo as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim3", "j0.dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@default.iq new file mode 100644 index 00000000000..ae58b2deb85 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@default.iq @@ -0,0 +1,123 @@ +# testVirtualColumnOnMVFilterJoinExpression@default case-crc:d6301c80 +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN druid.numfoo as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim3", "j0.dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-on-value-column_disabled.iq new file mode 100644 index 00000000000..ec901fab83b --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-on-value-column_disabled.iq @@ -0,0 +1,126 @@ +# testVirtualColumnOnMVFilterJoinExpression@filter-on-value-column_disabled case-crc:98ed9bb6 +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN druid.numfoo as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim3", "j0.dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-rewrites-disabled.iq new file mode 100644 index 00000000000..be025d6afb7 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-rewrites-disabled.iq @@ -0,0 +1,126 @@ +# testVirtualColumnOnMVFilterJoinExpression@filter-rewrites-disabled case-crc:c960c4d6 +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN druid.numfoo as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim3", "j0.dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-rewrites.iq new file mode 100644 index 00000000000..95250d0012d --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@filter-rewrites.iq @@ -0,0 +1,126 @@ +# testVirtualColumnOnMVFilterJoinExpression@filter-rewrites case-crc:ec24f5d6 +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN druid.numfoo as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim3", "j0.dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@join-to-filter.iq new file mode 100644 index 00000000000..6028287a7be --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterJoinExpression@join-to-filter.iq @@ -0,0 +1,126 @@ +# testVirtualColumnOnMVFilterJoinExpression@join-to-filter case-crc:8f235220 +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN druid.numfoo as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "dim3", "j0.dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@all_disabled.iq new file mode 100644 index 00000000000..c026e25e85c --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@all_disabled.iq @@ -0,0 +1,202 @@ +# testVirtualColumnOnMVFilterMultiJoinExpression@all_disabled case-crc:6ee56696 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN (SELECT foo3.dim3 FROM druid.numfoo as foo3 INNER JOIN druid.numfoo as foo4 ON MV_FILTER_ONLY(foo3.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo4.dim3, ARRAY['a'])) as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "_v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "_v0", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "(\"v0\" == \"_j0._v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.dim3", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@all_enabled.iq new file mode 100644 index 00000000000..2e13a83a2a8 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@all_enabled.iq @@ -0,0 +1,202 @@ +# testVirtualColumnOnMVFilterMultiJoinExpression@all_enabled case-crc:b798a172 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN (SELECT foo3.dim3 FROM druid.numfoo as foo3 INNER JOIN druid.numfoo as foo4 ON MV_FILTER_ONLY(foo3.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo4.dim3, ARRAY['a'])) as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "_v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "_v0", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "(\"v0\" == \"_j0._v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.dim3", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@default.iq new file mode 100644 index 00000000000..fe86f2126f5 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@default.iq @@ -0,0 +1,199 @@ +# testVirtualColumnOnMVFilterMultiJoinExpression@default case-crc:0f7e2c53 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN (SELECT foo3.dim3 FROM druid.numfoo as foo3 INNER JOIN druid.numfoo as foo4 ON MV_FILTER_ONLY(foo3.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo4.dim3, ARRAY['a'])) as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "_v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "_v0", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "(\"v0\" == \"_j0._v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.dim3", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-on-value-column_disabled.iq new file mode 100644 index 00000000000..40462afd1d0 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-on-value-column_disabled.iq @@ -0,0 +1,202 @@ +# testVirtualColumnOnMVFilterMultiJoinExpression@filter-on-value-column_disabled case-crc:f2bee432 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN (SELECT foo3.dim3 FROM druid.numfoo as foo3 INNER JOIN druid.numfoo as foo4 ON MV_FILTER_ONLY(foo3.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo4.dim3, ARRAY['a'])) as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "_v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "_v0", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "(\"v0\" == \"_j0._v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.dim3", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites-disabled.iq new file mode 100644 index 00000000000..8a33035d040 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites-disabled.iq @@ -0,0 +1,202 @@ +# testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites-disabled case-crc:daa5d2d1 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN (SELECT foo3.dim3 FROM druid.numfoo as foo3 INNER JOIN druid.numfoo as foo4 ON MV_FILTER_ONLY(foo3.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo4.dim3, ARRAY['a'])) as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "_v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "_v0", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "(\"v0\" == \"_j0._v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.dim3", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites.iq new file mode 100644 index 00000000000..d0736234946 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites.iq @@ -0,0 +1,202 @@ +# testVirtualColumnOnMVFilterMultiJoinExpression@filter-rewrites case-crc:dfefab18 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite true +!set enableJoinFilterRewriteValueColumnFilters true +!set enableRewriteJoinToFilter false +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN (SELECT foo3.dim3 FROM druid.numfoo as foo3 INNER JOIN druid.numfoo as foo4 ON MV_FILTER_ONLY(foo3.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo4.dim3, ARRAY['a'])) as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "_v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "_v0", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "(\"v0\" == \"_j0._v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.dim3", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@join-to-filter.iq new file mode 100644 index 00000000000..a844b048a2e --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testVirtualColumnOnMVFilterMultiJoinExpression@join-to-filter.iq @@ -0,0 +1,202 @@ +# testVirtualColumnOnMVFilterMultiJoinExpression@join-to-filter case-crc:2ad04401 +# quidem testcase reason: DEFINETLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableJoinFilterRewrite false +!set enableJoinFilterRewriteValueColumnFilters false +!set enableRewriteJoinToFilter true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT foo1.dim3, foo2.dim3 FROM druid.numfoo as foo1 INNER JOIN (SELECT foo3.dim3 FROM druid.numfoo as foo3 INNER JOIN druid.numfoo as foo4 ON MV_FILTER_ONLY(foo3.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo4.dim3, ARRAY['a'])) as foo2 ON MV_FILTER_ONLY(foo1.dim3, ARRAY['a']) = MV_FILTER_ONLY(foo2.dim3, ARRAY['a']) +; ++-----------+-----------+ +| dim3 | dim3 | ++-----------+-----------+ +| ["a","b"] | ["a","b"] | ++-----------+-----------+ +(1 row) + +!ok +LogicalProject(dim3=[$0], dim30=[$2]) + LogicalJoin(condition=[=($1, $3)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))]) + LogicalJoin(condition=[=($1, $2)], joinType=[inner]) + LogicalProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + LogicalProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim3=[$0], dim30=[$2], druid=[logical]) + DruidJoin(condition=[=($1, $3)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject(dim3=[$0], $f1=[MV_FILTER_ONLY($0, ARRAY('a'))], druid=[logical]) + DruidJoin(condition=[=($1, $2)], joinType=[inner]) + DruidProject(dim3=[$3], $f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + DruidProject($f17=[MV_FILTER_ONLY($3, ARRAY('a'))], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "dim3", "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "v0" ], + "legacy" : false, + "columnTypes" : [ "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "(\"v0\" == \"j0.v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "mv-filtered", + "name" : "_v0", + "delegate" : { + "type" : "default", + "dimension" : "dim3", + "outputName" : "dim3", + "outputType" : "STRING" + }, + "values" : [ "a" ], + "isAllowList" : true + } ], + "resultFormat" : "compactedList", + "columns" : [ "_v0", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "(\"v0\" == \"_j0._v0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.dim3", "dim3" ], + "legacy" : false, + "columnTypes" : [ "STRING", "STRING" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=default.iq new file mode 100644 index 00000000000..70979223a8e --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=default.iq @@ -0,0 +1,108 @@ +# testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=default case-crc:f03f8870 +# quidem testcase reason: AGG_COL_EXCHANGE +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set useApproximateCountDistinct false +!set outputformat mysql +!use druidtest:/// +SELECT dim2, SUM(cnt), COUNT(distinct dim1) FROM druid.foo GROUP BY dim2; ++------+--------+--------+ +| dim2 | EXPR$1 | EXPR$2 | ++------+--------+--------+ +| | 3 | 3 | +| a | 2 | 1 | +| abc | 1 | 1 | ++------+--------+--------+ +(3 rows) + +!ok +LogicalAggregate(group=[{1}], EXPR$1=[SUM($2)], EXPR$2=[COUNT($0)]) + LogicalAggregate(group=[{1, 2}], EXPR$1=[SUM($4)]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{1}], EXPR$1=[SUM($2)], EXPR$2=[COUNT($0)], druid=[logical]) + DruidAggregate(group=[{1, 2}], EXPR$1=[SUM($4)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d1", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "longSum", + "name" : "a0", + "fieldName" : "cnt" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "d1", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "longSum", + "name" : "_a0", + "fieldName" : "a0" + }, { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "_a1" + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "d0", + "value" : null + } + }, + "name" : "_a1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=sql.iq new file mode 100644 index 00000000000..636b9666946 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=sql.iq @@ -0,0 +1,108 @@ +# testExactCountDistinctWithGroupingAndOtherAggregators@NullHandling=sql case-crc:f03f8870 +# quidem testcase reason: AGG_COL_EXCHANGE +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set useApproximateCountDistinct false +!set outputformat mysql +!use druidtest:/// +SELECT dim2, SUM(cnt), COUNT(distinct dim1) FROM druid.foo GROUP BY dim2; ++------+--------+--------+ +| dim2 | EXPR$1 | EXPR$2 | ++------+--------+--------+ +| | 1 | 1 | +| a | 2 | 2 | +| abc | 1 | 1 | +| | 2 | 2 | ++------+--------+--------+ +(4 rows) + +!ok +LogicalAggregate(group=[{1}], EXPR$1=[SUM($2)], EXPR$2=[COUNT($0)]) + LogicalAggregate(group=[{1, 2}], EXPR$1=[SUM($4)]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidAggregate(group=[{1}], EXPR$1=[SUM($2)], EXPR$2=[COUNT($0)], druid=[logical]) + DruidAggregate(group=[{1, 2}], EXPR$1=[SUM($4)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d1", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "longSum", + "name" : "a0", + "fieldName" : "cnt" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "d1", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "longSum", + "name" : "_a0", + "fieldName" : "a0" + }, { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "_a1" + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "null", + "column" : "d0" + } + }, + "name" : "_a1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByLimitPushdownExtraction@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByLimitPushdownExtraction@NullHandling=default.iq new file mode 100644 index 00000000000..a7a5d16f35e --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByLimitPushdownExtraction@NullHandling=default.iq @@ -0,0 +1,84 @@ +# testGroupByLimitPushdownExtraction@NullHandling=default case-crc:006ffd2b +# quidem testcase reason: IMPROVED_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim4, substring(dim5, 1, 1), count(*) FROM druid.numfoo WHERE dim4 = 'a' GROUP BY 1,2 LIMIT 2; ++------+--------+--------+ +| dim4 | EXPR$1 | EXPR$2 | ++------+--------+--------+ +| a | a | 2 | +| a | b | 1 | ++------+--------+--------+ +(2 rows) + +!ok +LogicalProject(dim4=[CAST('a':VARCHAR):VARCHAR], EXPR$1=[$0], EXPR$2=[$1]) + LogicalSort(fetch=[2]) + LogicalAggregate(group=[{0}], EXPR$2=[COUNT()]) + LogicalProject(EXPR$1=[SUBSTRING($5, 1, 1)]) + LogicalFilter(condition=[=($4, 'a')]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim4=[CAST('a':VARCHAR):VARCHAR], EXPR$1=[$0], EXPR$2=[$1], druid=[logical]) + DruidSort(fetch=[2], druid=[logical]) + DruidAggregate(group=[{0}], EXPR$2=[COUNT()], druid=[logical]) + DruidProject(EXPR$1=[SUBSTRING($5, 1, 1)], druid=[logical]) + DruidFilter(condition=[=($4, 'a')]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "dimension" : { + "type" : "extraction", + "dimension" : "dim5", + "outputName" : "_d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + }, + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + }, + "threshold" : 2, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "selector", + "dimension" : "dim4", + "value" : "a" + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "postAggregations" : [ { + "type" : "expression", + "name" : "s0", + "expression" : "'a'", + "outputType" : "STRING" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByLimitPushdownExtraction@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByLimitPushdownExtraction@NullHandling=sql.iq new file mode 100644 index 00000000000..e6c589194f7 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByLimitPushdownExtraction@NullHandling=sql.iq @@ -0,0 +1,85 @@ +# testGroupByLimitPushdownExtraction@NullHandling=sql case-crc:006ffd2b +# quidem testcase reason: IMPROVED_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim4, substring(dim5, 1, 1), count(*) FROM druid.numfoo WHERE dim4 = 'a' GROUP BY 1,2 LIMIT 2; ++------+--------+--------+ +| dim4 | EXPR$1 | EXPR$2 | ++------+--------+--------+ +| a | a | 2 | +| a | b | 1 | ++------+--------+--------+ +(2 rows) + +!ok +LogicalProject(dim4=[CAST('a':VARCHAR):VARCHAR], EXPR$1=[$0], EXPR$2=[$1]) + LogicalSort(fetch=[2]) + LogicalAggregate(group=[{0}], EXPR$2=[COUNT()]) + LogicalProject(EXPR$1=[SUBSTRING($5, 1, 1)]) + LogicalFilter(condition=[=($4, 'a')]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(dim4=[CAST('a':VARCHAR):VARCHAR], EXPR$1=[$0], EXPR$2=[$1], druid=[logical]) + DruidSort(fetch=[2], druid=[logical]) + DruidAggregate(group=[{0}], EXPR$2=[COUNT()], druid=[logical]) + DruidProject(EXPR$1=[SUBSTRING($5, 1, 1)], druid=[logical]) + DruidFilter(condition=[=($4, 'a')]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "topN", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "dimension" : { + "type" : "extraction", + "dimension" : "dim5", + "outputName" : "_d0", + "outputType" : "STRING", + "extractionFn" : { + "type" : "substring", + "index" : 0, + "length" : 1 + } + }, + "metric" : { + "type" : "dimension", + "ordering" : { + "type" : "lexicographic" + } + }, + "threshold" : 2, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "equals", + "column" : "dim4", + "matchValueType" : "STRING", + "matchValue" : "a" + }, + "granularity" : { + "type" : "all" + }, + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "postAggregations" : [ { + "type" : "expression", + "name" : "s0", + "expression" : "'a'", + "outputType" : "STRING" + } ] +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupBySortPushDown.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupBySortPushDown.iq new file mode 100644 index 00000000000..ce70e1c2ba2 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupBySortPushDown.iq @@ -0,0 +1,76 @@ +# testGroupBySortPushDown case-crc:0f7a48bb +# quidem testcase reason: AGG_COL_EXCHANGE +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, dim1, SUM(cnt) FROM druid.foo GROUP BY dim2, dim1 ORDER BY dim1 LIMIT 4; ++------+------+--------+ +| dim2 | dim1 | EXPR$2 | ++------+------+--------+ +| a | | 1 | +| a | 1 | 1 | +| | 10.1 | 1 | +| | 2 | 1 | ++------+------+--------+ +(4 rows) + +!ok +LogicalProject(dim2=[$1], dim1=[$0], EXPR$2=[$2]) + LogicalSort(sort0=[$0], dir0=[ASC], fetch=[4]) + LogicalAggregate(group=[{1, 2}], EXPR$2=[SUM($4)]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim2=[$1], dim1=[$0], EXPR$2=[$2], druid=[logical]) + DruidSort(sort0=[$0], dir0=[ASC], fetch=[4], druid=[logical]) + DruidAggregate(group=[{1, 2}], EXPR$2=[SUM($4)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d1", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "longSum", + "name" : "a0", + "fieldName" : "cnt" + } ], + "limitSpec" : { + "type" : "default", + "columns" : [ { + "dimension" : "d0", + "direction" : "ascending", + "dimensionOrder" : { + "type" : "lexicographic" + } + } ], + "limit" : 4 + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=default.iq new file mode 100644 index 00000000000..bd5bb765ded --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=default.iq @@ -0,0 +1,147 @@ +# testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=default case-crc:d9fe7bd2 +# quidem testcase reason: IMPROVED_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, time_floor(gran, 'P1M') gran, sum(s) +FROM (SELECT time_floor(__time, 'P1D') AS gran, dim2, sum(m1) as s FROM druid.foo GROUP BY 1, 2 HAVING sum(m1) > 1) AS x +GROUP BY 1, 2 +ORDER BY dim2, gran desc; ++------+---------------------+--------+ +| dim2 | gran | EXPR$2 | ++------+---------------------+--------+ +| | 2001-01-01 00:00:00 | 6.0 | +| | 2000-01-01 00:00:00 | 5.0 | +| a | 2001-01-01 00:00:00 | 4.0 | +| abc | 2001-01-01 00:00:00 | 5.0 | ++------+---------------------+--------+ +(4 rows) + +!ok +LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[DESC]) + LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)]) + LogicalProject(dim2=[$1], gran=[TIME_FLOOR($0, 'P1M')], s=[$2]) + LogicalFilter(condition=[>($2, 1)]) + LogicalAggregate(group=[{0, 1}], s=[SUM($2)]) + LogicalProject(gran=[TIME_FLOOR($0, 'P1D')], dim2=[$2], m1=[$5]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[DESC], druid=[logical]) + DruidAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], druid=[logical]) + DruidProject(dim2=[$1], gran=[TIME_FLOOR($0, 'P1M')], s=[$2], druid=[logical]) + DruidFilter(condition=[>($2, 1)]) + DruidAggregate(group=[{0, 1}], s=[SUM($2)], druid=[logical]) + DruidProject(gran=[TIME_FLOOR($0, 'P1D')], dim2=[$2], m1=[$5], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "timestamp_floor(\"__time\",'P1D',null,'UTC')", + "outputType" : "LONG" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "LONG" + }, { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d1", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "doubleSum", + "name" : "a0", + "fieldName" : "m1" + } ], + "having" : { + "type" : "filter", + "filter" : { + "type" : "bound", + "dimension" : "a0", + "lower" : "1", + "lowerStrict" : true, + "ordering" : { + "type" : "numeric" + } + }, + "finalize" : true + }, + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "timestamp_floor(\"d0\",'P1M',null,'UTC')", + "outputType" : "LONG" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "d1", + "outputName" : "_d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d1", + "outputType" : "LONG" + } ], + "aggregations" : [ { + "type" : "doubleSum", + "name" : "_a0", + "fieldName" : "a0" + } ], + "limitSpec" : { + "type" : "default", + "columns" : [ { + "dimension" : "_d0", + "direction" : "ascending", + "dimensionOrder" : { + "type" : "lexicographic" + } + }, { + "dimension" : "_d1", + "direction" : "descending", + "dimensionOrder" : { + "type" : "numeric" + } + } ] + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=sql.iq new file mode 100644 index 00000000000..fb4b5cd8dfb --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=sql.iq @@ -0,0 +1,146 @@ +# testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim@NullHandling=sql case-crc:d9fe7bd2 +# quidem testcase reason: IMPROVED_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT dim2, time_floor(gran, 'P1M') gran, sum(s) +FROM (SELECT time_floor(__time, 'P1D') AS gran, dim2, sum(m1) as s FROM druid.foo GROUP BY 1, 2 HAVING sum(m1) > 1) AS x +GROUP BY 1, 2 +ORDER BY dim2, gran desc; ++------+---------------------+--------+ +| dim2 | gran | EXPR$2 | ++------+---------------------+--------+ +| | 2001-01-01 00:00:00 | 6.0 | +| | 2000-01-01 00:00:00 | 2.0 | +| | 2000-01-01 00:00:00 | 3.0 | +| a | 2001-01-01 00:00:00 | 4.0 | +| abc | 2001-01-01 00:00:00 | 5.0 | ++------+---------------------+--------+ +(5 rows) + +!ok +LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[DESC]) + LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)]) + LogicalProject(dim2=[$1], gran=[TIME_FLOOR($0, 'P1M')], s=[$2]) + LogicalFilter(condition=[>($2, 1)]) + LogicalAggregate(group=[{0, 1}], s=[SUM($2)]) + LogicalProject(gran=[TIME_FLOOR($0, 'P1D')], dim2=[$2], m1=[$5]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[DESC], druid=[logical]) + DruidAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], druid=[logical]) + DruidProject(dim2=[$1], gran=[TIME_FLOOR($0, 'P1M')], s=[$2], druid=[logical]) + DruidFilter(condition=[>($2, 1)]) + DruidAggregate(group=[{0, 1}], s=[SUM($2)], druid=[logical]) + DruidProject(gran=[TIME_FLOOR($0, 'P1D')], dim2=[$2], m1=[$5], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "timestamp_floor(\"__time\",'P1D',null,'UTC')", + "outputType" : "LONG" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "LONG" + }, { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d1", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "doubleSum", + "name" : "a0", + "fieldName" : "m1" + } ], + "having" : { + "type" : "filter", + "filter" : { + "type" : "range", + "column" : "a0", + "matchValueType" : "LONG", + "lower" : 1, + "lowerOpen" : true + }, + "finalize" : true + }, + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "timestamp_floor(\"d0\",'P1M',null,'UTC')", + "outputType" : "LONG" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "d1", + "outputName" : "_d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "v0", + "outputName" : "_d1", + "outputType" : "LONG" + } ], + "aggregations" : [ { + "type" : "doubleSum", + "name" : "_a0", + "fieldName" : "a0" + } ], + "limitSpec" : { + "type" : "default", + "columns" : [ { + "dimension" : "_d0", + "direction" : "ascending", + "dimensionOrder" : { + "type" : "lexicographic" + } + }, { + "dimension" : "_d1", + "direction" : "descending", + "dimensionOrder" : { + "type" : "numeric" + } + } ] + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByWithLiteralInSubqueryGrouping.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByWithLiteralInSubqueryGrouping.iq new file mode 100644 index 00000000000..85c1b392c49 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testGroupByWithLiteralInSubqueryGrouping.iq @@ -0,0 +1,110 @@ +# testGroupByWithLiteralInSubqueryGrouping case-crc:a63c5a2f +# quidem testcase reason: IMPROVED_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT + t1, t2 + FROM + ( SELECT + 'dummy' as t1, + CASE + WHEN + dim4 = 'b' + THEN dim4 + ELSE NULL + END AS t2 + FROM + numfoo + GROUP BY + dim4 + ) + GROUP BY + t1,t2 +; ++-------+----+ +| t1 | t2 | ++-------+----+ +| dummy | b | +| dummy | | ++-------+----+ +(2 rows) + +!ok +LogicalProject(t1=['dummy'], t2=[$0]) + LogicalAggregate(group=[{0}]) + LogicalProject(t2=[CASE(=($0, 'b'), $0, null:VARCHAR)]) + LogicalAggregate(group=[{4}]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidProject(t1=['dummy'], t2=[$0], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(t2=[CASE(=($0, 'b'), $0, null:VARCHAR)], druid=[logical]) + DruidAggregate(group=[{4}], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim4", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "case_searched((\"_d0\" == 'b'),\"_d0\",null)", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "postAggregations" : [ { + "type" : "expression", + "name" : "p0", + "expression" : "'dummy'", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=default.iq new file mode 100644 index 00000000000..e7322a876fc --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=default.iq @@ -0,0 +1,231 @@ +# testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=default case-crc:65809f91 +# quidem testcase reason: AGG_COL_EXCHANGE +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set useApproximateCountDistinct false +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*), COUNT(distinct dim1), COUNT(distinct cnt) FROM druid.foo GROUP BY dim2; ++------+--------+--------+--------+ +| dim2 | EXPR$1 | EXPR$2 | EXPR$3 | ++------+--------+--------+--------+ +| | 3 | 3 | 1 | +| a | 2 | 1 | 1 | +| abc | 1 | 1 | 1 | ++------+--------+--------+--------+ +(3 rows) + +!ok +LogicalProject(dim2=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5]) + LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner]) + LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner]) + LogicalAggregate(group=[{2}], EXPR$1=[COUNT()]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{1}], EXPR$2=[COUNT($0)]) + LogicalAggregate(group=[{1, 2}]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], EXPR$3=[COUNT($1)]) + LogicalAggregate(group=[{2, 4}]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim2=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5], druid=[logical]) + DruidJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner]) + DruidJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner]) + DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$2=[COUNT($0)], druid=[logical]) + DruidAggregate(group=[{1, 2}], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], EXPR$3=[COUNT($1)], druid=[logical]) + DruidAggregate(group=[{2, 4}], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d1", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "d1", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "d0", + "value" : null + } + }, + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "notdistinctfrom(\"d0\",\"j0._d0\")", + "joinType" : "INNER" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "cnt", + "outputName" : "d1", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "d0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "notdistinctfrom(\"d0\",\"_j0._d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.a0", "a0", "d0", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "LONG", "STRING", "LONG" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=sql.iq new file mode 100644 index 00000000000..098415f6b1b --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=sql.iq @@ -0,0 +1,242 @@ +# testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin@NullHandling=sql case-crc:65809f91 +# quidem testcase reason: AGG_COL_EXCHANGE +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set useApproximateCountDistinct false +!set outputformat mysql +!use druidtest:/// +SELECT dim2, COUNT(*), COUNT(distinct dim1), COUNT(distinct cnt) FROM druid.foo GROUP BY dim2; ++------+--------+--------+--------+ +| dim2 | EXPR$1 | EXPR$2 | EXPR$3 | ++------+--------+--------+--------+ +| | 1 | 1 | 1 | +| a | 2 | 2 | 1 | +| abc | 1 | 1 | 1 | +| | 2 | 2 | 1 | ++------+--------+--------+--------+ +(4 rows) + +!ok +LogicalProject(dim2=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5]) + LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner]) + LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner]) + LogicalAggregate(group=[{2}], EXPR$1=[COUNT()]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{1}], EXPR$2=[COUNT($0)]) + LogicalAggregate(group=[{1, 2}]) + LogicalTableScan(table=[[druid, foo]]) + LogicalAggregate(group=[{0}], EXPR$3=[COUNT($1)]) + LogicalAggregate(group=[{2, 4}]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(dim2=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5], druid=[logical]) + DruidJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner]) + DruidJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner]) + DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{1}], EXPR$2=[COUNT($0)], druid=[logical]) + DruidAggregate(group=[{1, 2}], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + DruidAggregate(group=[{0}], EXPR$3=[COUNT($1)], druid=[logical]) + DruidAggregate(group=[{2, 4}], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "scan", + "dataSource" : { + "type" : "join", + "left" : { + "type" : "join", + "left" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim1", + "outputName" : "d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d1", + "outputType" : "STRING" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "d1", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "null", + "column" : "d0" + } + }, + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "j0.", + "condition" : "notdistinctfrom(\"d0\",\"j0._d0\")", + "joinType" : "INNER" + }, + "right" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim2", + "outputName" : "d0", + "outputType" : "STRING" + }, { + "type" : "default", + "dimension" : "cnt", + "outputName" : "d1", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "d0", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "null", + "column" : "d1" + } + }, + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "rightPrefix" : "_j0.", + "condition" : "notdistinctfrom(\"d0\",\"_j0._d0\")", + "joinType" : "INNER" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "columns" : [ "_j0.a0", "a0", "d0", "j0.a0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "LONG", "STRING", "LONG" ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=default.iq new file mode 100644 index 00000000000..dd7cb19cb20 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=default.iq @@ -0,0 +1,152 @@ +# testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=default case-crc:5a66a3be +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set useApproximateCountDistinct false +!set useGroupingSetForExactDistinct true +!set outputformat mysql +!use druidtest:///?numMergeBuffers=3 +SELECT +(SUM(CASE WHEN (TIMESTAMP '2000-01-04 17:00:00'<=__time AND __time= 947005200000) && (\"__time\" < 1641402000000)),\"dim1\",null)", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "bound", + "dimension" : "__time", + "lower" : "947005200000", + "upper" : "1641402000000", + "upperStrict" : true, + "ordering" : { + "type" : "numeric" + } + }, + "name" : "a0" + }, { + "type" : "grouping", + "name" : "a1", + "groupings" : [ "v0" ] + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + }, + "subtotalsSpec" : [ [ "d0" ], [ ] ] + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "longMin", + "name" : "_a0", + "fieldName" : "a0" + }, + "filter" : { + "type" : "selector", + "dimension" : "a1", + "value" : "1" + }, + "name" : "_a0" + }, { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "_a1" + }, + "filter" : { + "type" : "and", + "fields" : [ { + "type" : "not", + "field" : { + "type" : "selector", + "dimension" : "d0", + "value" : null + } + }, { + "type" : "selector", + "dimension" : "a1", + "value" : "0" + } ] + }, + "name" : "_a1" + } ], + "postAggregations" : [ { + "type" : "expression", + "name" : "p0", + "expression" : "(CAST(\"_a0\", 'DOUBLE') / \"_a1\")", + "outputType" : "DOUBLE" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=sql.iq new file mode 100644 index 00000000000..f110fbad512 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=sql.iq @@ -0,0 +1,151 @@ +# testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=sql case-crc:5a66a3be +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set useApproximateCountDistinct false +!set useGroupingSetForExactDistinct true +!set outputformat mysql +!use druidtest:///?numMergeBuffers=3 +SELECT +(SUM(CASE WHEN (TIMESTAMP '2000-01-04 17:00:00'<=__time AND __time= 947005200000) && (\"__time\" < 1641402000000)),\"dim1\",null)", + "outputType" : "STRING" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "range", + "column" : "__time", + "matchValueType" : "LONG", + "lower" : 947005200000, + "upper" : 1641402000000, + "upperOpen" : true + }, + "name" : "a0" + }, { + "type" : "grouping", + "name" : "a1", + "groupings" : [ "v0" ] + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + }, + "subtotalsSpec" : [ [ "d0" ], [ ] ] + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "longMin", + "name" : "_a0", + "fieldName" : "a0" + }, + "filter" : { + "type" : "equals", + "column" : "a1", + "matchValueType" : "LONG", + "matchValue" : 1 + }, + "name" : "_a0" + }, { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "_a1" + }, + "filter" : { + "type" : "and", + "fields" : [ { + "type" : "not", + "field" : { + "type" : "null", + "column" : "d0" + } + }, { + "type" : "equals", + "column" : "a1", + "matchValueType" : "LONG", + "matchValue" : 0 + } ] + }, + "name" : "_a1" + } ], + "postAggregations" : [ { + "type" : "expression", + "name" : "p0", + "expression" : "(CAST(\"_a0\", 'DOUBLE') / \"_a1\")", + "outputType" : "DOUBLE" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testRepeatedIdenticalVirtualExpressionGrouping.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testRepeatedIdenticalVirtualExpressionGrouping.iq new file mode 100644 index 00000000000..f87b98802c6 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testRepeatedIdenticalVirtualExpressionGrouping.iq @@ -0,0 +1,71 @@ +# testRepeatedIdenticalVirtualExpressionGrouping case-crc:c6ee44b6 +# quidem testcase reason: IMPROVED_PLAN +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT + CASE dim1 WHEN NULL THEN FALSE ELSE TRUE END AS col_a, + CASE dim2 WHEN NULL THEN FALSE ELSE TRUE END AS col_b +FROM foo +GROUP BY 1, 2; ++-------+-------+ +| col_a | col_b | ++-------+-------+ +| true | true | ++-------+-------+ +(1 row) + +!ok +LogicalProject(col_a=[$0], col_b=[true]) + LogicalAggregate(group=[{0}]) + LogicalProject(col_a=[true]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(col_a=[$0], col_b=[true], druid=[logical]) + DruidAggregate(group=[{0}], druid=[logical]) + DruidProject(col_a=[true], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "virtualColumns" : [ { + "type" : "expression", + "name" : "v0", + "expression" : "1", + "outputType" : "LONG" + } ], + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "v0", + "outputName" : "d0", + "outputType" : "LONG" + } ], + "postAggregations" : [ { + "type" : "expression", + "name" : "p0", + "expression" : "1", + "outputType" : "LONG" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testSubqueryTypeMismatchWithLiterals@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testSubqueryTypeMismatchWithLiterals@NullHandling=default.iq new file mode 100644 index 00000000000..e84db59af53 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testSubqueryTypeMismatchWithLiterals@NullHandling=default.iq @@ -0,0 +1,110 @@ +# testSubqueryTypeMismatchWithLiterals@NullHandling=default case-crc:e7079756 +# quidem testcase reason: AGGREGATE_REMOVE_NOT_FIRED +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT + dim1, + SUM(CASE WHEN sum_l1 = 0 THEN 1 ELSE 0 END) AS outer_l1 +from ( + select + dim1, + SUM(l1) as sum_l1 + from numfoo + group by dim1 +) +group by 1; ++------+----------+ +| dim1 | outer_l1 | ++------+----------+ +| | 0 | +| 1 | 1 | +| 10.1 | 0 | +| 2 | 1 | +| abc | 1 | +| def | 1 | ++------+----------+ +(6 rows) + +!ok +LogicalAggregate(group=[{0}], outer_l1=[COUNT() FILTER $1]) + LogicalProject(dim1=[$0], $f2=[=($1, 0)]) + LogicalAggregate(group=[{1}], sum_l1=[SUM($11)]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidAggregate(group=[{0}], outer_l1=[COUNT() FILTER $1], druid=[logical]) + DruidProject(dim1=[$0], $f2=[=($1, 0)], druid=[logical]) + DruidAggregate(group=[{1}], sum_l1=[SUM($11)], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim1", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "longSum", + "name" : "a0", + "fieldName" : "l1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "_d0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "_a0" + }, + "filter" : { + "type" : "selector", + "dimension" : "a0", + "value" : "0" + }, + "name" : "_a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testSubqueryTypeMismatchWithLiterals@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testSubqueryTypeMismatchWithLiterals@NullHandling=sql.iq new file mode 100644 index 00000000000..b464b19c371 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testSubqueryTypeMismatchWithLiterals@NullHandling=sql.iq @@ -0,0 +1,111 @@ +# testSubqueryTypeMismatchWithLiterals@NullHandling=sql case-crc:e7079756 +# quidem testcase reason: AGGREGATE_REMOVE_NOT_FIRED +!set debug true +!set defaultTimeout 300000 +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +SELECT + dim1, + SUM(CASE WHEN sum_l1 = 0 THEN 1 ELSE 0 END) AS outer_l1 +from ( + select + dim1, + SUM(l1) as sum_l1 + from numfoo + group by dim1 +) +group by 1; ++------+----------+ +| dim1 | outer_l1 | ++------+----------+ +| | 0 | +| 1 | 0 | +| 10.1 | 0 | +| 2 | 1 | +| abc | 0 | +| def | 0 | ++------+----------+ +(6 rows) + +!ok +LogicalAggregate(group=[{0}], outer_l1=[COUNT() FILTER $1]) + LogicalProject(dim1=[$0], $f2=[IS TRUE(=($1, 0))]) + LogicalAggregate(group=[{1}], sum_l1=[SUM($11)]) + LogicalTableScan(table=[[druid, numfoo]]) + +!logicalPlan +DruidAggregate(group=[{0}], outer_l1=[COUNT() FILTER $1], druid=[logical]) + DruidProject(dim1=[$0], $f2=[IS TRUE(=($1, 0))], druid=[logical]) + DruidAggregate(group=[{1}], sum_l1=[SUM($11)], druid=[logical]) + DruidTableScan(table=[[druid, numfoo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "numfoo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "dim1", + "outputName" : "_d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "longSum", + "name" : "a0", + "fieldName" : "l1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "_d0", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "_a0" + }, + "filter" : { + "type" : "equals", + "column" : "a0", + "matchValueType" : "LONG", + "matchValue" : 0 + }, + "name" : "_a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testWindowingWithScanAndSort@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testWindowingWithScanAndSort@NullHandling=default.iq new file mode 100644 index 00000000000..5368d23981f --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testWindowingWithScanAndSort@NullHandling=default.iq @@ -0,0 +1,191 @@ +# testWindowingWithScanAndSort@NullHandling=default case-crc:bb1d6e53 +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableWindowing true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with t AS ( +SELECT + RANK() OVER (PARTITION BY m2 ORDER BY m2 ASC) + AS ranking, + COUNT(m1) as trend_score +FROM foo +GROUP BY m2,m1 LIMIT 10 +) +select ranking, trend_score from t ORDER BY trend_score; ++---------+-------------+ +| ranking | trend_score | ++---------+-------------+ +| 1 | 1 | +| 1 | 1 | +| 1 | 1 | +| 1 | 1 | +| 1 | 1 | +| 1 | 1 | ++---------+-------------+ +(6 rows) + +!ok +LogicalProject(ranking=[$2], trend_score=[$1]) + LogicalSort(sort0=[$1], dir0=[ASC]) + LogicalSort(fetch=[10]) + LogicalWindow(window#0=[window(partition {0} order by [0] aggs [RANK()])]) + LogicalProject(m2=[$1], trend_score=[$2]) + LogicalAggregate(group=[{5, 6}], trend_score=[COUNT()]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(ranking=[$2], trend_score=[$1], druid=[logical]) + DruidSort(sort0=[$1], dir0=[ASC], druid=[logical]) + DruidSort(fetch=[10], druid=[logical]) + DruidWindow(window#0=[window(partition {0} order by [0] aggs [RANK()])]) + DruidProject(m2=[$1], trend_score=[$2], druid=[logical]) + DruidAggregate(group=[{5, 6}], trend_score=[COUNT()], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "windowOperator", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "windowOperator", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "m1", + "outputName" : "d0", + "outputType" : "FLOAT" + }, { + "type" : "default", + "dimension" : "m2", + "outputName" : "d1", + "outputType" : "DOUBLE" + } ], + "aggregations" : [ { + "type" : "count", + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "LegacySegmentSpec", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "outputSignature" : [ { + "name" : "d1", + "type" : "DOUBLE" + }, { + "name" : "a0", + "type" : "LONG" + }, { + "name" : "w0", + "type" : "LONG" + } ], + "operatorDefinition" : [ { + "type" : "naiveSort", + "columns" : [ { + "column" : "d1", + "direction" : "ASC" + } ] + }, { + "type" : "naivePartition", + "partitionColumns" : [ "d1" ] + }, { + "type" : "window", + "processor" : { + "type" : "rank", + "group" : [ "d1" ], + "outputColumn" : "w0", + "asPercent" : false + } + } ], + "leafOperators" : [ ], + "granularity" : { + "type" : "all" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "limit" : 10, + "columns" : [ "a0", "d1", "w0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "DOUBLE", "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "intervals" : { + "type" : "LegacySegmentSpec", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "outputSignature" : [ { + "name" : "w0", + "type" : "LONG" + }, { + "name" : "a0", + "type" : "LONG" + } ], + "operatorDefinition" : [ { + "type" : "naiveSort", + "columns" : [ { + "column" : "a0", + "direction" : "ASC" + } ] + }, { + "type" : "scan", + "timeRange" : null, + "filter" : null, + "offsetLimit" : null, + "projectedColumns" : [ "w0", "a0" ], + "virtualColumns" : null, + "ordering" : null + } ], + "leafOperators" : [ { + "type" : "scan", + "timeRange" : null, + "filter" : null, + "offsetLimit" : { + "offset" : 0, + "limit" : 9223372036854775807 + }, + "projectedColumns" : [ "a0", "w0" ], + "virtualColumns" : null, + "ordering" : null + } ], + "granularity" : { + "type" : "all" + } +} +!nativePlan diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testWindowingWithScanAndSort@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testWindowingWithScanAndSort@NullHandling=sql.iq new file mode 100644 index 00000000000..86e22e97353 --- /dev/null +++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteQueryTest/testWindowingWithScanAndSort@NullHandling=sql.iq @@ -0,0 +1,202 @@ +# testWindowingWithScanAndSort@NullHandling=sql case-crc:bb1d6e53 +# quidem testcase reason: SLIGHTLY_WORSE_PLAN +!set debug true +!set defaultTimeout 300000 +!set enableWindowing true +!set maxScatterGatherBytes 9223372036854775807 +!set plannerStrategy DECOUPLED +!set sqlCurrentTimestamp 2000-01-01T00:00:00Z +!set sqlQueryId dummy +!set outputformat mysql +!use druidtest:/// +with t AS ( +SELECT + RANK() OVER (PARTITION BY m2 ORDER BY m2 ASC) + AS ranking, + COUNT(m1) as trend_score +FROM foo +GROUP BY m2,m1 LIMIT 10 +) +select ranking, trend_score from t ORDER BY trend_score; ++---------+-------------+ +| ranking | trend_score | ++---------+-------------+ +| 1 | 1 | +| 1 | 1 | +| 1 | 1 | +| 1 | 1 | +| 1 | 1 | +| 1 | 1 | ++---------+-------------+ +(6 rows) + +!ok +LogicalProject(ranking=[$2], trend_score=[$1]) + LogicalSort(sort0=[$1], dir0=[ASC]) + LogicalSort(fetch=[10]) + LogicalWindow(window#0=[window(partition {0} order by [0] aggs [RANK()])]) + LogicalProject(m2=[$1], trend_score=[$2]) + LogicalAggregate(group=[{5, 6}], trend_score=[COUNT($5)]) + LogicalTableScan(table=[[druid, foo]]) + +!logicalPlan +DruidProject(ranking=[$2], trend_score=[$1], druid=[logical]) + DruidSort(sort0=[$1], dir0=[ASC], druid=[logical]) + DruidSort(fetch=[10], druid=[logical]) + DruidWindow(window#0=[window(partition {0} order by [0] aggs [RANK()])]) + DruidProject(m2=[$1], trend_score=[$2], druid=[logical]) + DruidAggregate(group=[{5, 6}], trend_score=[COUNT($5)], druid=[logical]) + DruidTableScan(table=[[druid, foo]], druid=[logical]) + +!druidPlan +{ + "queryType" : "windowOperator", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "scan", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "windowOperator", + "dataSource" : { + "type" : "query", + "query" : { + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "foo" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "m1", + "outputName" : "d0", + "outputType" : "FLOAT" + }, { + "type" : "default", + "dimension" : "m2", + "outputName" : "d1", + "outputType" : "DOUBLE" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "not", + "field" : { + "type" : "null", + "column" : "m1" + } + }, + "name" : "a0" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } + } + }, + "intervals" : { + "type" : "LegacySegmentSpec", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "outputSignature" : [ { + "name" : "d1", + "type" : "DOUBLE" + }, { + "name" : "a0", + "type" : "LONG" + }, { + "name" : "w0", + "type" : "LONG" + } ], + "operatorDefinition" : [ { + "type" : "naiveSort", + "columns" : [ { + "column" : "d1", + "direction" : "ASC" + } ] + }, { + "type" : "naivePartition", + "partitionColumns" : [ "d1" ] + }, { + "type" : "window", + "processor" : { + "type" : "rank", + "group" : [ "d1" ], + "outputColumn" : "w0", + "asPercent" : false + } + } ], + "leafOperators" : [ ], + "granularity" : { + "type" : "all" + } + } + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "resultFormat" : "compactedList", + "limit" : 10, + "columns" : [ "a0", "d1", "w0" ], + "legacy" : false, + "columnTypes" : [ "LONG", "DOUBLE", "LONG" ], + "granularity" : { + "type" : "all" + } + } + }, + "intervals" : { + "type" : "LegacySegmentSpec", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "outputSignature" : [ { + "name" : "w0", + "type" : "LONG" + }, { + "name" : "a0", + "type" : "LONG" + } ], + "operatorDefinition" : [ { + "type" : "naiveSort", + "columns" : [ { + "column" : "a0", + "direction" : "ASC" + } ] + }, { + "type" : "scan", + "timeRange" : null, + "filter" : null, + "offsetLimit" : null, + "projectedColumns" : [ "w0", "a0" ], + "virtualColumns" : null, + "ordering" : null + } ], + "leafOperators" : [ { + "type" : "scan", + "timeRange" : null, + "filter" : null, + "offsetLimit" : { + "offset" : 0, + "limit" : 9223372036854775807 + }, + "projectedColumns" : [ "a0", "w0" ], + "virtualColumns" : null, + "ordering" : null + } ], + "granularity" : { + "type" : "all" + } +} +!nativePlan