You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by kg...@apache.org on 2024/09/25 14:00:33 UTC
(druid) branch master updated: Decoupled planning: improve join predicate handling (#17105)
This is an automated email from the ASF dual-hosted git repository.
kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 6f7e8ca74a7 Decoupled planning: improve join predicate handling (#17105)
6f7e8ca74a7 is described below
commit 6f7e8ca74a72ae730436f4ff9def70ea4f07e486
Author: Zoltan Haindrich <ki...@rxd.hu>
AuthorDate: Wed Sep 25 16:00:25 2024 +0200
Decoupled planning: improve join predicate handling (#17105)
* enforces to only allow supported predicates in join conditions
* fixed a recursive query building issue by caching the `source` in `DruidQueryGenerator`
* moved `DruidAggregateRemoveRedundancyRule.instance` higher up; as if `CoreRules.AGGREGATE_EXPAND_DISTINCT_AGGREGATES` runs earlier the resulting `GROUPING` might become invalid
---
.../sql/calcite/planner/CalciteRulesManager.java | 11 +-
.../planner/querygen/DruidQueryGenerator.java | 11 +-
.../sql/calcite/rule/logical/DruidJoinRule.java | 11 +
.../druid/sql/calcite/CalciteJoinQueryTest.java | 59 +--
.../apache/druid/sql/calcite/CalciteQueryTest.java | 43 ++-
.../druid/sql/calcite/DecoupledTestConfig.java | 20 +-
.../apache/druid/sql/calcite/NotYetSupported.java | 9 +-
...TableLookupTableMismatchedTypes@all_disabled.iq | 151 ++++++++
...nTableLookupTableMismatchedTypes@all_enabled.iq | 151 ++++++++
...aJoinTableLookupTableMismatchedTypes@default.iq | 148 ++++++++
...matchedTypes@filter-on-value-column_disabled.iq | 151 ++++++++
...ableMismatchedTypes@filter-rewrites-disabled.iq | 151 ++++++++
...leLookupTableMismatchedTypes@filter-rewrites.iq | 151 ++++++++
...bleLookupTableMismatchedTypes@join-to-filter.iq | 151 ++++++++
...inOperator@all_disabled@NullHandling=default.iq | 101 ++++++
...ngJoinOperator@all_disabled@NullHandling=sql.iq | 102 ++++++
...oinOperator@all_enabled@NullHandling=default.iq | 101 ++++++
...ingJoinOperator@all_enabled@NullHandling=sql.iq | 102 ++++++
...ingJoinOperator@default@NullHandling=default.iq | 98 +++++
...upUsingJoinOperator@default@NullHandling=sql.iq | 99 +++++
...n-value-column_disabled@NullHandling=default.iq | 101 ++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 102 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 101 ++++++
...or@filter-rewrites-disabled@NullHandling=sql.iq | 102 ++++++
...perator@filter-rewrites@NullHandling=default.iq | 101 ++++++
...oinOperator@filter-rewrites@NullHandling=sql.iq | 102 ++++++
...Operator@join-to-filter@NullHandling=default.iq | 101 ++++++
...JoinOperator@join-to-filter@NullHandling=sql.iq | 102 ++++++
...rBackwards@all_disabled@NullHandling=default.iq | 121 +++++++
...ratorBackwards@all_disabled@NullHandling=sql.iq | 122 +++++++
...orBackwards@all_enabled@NullHandling=default.iq | 121 +++++++
...eratorBackwards@all_enabled@NullHandling=sql.iq | 122 +++++++
...eratorBackwards@default@NullHandling=default.iq | 118 ++++++
...inOperatorBackwards@default@NullHandling=sql.iq | 119 ++++++
...n-value-column_disabled@NullHandling=default.iq | 121 +++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 122 +++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 121 +++++++
...ds@filter-rewrites-disabled@NullHandling=sql.iq | 122 +++++++
...ckwards@filter-rewrites@NullHandling=default.iq | 121 +++++++
...orBackwards@filter-rewrites@NullHandling=sql.iq | 122 +++++++
...ackwards@join-to-filter@NullHandling=default.iq | 121 +++++++
...torBackwards@join-to-filter@NullHandling=sql.iq | 122 +++++++
...hNotFilter@all_disabled@NullHandling=default.iq | 104 ++++++
...rWithNotFilter@all_disabled@NullHandling=sql.iq | 105 ++++++
...thNotFilter@all_enabled@NullHandling=default.iq | 104 ++++++
...orWithNotFilter@all_enabled@NullHandling=sql.iq | 105 ++++++
...orWithNotFilter@default@NullHandling=default.iq | 101 ++++++
...eratorWithNotFilter@default@NullHandling=sql.iq | 102 ++++++
...n-value-column_disabled@NullHandling=default.iq | 104 ++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 105 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 104 ++++++
...er@filter-rewrites-disabled@NullHandling=sql.iq | 105 ++++++
...tFilter@filter-rewrites@NullHandling=default.iq | 104 ++++++
...thNotFilter@filter-rewrites@NullHandling=sql.iq | 105 ++++++
...otFilter@join-to-filter@NullHandling=default.iq | 104 ++++++
...ithNotFilter@join-to-filter@NullHandling=sql.iq | 105 ++++++
...hesNothing@all_disabled@NullHandling=default.iq | 100 +++++
...MatchesNothing@all_disabled@NullHandling=sql.iq | 101 ++++++
...chesNothing@all_enabled@NullHandling=default.iq | 100 +++++
...nMatchesNothing@all_enabled@NullHandling=sql.iq | 101 ++++++
...nMatchesNothing@default@NullHandling=default.iq | 97 +++++
...hdownMatchesNothing@default@NullHandling=sql.iq | 98 +++++
...n-value-column_disabled@NullHandling=default.iq | 100 +++++
...er-on-value-column_disabled@NullHandling=sql.iq | 101 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 100 +++++
...ng@filter-rewrites-disabled@NullHandling=sql.iq | 101 ++++++
...Nothing@filter-rewrites@NullHandling=default.iq | 100 +++++
...chesNothing@filter-rewrites@NullHandling=sql.iq | 101 ++++++
...sNothing@join-to-filter@NullHandling=default.iq | 100 +++++
...tchesNothing@join-to-filter@NullHandling=sql.iq | 101 ++++++
...torFilter@all_disabled@NullHandling=default.iq} | 40 +-
...electorFilter@all_disabled@NullHandling=sql.iq} | 41 ++-
...ctorFilter@all_enabled@NullHandling=default.iq} | 40 +-
...SelectorFilter@all_enabled@NullHandling=sql.iq} | 41 ++-
...SelectorFilter@default@NullHandling=default.iq} | 40 +-
...WithSelectorFilter@default@NullHandling=sql.iq} | 41 ++-
...-value-column_disabled@NullHandling=default.iq} | 40 +-
...r-on-value-column_disabled@NullHandling=sql.iq} | 41 ++-
...lter-rewrites-disabled@NullHandling=default.iq} | 40 +-
...r@filter-rewrites-disabled@NullHandling=sql.iq} | 41 ++-
...Filter@filter-rewrites@NullHandling=default.iq} | 40 +-
...ctorFilter@filter-rewrites@NullHandling=sql.iq} | 41 ++-
...rFilter@join-to-filter@NullHandling=default.iq} | 40 +-
...ectorFilter@join-to-filter@NullHandling=sql.iq} | 41 ++-
...OuterLimit@all_disabled@NullHandling=default.iq | 115 ++++++
...WithOuterLimit@all_disabled@NullHandling=sql.iq | 116 ++++++
...hOuterLimit@all_enabled@NullHandling=default.iq | 115 ++++++
...rWithOuterLimit@all_enabled@NullHandling=sql.iq | 116 ++++++
...rWithOuterLimit@default@NullHandling=default.iq | 112 ++++++
...ilterWithOuterLimit@default@NullHandling=sql.iq | 113 ++++++
...n-value-column_disabled@NullHandling=default.iq | 115 ++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 116 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 115 ++++++
...it@filter-rewrites-disabled@NullHandling=sql.iq | 116 ++++++
...erLimit@filter-rewrites@NullHandling=default.iq | 115 ++++++
...hOuterLimit@filter-rewrites@NullHandling=sql.iq | 116 ++++++
...terLimit@join-to-filter@NullHandling=default.iq | 115 ++++++
...thOuterLimit@join-to-filter@NullHandling=sql.iq | 116 ++++++
...AllColumns@all_disabled@NullHandling=default.iq | 113 ++++++
...WithAllColumns@all_disabled@NullHandling=sql.iq | 114 ++++++
...hAllColumns@all_enabled@NullHandling=default.iq | 113 ++++++
...tWithAllColumns@all_enabled@NullHandling=sql.iq | 114 ++++++
...tWithAllColumns@default@NullHandling=default.iq | 110 ++++++
...LimitWithAllColumns@default@NullHandling=sql.iq | 111 ++++++
...n-value-column_disabled@NullHandling=default.iq | 113 ++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 114 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 113 ++++++
...ns@filter-rewrites-disabled@NullHandling=sql.iq | 114 ++++++
...Columns@filter-rewrites@NullHandling=default.iq | 113 ++++++
...hAllColumns@filter-rewrites@NullHandling=sql.iq | 114 ++++++
...lColumns@join-to-filter@NullHandling=default.iq | 113 ++++++
...thAllColumns@join-to-filter@NullHandling=sql.iq | 114 ++++++
...thoutLimit@all_disabled@NullHandling=default.iq | 111 ++++++
...erWithoutLimit@all_disabled@NullHandling=sql.iq | 112 ++++++
...ithoutLimit@all_enabled@NullHandling=default.iq | 111 ++++++
...terWithoutLimit@all_enabled@NullHandling=sql.iq | 112 ++++++
...terWithoutLimit@default@NullHandling=default.iq | 108 ++++++
...hFilterWithoutLimit@default@NullHandling=sql.iq | 109 ++++++
...n-value-column_disabled@NullHandling=default.iq | 111 ++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 112 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 111 ++++++
...it@filter-rewrites-disabled@NullHandling=sql.iq | 112 ++++++
...utLimit@filter-rewrites@NullHandling=default.iq | 111 ++++++
...ithoutLimit@filter-rewrites@NullHandling=sql.iq | 112 ++++++
...outLimit@join-to-filter@NullHandling=default.iq | 111 ++++++
...WithoutLimit@join-to-filter@NullHandling=sql.iq | 112 ++++++
...AllColumns@all_disabled@NullHandling=default.iq | 109 ++++++
...WithAllColumns@all_disabled@NullHandling=sql.iq | 110 ++++++
...hAllColumns@all_enabled@NullHandling=default.iq | 109 ++++++
...tWithAllColumns@all_enabled@NullHandling=sql.iq | 110 ++++++
...tWithAllColumns@default@NullHandling=default.iq | 106 ++++++
...LimitWithAllColumns@default@NullHandling=sql.iq | 107 ++++++
...n-value-column_disabled@NullHandling=default.iq | 109 ++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 110 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 109 ++++++
...ns@filter-rewrites-disabled@NullHandling=sql.iq | 110 ++++++
...Columns@filter-rewrites@NullHandling=default.iq | 109 ++++++
...hAllColumns@filter-rewrites@NullHandling=sql.iq | 110 ++++++
...lColumns@join-to-filter@NullHandling=default.iq | 109 ++++++
...thAllColumns@join-to-filter@NullHandling=sql.iq | 110 ++++++
...ptyResults@all_disabled@NullHandling=default.iq | 275 ++++++++++++++
...rsEmptyResults@all_disabled@NullHandling=sql.iq | 305 ++++++++++++++++
...mptyResults@all_enabled@NullHandling=default.iq | 275 ++++++++++++++
...ersEmptyResults@all_enabled@NullHandling=sql.iq | 305 ++++++++++++++++
...ersEmptyResults@default@NullHandling=default.iq | 272 ++++++++++++++
...FiltersEmptyResults@default@NullHandling=sql.iq | 302 ++++++++++++++++
...n-value-column_disabled@NullHandling=default.iq | 275 ++++++++++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 305 ++++++++++++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 275 ++++++++++++++
...ts@filter-rewrites-disabled@NullHandling=sql.iq | 305 ++++++++++++++++
...Results@filter-rewrites@NullHandling=default.iq | 275 ++++++++++++++
...mptyResults@filter-rewrites@NullHandling=sql.iq | 305 ++++++++++++++++
...yResults@join-to-filter@NullHandling=default.iq | 275 ++++++++++++++
...EmptyResults@join-to-filter@NullHandling=sql.iq | 305 ++++++++++++++++
...ptyResults@all_disabled@NullHandling=default.iq | 276 ++++++++++++++
...onEmptyResults@all_disabled@NullHandling=sql.iq | 306 ++++++++++++++++
...mptyResults@all_enabled@NullHandling=default.iq | 276 ++++++++++++++
...NonEmptyResults@all_enabled@NullHandling=sql.iq | 306 ++++++++++++++++
...NonEmptyResults@default@NullHandling=default.iq | 273 ++++++++++++++
...tersNonEmptyResults@default@NullHandling=sql.iq | 303 ++++++++++++++++
...n-value-column_disabled@NullHandling=default.iq | 276 ++++++++++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 306 ++++++++++++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 276 ++++++++++++++
...ts@filter-rewrites-disabled@NullHandling=sql.iq | 306 ++++++++++++++++
...Results@filter-rewrites@NullHandling=default.iq | 276 ++++++++++++++
...mptyResults@filter-rewrites@NullHandling=sql.iq | 306 ++++++++++++++++
...yResults@join-to-filter@NullHandling=default.iq | 276 ++++++++++++++
...EmptyResults@join-to-filter@NullHandling=sql.iq | 306 ++++++++++++++++
...NullFilter@all_disabled@NullHandling=default.iq | 89 +++++
...thIsNullFilter@all_disabled@NullHandling=sql.iq | 88 +++++
...sNullFilter@all_enabled@NullHandling=default.iq | 89 +++++
...ithIsNullFilter@all_enabled@NullHandling=sql.iq | 88 +++++
...ithIsNullFilter@default@NullHandling=default.iq | 86 +++++
...oinWithIsNullFilter@default@NullHandling=sql.iq | 85 +++++
...n-value-column_disabled@NullHandling=default.iq | 89 +++++
...er-on-value-column_disabled@NullHandling=sql.iq | 88 +++++
...ilter-rewrites-disabled@NullHandling=default.iq | 89 +++++
...er@filter-rewrites-disabled@NullHandling=sql.iq | 88 +++++
...lFilter@filter-rewrites@NullHandling=default.iq | 89 +++++
...sNullFilter@filter-rewrites@NullHandling=sql.iq | 88 +++++
...llFilter@join-to-filter@NullHandling=default.iq | 89 +++++
...IsNullFilter@join-to-filter@NullHandling=sql.iq | 88 +++++
...esOnLookup@all_disabled@NullHandling=default.iq | 118 ++++++
...TablesOnLookup@all_disabled@NullHandling=sql.iq | 119 ++++++
...lesOnLookup@all_enabled@NullHandling=default.iq | 118 ++++++
...nTablesOnLookup@all_enabled@NullHandling=sql.iq | 119 ++++++
...nTablesOnLookup@default@NullHandling=default.iq | 115 ++++++
...UnionTablesOnLookup@default@NullHandling=sql.iq | 116 ++++++
...n-value-column_disabled@NullHandling=default.iq | 118 ++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 119 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 118 ++++++
...up@filter-rewrites-disabled@NullHandling=sql.iq | 119 ++++++
...nLookup@filter-rewrites@NullHandling=default.iq | 118 ++++++
...lesOnLookup@filter-rewrites@NullHandling=sql.iq | 119 ++++++
...OnLookup@join-to-filter@NullHandling=default.iq | 118 ++++++
...blesOnLookup@join-to-filter@NullHandling=sql.iq | 119 ++++++
...torFilter@all_disabled@NullHandling=default.iq} | 33 +-
...electorFilter@all_disabled@NullHandling=sql.iq} | 34 +-
...ctorFilter@all_enabled@NullHandling=default.iq} | 33 +-
...SelectorFilter@all_enabled@NullHandling=sql.iq} | 34 +-
...SelectorFilter@default@NullHandling=default.iq} | 33 +-
...WithSelectorFilter@default@NullHandling=sql.iq} | 34 +-
...-value-column_disabled@NullHandling=default.iq} | 33 +-
...r-on-value-column_disabled@NullHandling=sql.iq} | 34 +-
...lter-rewrites-disabled@NullHandling=default.iq} | 33 +-
...r@filter-rewrites-disabled@NullHandling=sql.iq} | 34 +-
...Filter@filter-rewrites@NullHandling=default.iq} | 33 +-
...ctorFilter@filter-rewrites@NullHandling=sql.iq} | 34 +-
...rFilter@join-to-filter@NullHandling=default.iq} | 33 +-
...ectorFilter@join-to-filter@NullHandling=sql.iq} | 34 +-
...ManyLookup@all_disabled@NullHandling=default.iq | 400 ++++++++++++++++++++
...ManyManyLookup@all_disabled@NullHandling=sql.iq | 401 +++++++++++++++++++++
...yManyLookup@all_enabled@NullHandling=default.iq | 400 ++++++++++++++++++++
...nManyManyLookup@all_enabled@NullHandling=sql.iq | 401 +++++++++++++++++++++
...nManyManyLookup@default@NullHandling=default.iq | 397 ++++++++++++++++++++
...oinOnManyManyLookup@default@NullHandling=sql.iq | 398 ++++++++++++++++++++
...n-value-column_disabled@NullHandling=default.iq | 400 ++++++++++++++++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 401 +++++++++++++++++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 400 ++++++++++++++++++++
...up@filter-rewrites-disabled@NullHandling=sql.iq | 401 +++++++++++++++++++++
...yLookup@filter-rewrites@NullHandling=default.iq | 400 ++++++++++++++++++++
...yManyLookup@filter-rewrites@NullHandling=sql.iq | 401 +++++++++++++++++++++
...nyLookup@join-to-filter@NullHandling=default.iq | 400 ++++++++++++++++++++
...nyManyLookup@join-to-filter@NullHandling=sql.iq | 401 +++++++++++++++++++++
...WithFilter@all_disabled@NullHandling=default.iq | 165 +++++++++
...urceWithFilter@all_disabled@NullHandling=sql.iq | 166 +++++++++
...eWithFilter@all_enabled@NullHandling=default.iq | 165 +++++++++
...ourceWithFilter@all_enabled@NullHandling=sql.iq | 166 +++++++++
...ourceWithFilter@default@NullHandling=default.iq | 162 +++++++++
...ataSourceWithFilter@default@NullHandling=sql.iq | 163 +++++++++
...n-value-column_disabled@NullHandling=default.iq | 165 +++++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 166 +++++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 165 +++++++++
...er@filter-rewrites-disabled@NullHandling=sql.iq | 166 +++++++++
...hFilter@filter-rewrites@NullHandling=default.iq | 165 +++++++++
...eWithFilter@filter-rewrites@NullHandling=sql.iq | 166 +++++++++
...thFilter@join-to-filter@NullHandling=default.iq | 165 +++++++++
...ceWithFilter@join-to-filter@NullHandling=sql.iq | 166 +++++++++
...inOperator@all_disabled@NullHandling=default.iq | 102 ++++++
...htJoinOperator@all_disabled@NullHandling=sql.iq | 102 ++++++
...oinOperator@all_enabled@NullHandling=default.iq | 102 ++++++
...ghtJoinOperator@all_enabled@NullHandling=sql.iq | 102 ++++++
...ghtJoinOperator@default@NullHandling=default.iq | 99 +++++
...ngRightJoinOperator@default@NullHandling=sql.iq | 99 +++++
...n-value-column_disabled@NullHandling=default.iq | 102 ++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 102 ++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 102 ++++++
...or@filter-rewrites-disabled@NullHandling=sql.iq | 102 ++++++
...perator@filter-rewrites@NullHandling=default.iq | 102 ++++++
...oinOperator@filter-rewrites@NullHandling=sql.iq | 102 ++++++
...Operator@join-to-filter@NullHandling=default.iq | 102 ++++++
...JoinOperator@join-to-filter@NullHandling=sql.iq | 102 ++++++
...licitJoins@all_disabled@NullHandling=default.iq | 157 ++++++++
...gExplicitJoins@all_disabled@NullHandling=sql.iq | 157 ++++++++
...plicitJoins@all_enabled@NullHandling=default.iq | 157 ++++++++
...ngExplicitJoins@all_enabled@NullHandling=sql.iq | 157 ++++++++
...ngExplicitJoins@default@NullHandling=default.iq | 154 ++++++++
...yUsingExplicitJoins@default@NullHandling=sql.iq | 154 ++++++++
...n-value-column_disabled@NullHandling=default.iq | 157 ++++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 157 ++++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 157 ++++++++
...ns@filter-rewrites-disabled@NullHandling=sql.iq | 157 ++++++++
...itJoins@filter-rewrites@NullHandling=default.iq | 157 ++++++++
...plicitJoins@filter-rewrites@NullHandling=sql.iq | 157 ++++++++
...citJoins@join-to-filter@NullHandling=default.iq | 157 ++++++++
...xplicitJoins@join-to-filter@NullHandling=sql.iq | 157 ++++++++
...InSubquery@all_disabled@NullHandling=default.iq | 237 ++++++++++++
...hereInSubquery@all_disabled@NullHandling=sql.iq | 249 +++++++++++++
...eInSubquery@all_enabled@NullHandling=default.iq | 237 ++++++++++++
...WhereInSubquery@all_enabled@NullHandling=sql.iq | 249 +++++++++++++
...WhereInSubquery@default@NullHandling=default.iq | 234 ++++++++++++
...singWhereInSubquery@default@NullHandling=sql.iq | 246 +++++++++++++
...n-value-column_disabled@NullHandling=default.iq | 237 ++++++++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 249 +++++++++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 237 ++++++++++++
...ry@filter-rewrites-disabled@NullHandling=sql.iq | 249 +++++++++++++
...ubquery@filter-rewrites@NullHandling=default.iq | 237 ++++++++++++
...eInSubquery@filter-rewrites@NullHandling=sql.iq | 249 +++++++++++++
...Subquery@join-to-filter@NullHandling=default.iq | 237 ++++++++++++
...reInSubquery@join-to-filter@NullHandling=sql.iq | 249 +++++++++++++
...actAggregateWithOrderBy@NullHandling=default.iq | 154 ++++++++
...ExtractAggregateWithOrderBy@NullHandling=sql.iq | 156 ++++++++
...ithOuterTimeExtractScan@NullHandling=default.iq | 131 +++++++
...oinWithOuterTimeExtractScan@NullHandling=sql.iq | 133 +++++++
...ltaneously@all_disabled@NullHandling=default.iq | 165 +++++++++
...Simultaneously@all_disabled@NullHandling=sql.iq | 168 +++++++++
...ultaneously@all_enabled@NullHandling=default.iq | 165 +++++++++
...sSimultaneously@all_enabled@NullHandling=sql.iq | 168 +++++++++
...sSimultaneously@default@NullHandling=default.iq | 162 +++++++++
...JoinsSimultaneously@default@NullHandling=sql.iq | 165 +++++++++
...n-value-column_disabled@NullHandling=default.iq | 165 +++++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 168 +++++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 165 +++++++++
...ly@filter-rewrites-disabled@NullHandling=sql.iq | 168 +++++++++
...neously@filter-rewrites@NullHandling=default.iq | 165 +++++++++
...ultaneously@filter-rewrites@NullHandling=sql.iq | 168 +++++++++
...aneously@join-to-filter@NullHandling=default.iq | 165 +++++++++
...multaneously@join-to-filter@NullHandling=sql.iq | 168 +++++++++
...fAndFilter@all_disabled@NullHandling=default.iq | 152 ++++++++
...artOfAndFilter@all_disabled@NullHandling=sql.iq | 154 ++++++++
...OfAndFilter@all_enabled@NullHandling=default.iq | 152 ++++++++
...PartOfAndFilter@all_enabled@NullHandling=sql.iq | 154 ++++++++
...PartOfAndFilter@default@NullHandling=default.iq | 149 ++++++++
...ryAsPartOfAndFilter@default@NullHandling=sql.iq | 151 ++++++++
...n-value-column_disabled@NullHandling=default.iq | 152 ++++++++
...er-on-value-column_disabled@NullHandling=sql.iq | 154 ++++++++
...ilter-rewrites-disabled@NullHandling=default.iq | 152 ++++++++
...er@filter-rewrites-disabled@NullHandling=sql.iq | 154 ++++++++
...dFilter@filter-rewrites@NullHandling=default.iq | 152 ++++++++
...OfAndFilter@filter-rewrites@NullHandling=sql.iq | 154 ++++++++
...ndFilter@join-to-filter@NullHandling=default.iq | 152 ++++++++
...tOfAndFilter@join-to-filter@NullHandling=sql.iq | 154 ++++++++
...lColumnOnMVFilterJoinExpression@all_disabled.iq | 4 +-
...alColumnOnMVFilterJoinExpression@all_enabled.iq | 4 +-
...irtualColumnOnMVFilterJoinExpression@default.iq | 4 +-
...inExpression@filter-on-value-column_disabled.iq | 4 +-
...ilterJoinExpression@filter-rewrites-disabled.iq | 4 +-
...lumnOnMVFilterJoinExpression@filter-rewrites.iq | 4 +-
...olumnOnMVFilterJoinExpression@join-to-filter.iq | 4 +-
...ityProjectDoesNotRename@NullHandling=default.iq | 144 --------
...dentityProjectDoesNotRename@NullHandling=sql.iq | 145 --------
321 files changed, 45043 insertions(+), 737 deletions(-)
diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java
index c42c237ee36..a7b4ba21203 100644
--- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java
+++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java
@@ -37,6 +37,8 @@ import org.apache.calcite.rel.core.RelFactories;
import org.apache.calcite.rel.metadata.DefaultRelMetadataProvider;
import org.apache.calcite.rel.rules.CoreRules;
import org.apache.calcite.rel.rules.DateRangeRules;
+import org.apache.calcite.rel.rules.FilterJoinRule.FilterIntoJoinRule.FilterIntoJoinRuleConfig;
+import org.apache.calcite.rel.rules.JoinExtractFilterRule;
import org.apache.calcite.rel.rules.JoinPushThroughJoinRule;
import org.apache.calcite.rel.rules.ProjectMergeRule;
import org.apache.calcite.rel.rules.PruneEmptyRules;
@@ -67,6 +69,7 @@ import org.apache.druid.sql.calcite.rule.ReverseLookupRule;
import org.apache.druid.sql.calcite.rule.RewriteFirstValueLastValueRule;
import org.apache.druid.sql.calcite.rule.SortCollapseRule;
import org.apache.druid.sql.calcite.rule.logical.DruidAggregateRemoveRedundancyRule;
+import org.apache.druid.sql.calcite.rule.logical.DruidJoinRule;
import org.apache.druid.sql.calcite.rule.logical.DruidLogicalRules;
import org.apache.druid.sql.calcite.run.EngineFeature;
import org.apache.druid.sql.hook.DruidHook;
@@ -273,10 +276,11 @@ public class CalciteRulesManager
{
final HepProgramBuilder builder = HepProgram.builder();
builder.addMatchLimit(CalciteRulesManager.HEP_DEFAULT_MATCH_LIMIT);
- builder.addGroupBegin();
builder.addRuleCollection(baseRuleSet(plannerContext));
builder.addRuleInstance(CoreRules.UNION_MERGE);
- builder.addGroupEnd();
+ builder.addRuleInstance(JoinExtractFilterRule.Config.DEFAULT.toRule());
+ builder.addRuleInstance(FilterIntoJoinRuleConfig.DEFAULT.withPredicate(DruidJoinRule::isSupportedPredicate).toRule());
+
return Programs.of(builder.build(), true, DefaultRelMetadataProvider.INSTANCE);
}
@@ -494,6 +498,8 @@ public class CalciteRulesManager
rules.addAll(FANCY_JOIN_RULES);
}
+ rules.add(DruidAggregateRemoveRedundancyRule.instance());
+
if (!plannerConfig.isUseApproximateCountDistinct()) {
if (plannerConfig.isUseGroupingSetForExactDistinct()
&& plannerContext.featureAvailable(EngineFeature.GROUPING_SETS)) {
@@ -507,7 +513,6 @@ public class CalciteRulesManager
rules.add(FilterJoinExcludePushToChildRule.FILTER_ON_JOIN_EXCLUDE_PUSH_TO_CHILD);
rules.add(SortCollapseRule.instance());
rules.add(ProjectAggregatePruneUnusedCallRule.instance());
- rules.add(DruidAggregateRemoveRedundancyRule.instance());
return rules.build();
}
diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/querygen/DruidQueryGenerator.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/querygen/DruidQueryGenerator.java
index 61f6d13755b..28de4e8c255 100644
--- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/querygen/DruidQueryGenerator.java
+++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/querygen/DruidQueryGenerator.java
@@ -259,6 +259,7 @@ public class DruidQueryGenerator
final PartialDruidQuery partialDruidQuery;
final List<Vertex> inputs;
final JoinSupportTweaks jst;
+ private SourceDesc source;
public PDQVertex(PartialDruidQuery partialDruidQuery, List<Vertex> inputs, JoinSupportTweaks jst)
{
@@ -280,10 +281,18 @@ public class DruidQueryGenerator
);
}
+ private SourceDesc getSource()
+ {
+ if (source == null) {
+ source = realGetSource();
+ }
+ return source;
+ }
+
/**
* Creates the {@link SourceDesc} for the current {@link Vertex}.
*/
- private SourceDesc getSource()
+ private SourceDesc realGetSource()
{
List<SourceDesc> sourceDescs = new ArrayList<>();
for (Vertex inputVertex : inputs) {
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 1a50ae1fbcd..faf459f658c 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
@@ -24,6 +24,8 @@ import org.apache.calcite.plan.RelTraitSet;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.convert.ConverterRule;
import org.apache.calcite.rel.core.Join;
+import org.apache.calcite.rel.core.JoinRelType;
+import org.apache.calcite.rex.RexNode;
import org.apache.druid.error.InvalidSqlInput;
import org.apache.druid.sql.calcite.rel.logical.DruidJoin;
import org.apache.druid.sql.calcite.rel.logical.DruidLogicalConvention;
@@ -72,4 +74,13 @@ public class DruidJoinRule extends ConverterRule
);
}
+ public static boolean isSupportedPredicate(Join join, JoinRelType joinType, RexNode exp)
+ {
+ ConditionAnalysis analysis = org.apache.druid.sql.calcite.rule.DruidJoinRule.analyzeCondition(
+ exp,
+ join.getLeft().getRowType(),
+ join.getCluster().getRexBuilder()
+ );
+ return analysis.errorStr == null;
+ }
}
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 04cea5e2c13..026261b566b 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
@@ -678,9 +678,9 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
- @NotYetSupported(Modes.CANNOT_JOIN_LOOKUP_NON_KEY)
public void testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing(Map<String, Object> queryContext)
{
@@ -760,9 +760,9 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
public void testFilterAndGroupByLookupUsingJoinOperatorBackwards(Map<String, Object> queryContext)
{
// Like "testFilterAndGroupByLookupUsingJoinOperator", but with the table and lookup reversed.
@@ -816,7 +816,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter(Map<String, Object> queryContext)
@@ -864,7 +864,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testJoinUnionTablesOnLookup(Map<String, Object> queryContext)
@@ -917,7 +917,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.CANNOT_JOIN_LOOKUP_NON_KEY)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testFilterAndGroupByLookupUsingJoinOperator(Map<String, Object> queryContext)
@@ -1127,7 +1127,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_UNSUPORTED_OPERAND)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinTableLookupLookupWithFilterWithOuterLimit(Map<String, Object> queryContext)
@@ -1171,7 +1171,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_UNSUPORTED_OPERAND)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinTableLookupLookupWithFilterWithoutLimit(Map<String, Object> queryContext)
@@ -1213,7 +1213,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_UNSUPORTED_OPERAND)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinTableLookupLookupWithFilterWithOuterLimitWithAllColumns(Map<String, Object> queryContext)
@@ -1258,7 +1258,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_UNSUPORTED_OPERAND)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinTableLookupLookupWithFilterWithoutLimitWithAllColumns(Map<String, Object> queryContext)
@@ -1300,7 +1300,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_UNSUPORTED_OPERAND)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.IMPROVED_PLAN, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testManyManyInnerJoinOnManyManyLookup(Map<String, Object> queryContext)
@@ -2010,7 +2010,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
// This SQL currently does not result in an optimum plan.
// Unfortunately, we have disabled pushing down predicates (conditions and filters) due to https://github.com/apache/druid/pull/9773
// Hence, comma join will result in a cross join with filter on outermost
- @NotYetSupported(Modes.JOIN_CONDITION_UNSUPORTED_OPERAND)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.IRRELEVANT_SCANQUERY)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testCommaJoinTableLookupTableMismatchedTypes(Map<String, Object> queryContext)
@@ -2502,6 +2502,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testSelectOnLookupUsingRightJoinOperator(Map<String, Object> queryContext)
@@ -2791,7 +2792,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinWithIsNullFilter(Map<String, Object> queryContext)
@@ -3672,7 +3673,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
- @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.IMPROVED_PLAN, separateDefaultModeTest = true)
public void testLeftJoinSubqueryWithSelectorFilter(Map<String, Object> queryContext)
{
// Cannot vectorize due to 'concat' expression.
@@ -3873,6 +3874,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinSubqueryWithSelectorFilter(Map<String, Object> queryContext)
@@ -3928,8 +3930,8 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@Test
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
public void testSemiJoinWithOuterTimeExtractScan()
{
testQuery(
@@ -3976,7 +3978,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testTwoSemiJoinsSimultaneously(Map<String, Object> queryContext)
@@ -4040,6 +4042,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testSemiAndAntiJoinSimultaneouslyUsingWhereInSubquery(Map<String, Object> queryContext)
@@ -4146,6 +4149,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testSemiAndAntiJoinSimultaneouslyUsingExplicitJoins(Map<String, Object> queryContext)
@@ -4214,8 +4218,8 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@Test
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
public void testSemiJoinWithOuterTimeExtractAggregateWithOrderBy()
{
testQuery(
@@ -4681,7 +4685,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testJoinWithNonEquiCondition(Map<String, Object> queryContext)
@@ -4743,7 +4746,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_UNSUPORTED_OPERAND)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testJoinWithEquiAndNonEquiCondition(Map<String, Object> queryContext)
@@ -4788,7 +4790,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testUsingSubqueryAsPartOfAndFilter(Map<String, Object> queryContext)
@@ -4946,8 +4948,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
-
- @NotYetSupported(Modes.JOIN_CONDITION_UNSUPORTED_OPERAND)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.IRRELEVANT_SCANQUERY, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testNestedGroupByOnInlineDataSourceWithFilter(Map<String, Object> queryContext)
@@ -5222,7 +5223,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_PLAN)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testVirtualColumnOnMVFilterJoinExpression(Map<String, Object> queryContext)
@@ -5359,7 +5360,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinWithFilterPushdownAndManyFiltersEmptyResults(Map<String, Object> queryContext)
@@ -5467,7 +5468,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND, separateDefaultModeTest = true)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinWithFilterPushdownAndManyFiltersNonEmptyResults(Map<String, Object> queryContext)
@@ -6138,7 +6139,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
}
@Test
- @NotYetSupported(Modes.CORRELATE_CONVERSION)
+ @NotYetSupported(Modes.UNNEST_NOT_SUPPORTED_CORRELATE_CONVERSION)
public void testJoinsWithUnnestOnLeft()
{
// Segment map function of MSQ needs some work
@@ -6193,7 +6194,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
}
@Test
- @NotYetSupported(Modes.CORRELATE_CONVERSION)
+ @NotYetSupported(Modes.UNNEST_NOT_SUPPORTED_CORRELATE_CONVERSION)
public void testJoinsWithUnnestOverFilteredDSOnLeft()
{
// Segment map function of MSQ needs some work
@@ -6251,7 +6252,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
}
@Test
- @NotYetSupported(Modes.CORRELATE_CONVERSION)
+ @NotYetSupported(Modes.UNNEST_NOT_SUPPORTED_CORRELATE_CONVERSION)
public void testJoinsWithUnnestOverJoin()
{
// Segment map function of MSQ needs some work
@@ -6336,7 +6337,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
}
@Test
- @NotYetSupported(Modes.CORRELATE_CONVERSION)
+ @NotYetSupported(Modes.UNNEST_NOT_SUPPORTED_CORRELATE_CONVERSION)
public void testSelfJoinsWithUnnestOnLeftAndRight()
{
// Segment map function of MSQ needs some work
@@ -6405,7 +6406,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
}
@Test
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @NotYetSupported(Modes.UNNEST_NOT_SUPPORTED_CORRELATE_CONVERSION)
public void testJoinsOverUnnestOverFilterDSOverJoin()
{
// Segment map function of MSQ needs some work
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 55da3f41c23..5af5ec3097c 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
@@ -6388,8 +6388,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
@Test
public void testUnplannableJoinQueriesInNonSQLCompatibleMode()
{
+ assumeFalse(testBuilder().isDecoupledMode(), "only valid in non-decoupled mode");
msqIncompatible();
-
Assumptions.assumeFalse(NullHandling.sqlCompatible());
assertQueryIsUnplannable(
@@ -6398,6 +6398,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
+ "FROM foo INNER JOIN lookup.lookyloo l ON foo.dim2 <> l.k",
"SQL requires a join with 'NOT_EQUALS' condition that is not supported."
);
+ }
+
+ @Test
+ public void testUnplannableJoinQueriesInNonSQLCompatibleMode2()
+ {
+ assumeFalse(testBuilder().isDecoupledMode(), "only valid in non-decoupled mode");
+ msqIncompatible();
+ Assumptions.assumeFalse(NullHandling.sqlCompatible());
assertQueryIsUnplannable(
// JOIN condition with a function of both sides.
@@ -6407,6 +6415,36 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
+ @Test
+ public void testPlannableJoinQueriesInNonSQLCompatibleMode()
+ {
+ assumeTrue(testBuilder().isDecoupledMode(), "only in decoupled mode");
+ msqIncompatible();
+ Assumptions.assumeFalse(NullHandling.sqlCompatible());
+
+ testBuilder()
+ .sql(
+ "SELECT foo.dim1, foo.dim2, l.k, l.v\n"
+ + "FROM foo INNER JOIN lookup.lookyloo l ON foo.dim2 <> l.k"
+ )
+ .run();
+ }
+
+ @Test
+ public void testPlannableJoinQueriesInNonSQLCompatibleMode2()
+ {
+ assumeTrue(testBuilder().isDecoupledMode(), "only in decoupled mode");
+ msqIncompatible();
+ Assumptions.assumeFalse(NullHandling.sqlCompatible());
+
+ testBuilder()
+ .sql(
+ "SELECT foo.dim1, foo.dim2, l.k, l.v\n"
+ + "FROM foo INNER JOIN lookup.lookyloo l ON CHARACTER_LENGTH(foo.dim2 || l.k) > 3\n"
+ )
+ .run();
+ }
+
@Test
public void testCountStarWithBoundFilterSimplifyOnMetric()
{
@@ -9341,7 +9379,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
- @DecoupledTestConfig(quidemReason = QuidemTestCaseReason.SLIGHTLY_WORSE_PLAN, separateDefaultModeTest = true)
@SqlTestFrameworkConfig.NumMergeBuffers(3)
@Test
public void testQueryWithSelectProjectAndIdentityProjectDoesNotRename()
@@ -12962,7 +12999,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
}
// __time >= x remains in the join condition
- @NotYetSupported(Modes.JOIN_CONDITION_NOT_PUSHED_CONDITION)
+ @NotYetSupported(Modes.REQUIRE_TIME_CONDITION)
@Test
public void testRequireTimeConditionPositive3()
{
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 14ae52def5f..9bc4fe0fee4 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
@@ -96,7 +96,25 @@ public @interface DecoupledTestConfig
* instead of joining on condition (CAST("j0.k", 'DOUBLE') == "_j0.m1")
* a vc was computed for CAST("j0.k", 'DOUBLE')
*/
- EQUIV_PLAN_CAST_MATERIALIZED_EARLIER;
+ EQUIV_PLAN_CAST_MATERIALIZED_EARLIER,
+ /**
+ * Filter pushed down.
+ *
+ * Instead:
+ * Filter -> Join -> Table
+ * Join -> Filter -> Table
+ */
+ SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND,
+ /**
+ * Instead:
+ * Join (l=r && lCol='a') -> Gby
+ * Join (l=r) -> Gby[lCol='a]
+ */
+ FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE,
+ /**
+ * Strange things; needs more investigation
+ */
+ IRRELEVANT_SCANQUERY;
public boolean isPresent()
{
diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/NotYetSupported.java b/sql/src/test/java/org/apache/druid/sql/calcite/NotYetSupported.java
index 50dd2e43773..1a83a708e21 100644
--- a/sql/src/test/java/org/apache/druid/sql/calcite/NotYetSupported.java
+++ b/sql/src/test/java/org/apache/druid/sql/calcite/NotYetSupported.java
@@ -21,6 +21,7 @@ package org.apache.druid.sql.calcite;
import com.google.common.base.Throwables;
import org.apache.druid.error.DruidException;
+import org.apache.druid.sql.calcite.rel.CannotBuildQueryException;
import org.junit.AssumptionViolatedException;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.InvocationInterceptor;
@@ -91,12 +92,10 @@ public @interface NotYetSupported
UNSUPPORTED_DATASOURCE(DruidException.class, "WindowOperatorQuery must run on top of a query or inline data source"),
UNION_WITH_COMPLEX_OPERAND(DruidException.class, "Only Table and Values are supported as inputs for Union"),
UNION_MORE_STRICT_ROWTYPE_CHECK(DruidException.class, "Row signature mismatch in Union inputs"),
- JOIN_CONDITION_NOT_PUSHED_CONDITION(DruidException.class, "SQL requires a join with '.*' condition"),
- JOIN_CONDITION_UNSUPORTED_OPERAND(DruidException.class, "SQL .* unsupported operand type"),
- CORRELATE_CONVERSION(DruidException.class, "Missing conversion( is|s are) LogicalCorrelate"),
+ UNNEST_NOT_SUPPORTED_CORRELATE_CONVERSION(DruidException.class, "Missing conversion( is|s are) LogicalCorrelate"),
SORT_REMOVE_TROUBLE(DruidException.class, "Calcite assertion violated.*Sort\\.<init>"),
- CANNOT_JOIN_LOOKUP_NON_KEY(RuntimeException.class, "Cannot join lookup with condition referring to non-key"),
- SORT_REMOVE_CONSTANT_KEYS_CONFLICT(DruidException.class, "not enough rules");
+ SORT_REMOVE_CONSTANT_KEYS_CONFLICT(DruidException.class, "not enough rules"),
+ REQUIRE_TIME_CONDITION(CannotBuildQueryException.class, "requireTimeCondition is enabled");
// @formatter:on
public Class<? extends Throwable> throwableClass;
diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@all_disabled.iq
new file mode 100644
index 00000000000..89f9a54998d
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@all_disabled.iq
@@ -0,0 +1,151 @@
+# testCommaJoinTableLookupTableMismatchedTypes@all_disabled case-crc:fa64f472
+# quidem testcase reason: IRRELEVANT_SCANQUERY
+!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 COUNT(*)
+FROM foo, lookup.lookyloo l, numfoo
+WHERE foo.cnt = l.k AND l.k = numfoo.cnt
+;
++--------+
+| EXPR$0 |
++--------+
+| 0 |
++--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+ LogicalJoin(condition=[=($2, $3)], joinType=[inner])
+ LogicalFilter(condition=[=($0, CAST($1):BIGINT)])
+ LogicalProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT])
+ LogicalJoin(condition=[true], joinType=[inner])
+ LogicalProject(cnt=[$4])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(cnt=[$13])
+ LogicalTableScan(table=[[druid, numfoo]])
+
+!logicalPlan
+DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($2, $3)], joinType=[inner])
+ DruidFilter(condition=[=($0, CAST($1):BIGINT)])
+ DruidProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT], druid=[logical])
+ DruidJoin(condition=[true], joinType=[inner])
+ DruidProject(cnt=[$4], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(cnt=[$13], druid=[logical])
+ DruidTableScan(table=[[druid, numfoo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "timeseries",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "table",
+ "name" : "foo"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "1",
+ "joinType" : "INNER"
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "virtualColumns" : [ {
+ "type" : "expression",
+ "name" : "v0",
+ "expression" : "CAST(\"j0.k\", 'LONG')",
+ "outputType" : "LONG"
+ } ],
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "expression",
+ "expression" : "(\"cnt\" == CAST(\"j0.k\", 'LONG'))"
+ },
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt" ],
+ "columnTypes" : [ "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "_j0.",
+ "condition" : "(\"v0\" == \"_j0.cnt\")",
+ "joinType" : "INNER"
+ },
+ "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/testCommaJoinTableLookupTableMismatchedTypes@all_enabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@all_enabled.iq
new file mode 100644
index 00000000000..94b7f73e131
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@all_enabled.iq
@@ -0,0 +1,151 @@
+# testCommaJoinTableLookupTableMismatchedTypes@all_enabled case-crc:e2bcc2a9
+# quidem testcase reason: IRRELEVANT_SCANQUERY
+!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 COUNT(*)
+FROM foo, lookup.lookyloo l, numfoo
+WHERE foo.cnt = l.k AND l.k = numfoo.cnt
+;
++--------+
+| EXPR$0 |
++--------+
+| 0 |
++--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+ LogicalJoin(condition=[=($2, $3)], joinType=[inner])
+ LogicalFilter(condition=[=($0, CAST($1):BIGINT)])
+ LogicalProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT])
+ LogicalJoin(condition=[true], joinType=[inner])
+ LogicalProject(cnt=[$4])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(cnt=[$13])
+ LogicalTableScan(table=[[druid, numfoo]])
+
+!logicalPlan
+DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($2, $3)], joinType=[inner])
+ DruidFilter(condition=[=($0, CAST($1):BIGINT)])
+ DruidProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT], druid=[logical])
+ DruidJoin(condition=[true], joinType=[inner])
+ DruidProject(cnt=[$4], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(cnt=[$13], druid=[logical])
+ DruidTableScan(table=[[druid, numfoo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "timeseries",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "table",
+ "name" : "foo"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "1",
+ "joinType" : "INNER"
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "virtualColumns" : [ {
+ "type" : "expression",
+ "name" : "v0",
+ "expression" : "CAST(\"j0.k\", 'LONG')",
+ "outputType" : "LONG"
+ } ],
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "expression",
+ "expression" : "(\"cnt\" == CAST(\"j0.k\", 'LONG'))"
+ },
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt" ],
+ "columnTypes" : [ "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "_j0.",
+ "condition" : "(\"v0\" == \"_j0.cnt\")",
+ "joinType" : "INNER"
+ },
+ "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/testCommaJoinTableLookupTableMismatchedTypes@default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@default.iq
new file mode 100644
index 00000000000..d633b774a5f
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@default.iq
@@ -0,0 +1,148 @@
+# testCommaJoinTableLookupTableMismatchedTypes@default case-crc:14308da2
+# quidem testcase reason: IRRELEVANT_SCANQUERY
+!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(*)
+FROM foo, lookup.lookyloo l, numfoo
+WHERE foo.cnt = l.k AND l.k = numfoo.cnt
+;
++--------+
+| EXPR$0 |
++--------+
+| 0 |
++--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+ LogicalJoin(condition=[=($2, $3)], joinType=[inner])
+ LogicalFilter(condition=[=($0, CAST($1):BIGINT)])
+ LogicalProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT])
+ LogicalJoin(condition=[true], joinType=[inner])
+ LogicalProject(cnt=[$4])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(cnt=[$13])
+ LogicalTableScan(table=[[druid, numfoo]])
+
+!logicalPlan
+DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($2, $3)], joinType=[inner])
+ DruidFilter(condition=[=($0, CAST($1):BIGINT)])
+ DruidProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT], druid=[logical])
+ DruidJoin(condition=[true], joinType=[inner])
+ DruidProject(cnt=[$4], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(cnt=[$13], druid=[logical])
+ DruidTableScan(table=[[druid, numfoo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "timeseries",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "table",
+ "name" : "foo"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "1",
+ "joinType" : "INNER"
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "virtualColumns" : [ {
+ "type" : "expression",
+ "name" : "v0",
+ "expression" : "CAST(\"j0.k\", 'LONG')",
+ "outputType" : "LONG"
+ } ],
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "expression",
+ "expression" : "(\"cnt\" == CAST(\"j0.k\", 'LONG'))"
+ },
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt" ],
+ "columnTypes" : [ "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "_j0.",
+ "condition" : "(\"v0\" == \"_j0.cnt\")",
+ "joinType" : "INNER"
+ },
+ "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/testCommaJoinTableLookupTableMismatchedTypes@filter-on-value-column_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@filter-on-value-column_disabled.iq
new file mode 100644
index 00000000000..b35cc7db31b
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@filter-on-value-column_disabled.iq
@@ -0,0 +1,151 @@
+# testCommaJoinTableLookupTableMismatchedTypes@filter-on-value-column_disabled case-crc:98c3c89c
+# quidem testcase reason: IRRELEVANT_SCANQUERY
+!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 COUNT(*)
+FROM foo, lookup.lookyloo l, numfoo
+WHERE foo.cnt = l.k AND l.k = numfoo.cnt
+;
++--------+
+| EXPR$0 |
++--------+
+| 0 |
++--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+ LogicalJoin(condition=[=($2, $3)], joinType=[inner])
+ LogicalFilter(condition=[=($0, CAST($1):BIGINT)])
+ LogicalProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT])
+ LogicalJoin(condition=[true], joinType=[inner])
+ LogicalProject(cnt=[$4])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(cnt=[$13])
+ LogicalTableScan(table=[[druid, numfoo]])
+
+!logicalPlan
+DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($2, $3)], joinType=[inner])
+ DruidFilter(condition=[=($0, CAST($1):BIGINT)])
+ DruidProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT], druid=[logical])
+ DruidJoin(condition=[true], joinType=[inner])
+ DruidProject(cnt=[$4], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(cnt=[$13], druid=[logical])
+ DruidTableScan(table=[[druid, numfoo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "timeseries",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "table",
+ "name" : "foo"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "1",
+ "joinType" : "INNER"
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "virtualColumns" : [ {
+ "type" : "expression",
+ "name" : "v0",
+ "expression" : "CAST(\"j0.k\", 'LONG')",
+ "outputType" : "LONG"
+ } ],
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "expression",
+ "expression" : "(\"cnt\" == CAST(\"j0.k\", 'LONG'))"
+ },
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt" ],
+ "columnTypes" : [ "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "_j0.",
+ "condition" : "(\"v0\" == \"_j0.cnt\")",
+ "joinType" : "INNER"
+ },
+ "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/testCommaJoinTableLookupTableMismatchedTypes@filter-rewrites-disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@filter-rewrites-disabled.iq
new file mode 100644
index 00000000000..c8a0f41b1dc
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@filter-rewrites-disabled.iq
@@ -0,0 +1,151 @@
+# testCommaJoinTableLookupTableMismatchedTypes@filter-rewrites-disabled case-crc:b0c29cbc
+# quidem testcase reason: IRRELEVANT_SCANQUERY
+!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 COUNT(*)
+FROM foo, lookup.lookyloo l, numfoo
+WHERE foo.cnt = l.k AND l.k = numfoo.cnt
+;
++--------+
+| EXPR$0 |
++--------+
+| 0 |
++--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+ LogicalJoin(condition=[=($2, $3)], joinType=[inner])
+ LogicalFilter(condition=[=($0, CAST($1):BIGINT)])
+ LogicalProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT])
+ LogicalJoin(condition=[true], joinType=[inner])
+ LogicalProject(cnt=[$4])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(cnt=[$13])
+ LogicalTableScan(table=[[druid, numfoo]])
+
+!logicalPlan
+DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($2, $3)], joinType=[inner])
+ DruidFilter(condition=[=($0, CAST($1):BIGINT)])
+ DruidProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT], druid=[logical])
+ DruidJoin(condition=[true], joinType=[inner])
+ DruidProject(cnt=[$4], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(cnt=[$13], druid=[logical])
+ DruidTableScan(table=[[druid, numfoo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "timeseries",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "table",
+ "name" : "foo"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "1",
+ "joinType" : "INNER"
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "virtualColumns" : [ {
+ "type" : "expression",
+ "name" : "v0",
+ "expression" : "CAST(\"j0.k\", 'LONG')",
+ "outputType" : "LONG"
+ } ],
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "expression",
+ "expression" : "(\"cnt\" == CAST(\"j0.k\", 'LONG'))"
+ },
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt" ],
+ "columnTypes" : [ "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "_j0.",
+ "condition" : "(\"v0\" == \"_j0.cnt\")",
+ "joinType" : "INNER"
+ },
+ "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/testCommaJoinTableLookupTableMismatchedTypes@filter-rewrites.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@filter-rewrites.iq
new file mode 100644
index 00000000000..7dbdb9d245c
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@filter-rewrites.iq
@@ -0,0 +1,151 @@
+# testCommaJoinTableLookupTableMismatchedTypes@filter-rewrites case-crc:148021fd
+# quidem testcase reason: IRRELEVANT_SCANQUERY
+!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 COUNT(*)
+FROM foo, lookup.lookyloo l, numfoo
+WHERE foo.cnt = l.k AND l.k = numfoo.cnt
+;
++--------+
+| EXPR$0 |
++--------+
+| 0 |
++--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+ LogicalJoin(condition=[=($2, $3)], joinType=[inner])
+ LogicalFilter(condition=[=($0, CAST($1):BIGINT)])
+ LogicalProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT])
+ LogicalJoin(condition=[true], joinType=[inner])
+ LogicalProject(cnt=[$4])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(cnt=[$13])
+ LogicalTableScan(table=[[druid, numfoo]])
+
+!logicalPlan
+DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($2, $3)], joinType=[inner])
+ DruidFilter(condition=[=($0, CAST($1):BIGINT)])
+ DruidProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT], druid=[logical])
+ DruidJoin(condition=[true], joinType=[inner])
+ DruidProject(cnt=[$4], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(cnt=[$13], druid=[logical])
+ DruidTableScan(table=[[druid, numfoo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "timeseries",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "table",
+ "name" : "foo"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "1",
+ "joinType" : "INNER"
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "virtualColumns" : [ {
+ "type" : "expression",
+ "name" : "v0",
+ "expression" : "CAST(\"j0.k\", 'LONG')",
+ "outputType" : "LONG"
+ } ],
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "expression",
+ "expression" : "(\"cnt\" == CAST(\"j0.k\", 'LONG'))"
+ },
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt" ],
+ "columnTypes" : [ "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "_j0.",
+ "condition" : "(\"v0\" == \"_j0.cnt\")",
+ "joinType" : "INNER"
+ },
+ "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/testCommaJoinTableLookupTableMismatchedTypes@join-to-filter.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@join-to-filter.iq
new file mode 100644
index 00000000000..4f3f7571a22
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testCommaJoinTableLookupTableMismatchedTypes@join-to-filter.iq
@@ -0,0 +1,151 @@
+# testCommaJoinTableLookupTableMismatchedTypes@join-to-filter case-crc:3eadb819
+# quidem testcase reason: IRRELEVANT_SCANQUERY
+!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 COUNT(*)
+FROM foo, lookup.lookyloo l, numfoo
+WHERE foo.cnt = l.k AND l.k = numfoo.cnt
+;
++--------+
+| EXPR$0 |
++--------+
+| 0 |
++--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+ LogicalJoin(condition=[=($2, $3)], joinType=[inner])
+ LogicalFilter(condition=[=($0, CAST($1):BIGINT)])
+ LogicalProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT])
+ LogicalJoin(condition=[true], joinType=[inner])
+ LogicalProject(cnt=[$4])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(cnt=[$13])
+ LogicalTableScan(table=[[druid, numfoo]])
+
+!logicalPlan
+DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($2, $3)], joinType=[inner])
+ DruidFilter(condition=[=($0, CAST($1):BIGINT)])
+ DruidProject(cnt=[$0], k=[$1], k0=[CAST($1):BIGINT], druid=[logical])
+ DruidJoin(condition=[true], joinType=[inner])
+ DruidProject(cnt=[$4], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(cnt=[$13], druid=[logical])
+ DruidTableScan(table=[[druid, numfoo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "timeseries",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "query",
+ "query" : {
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "type" : "table",
+ "name" : "foo"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "1",
+ "joinType" : "INNER"
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "virtualColumns" : [ {
+ "type" : "expression",
+ "name" : "v0",
+ "expression" : "CAST(\"j0.k\", 'LONG')",
+ "outputType" : "LONG"
+ } ],
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "intervals" : {
+ "type" : "intervals",
+ "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "expression",
+ "expression" : "(\"cnt\" == CAST(\"j0.k\", 'LONG'))"
+ },
+ "columns" : [ "cnt", "j0.k", "v0" ],
+ "columnTypes" : [ "LONG", "STRING", "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "columns" : [ "cnt" ],
+ "columnTypes" : [ "LONG" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "_j0.",
+ "condition" : "(\"v0\" == \"_j0.cnt\")",
+ "joinType" : "INNER"
+ },
+ "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/testFilterAndGroupByLookupUsingJoinOperator@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@all_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..f74626ec64e
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@all_disabled@NullHandling=default.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperator@all_disabled@NullHandling=default case-crc:6ad9dbcf
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@all_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..48f7793b1e8
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@all_disabled@NullHandling=sql.iq
@@ -0,0 +1,102 @@
+# testFilterAndGroupByLookupUsingJoinOperator@all_disabled@NullHandling=sql case-crc:6ad9dbcf
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@all_enabled@NullHandling=default.iq
new file mode 100644
index 00000000000..7d763dd4b63
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@all_enabled@NullHandling=default.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperator@all_enabled@NullHandling=default case-crc:b2f0e3d2
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@all_enabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..72386cc966d
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@all_enabled@NullHandling=sql.iq
@@ -0,0 +1,102 @@
+# testFilterAndGroupByLookupUsingJoinOperator@all_enabled@NullHandling=sql case-crc:b2f0e3d2
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@default@NullHandling=default.iq
new file mode 100644
index 00000000000..2f1458b4d94
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@default@NullHandling=default.iq
@@ -0,0 +1,98 @@
+# testFilterAndGroupByLookupUsingJoinOperator@default@NullHandling=default case-crc:ab2fdc58
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@default@NullHandling=sql.iq
new file mode 100644
index 00000000000..e7882c737f6
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@default@NullHandling=sql.iq
@@ -0,0 +1,99 @@
+# testFilterAndGroupByLookupUsingJoinOperator@default@NullHandling=sql case-crc:ab2fdc58
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-on-value-column_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..d51f3f4c239
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-on-value-column_disabled@NullHandling=default.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperator@filter-on-value-column_disabled@NullHandling=default case-crc:f363558d
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-on-value-column_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..9e87aa3f991
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-on-value-column_disabled@NullHandling=sql.iq
@@ -0,0 +1,102 @@
+# testFilterAndGroupByLookupUsingJoinOperator@filter-on-value-column_disabled@NullHandling=sql case-crc:f363558d
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites-disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..f486a02f040
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites-disabled@NullHandling=default.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites-disabled@NullHandling=default case-crc:4e59d27f
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites-disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..86587e2d85f
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites-disabled@NullHandling=sql.iq
@@ -0,0 +1,102 @@
+# testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites-disabled@NullHandling=sql case-crc:4e59d27f
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites@NullHandling=default.iq
new file mode 100644
index 00000000000..03b77931754
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites@NullHandling=default.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites@NullHandling=default case-crc:33065cd9
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites@NullHandling=sql.iq
new file mode 100644
index 00000000000..0e1160d4d54
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites@NullHandling=sql.iq
@@ -0,0 +1,102 @@
+# testFilterAndGroupByLookupUsingJoinOperator@filter-rewrites@NullHandling=sql case-crc:33065cd9
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@join-to-filter@NullHandling=default.iq
new file mode 100644
index 00000000000..9716b7ab6d2
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@join-to-filter@NullHandling=default.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperator@join-to-filter@NullHandling=default case-crc:6decf339
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperator@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@join-to-filter@NullHandling=sql.iq
new file mode 100644
index 00000000000..410d0a5707e
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperator@join-to-filter@NullHandling=sql.iq
@@ -0,0 +1,102 @@
+# testFilterAndGroupByLookupUsingJoinOperator@join-to-filter@NullHandling=sql case-crc:6decf339
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = 'xa'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
+| a | 2 |
++---+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..62f7d1a5be6
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_disabled@NullHandling=default.iq
@@ -0,0 +1,121 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_disabled@NullHandling=default case-crc:969035d8
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..0a766c31034
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_disabled@NullHandling=sql.iq
@@ -0,0 +1,122 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_disabled@NullHandling=sql case-crc:969035d8
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_enabled@NullHandling=default.iq
new file mode 100644
index 00000000000..f7695328f30
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_enabled@NullHandling=default.iq
@@ -0,0 +1,121 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_enabled@NullHandling=default case-crc:d55a66d3
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_enabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..157ffa39e6e
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_enabled@NullHandling=sql.iq
@@ -0,0 +1,122 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@all_enabled@NullHandling=sql case-crc:d55a66d3
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@default@NullHandling=default.iq
new file mode 100644
index 00000000000..2dbf990aeae
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@default@NullHandling=default.iq
@@ -0,0 +1,118 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@default@NullHandling=default case-crc:b7b60a5e
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@default@NullHandling=sql.iq
new file mode 100644
index 00000000000..15e03e9e967
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@default@NullHandling=sql.iq
@@ -0,0 +1,119 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@default@NullHandling=sql case-crc:b7b60a5e
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-on-value-column_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..c84f1a640cd
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-on-value-column_disabled@NullHandling=default.iq
@@ -0,0 +1,121 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-on-value-column_disabled@NullHandling=default case-crc:d9b90253
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-on-value-column_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..76db2a82cc5
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-on-value-column_disabled@NullHandling=sql.iq
@@ -0,0 +1,122 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-on-value-column_disabled@NullHandling=sql case-crc:d9b90253
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites-disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..d9c9900d9a3
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites-disabled@NullHandling=default.iq
@@ -0,0 +1,121 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites-disabled@NullHandling=default case-crc:194265c4
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites-disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..6e73fa0cbef
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites-disabled@NullHandling=sql.iq
@@ -0,0 +1,122 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites-disabled@NullHandling=sql case-crc:194265c4
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites@NullHandling=default.iq
new file mode 100644
index 00000000000..1e53d7e699d
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites@NullHandling=default.iq
@@ -0,0 +1,121 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites@NullHandling=default case-crc:49af20a5
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites@NullHandling=sql.iq
new file mode 100644
index 00000000000..761bf019293
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites@NullHandling=sql.iq
@@ -0,0 +1,122 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@filter-rewrites@NullHandling=sql case-crc:49af20a5
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@join-to-filter@NullHandling=default.iq
new file mode 100644
index 00000000000..1e34768d340
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@join-to-filter@NullHandling=default.iq
@@ -0,0 +1,121 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@join-to-filter@NullHandling=default case-crc:5a34c7c1
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorBackwards@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@join-to-filter@NullHandling=sql.iq
new file mode 100644
index 00000000000..c029a14c277
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorBackwards@join-to-filter@NullHandling=sql.iq
@@ -0,0 +1,122 @@
+# testFilterAndGroupByLookupUsingJoinOperatorBackwards@join-to-filter@NullHandling=sql case-crc:5a34c7c1
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM lookup.lookyloo RIGHT JOIN foo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($2, $0)], joinType=[inner])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $2)], joinType=[inner])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "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",
+ "columns" : [ "dim2" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"k\" == \"j0.dim2\")",
+ "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" : "v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..1532fe93ef1
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_disabled@NullHandling=default.iq
@@ -0,0 +1,104 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_disabled@NullHandling=default case-crc:99a0fb62
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..05005055e0c
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_disabled@NullHandling=sql.iq
@@ -0,0 +1,105 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_disabled@NullHandling=sql case-crc:99a0fb62
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_enabled@NullHandling=default.iq
new file mode 100644
index 00000000000..8a6b05916ac
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_enabled@NullHandling=default.iq
@@ -0,0 +1,104 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_enabled@NullHandling=default case-crc:56c2eeea
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_enabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..bd3115e360e
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_enabled@NullHandling=sql.iq
@@ -0,0 +1,105 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@all_enabled@NullHandling=sql case-crc:56c2eeea
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@default@NullHandling=default.iq
new file mode 100644
index 00000000000..ccdba478dbe
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@default@NullHandling=default.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@default@NullHandling=default case-crc:49550f8e
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@default@NullHandling=sql.iq
new file mode 100644
index 00000000000..24a981c6d7f
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@default@NullHandling=sql.iq
@@ -0,0 +1,102 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@default@NullHandling=sql case-crc:49550f8e
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-on-value-column_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..e152ce672f3
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-on-value-column_disabled@NullHandling=default.iq
@@ -0,0 +1,104 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-on-value-column_disabled@NullHandling=default case-crc:c3056aeb
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-on-value-column_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..0db5b7d1876
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-on-value-column_disabled@NullHandling=sql.iq
@@ -0,0 +1,105 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-on-value-column_disabled@NullHandling=sql case-crc:c3056aeb
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites-disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..c97ba352aef
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites-disabled@NullHandling=default.iq
@@ -0,0 +1,104 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites-disabled@NullHandling=default case-crc:c84d485e
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites-disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..7f287172364
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites-disabled@NullHandling=sql.iq
@@ -0,0 +1,105 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites-disabled@NullHandling=sql case-crc:c84d485e
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites@NullHandling=default.iq
new file mode 100644
index 00000000000..b5cd6a9b7cf
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites@NullHandling=default.iq
@@ -0,0 +1,104 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites@NullHandling=default case-crc:16ce5a70
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites@NullHandling=sql.iq
new file mode 100644
index 00000000000..7aa073faaf9
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites@NullHandling=sql.iq
@@ -0,0 +1,105 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@filter-rewrites@NullHandling=sql case-crc:16ce5a70
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@join-to-filter@NullHandling=default.iq
new file mode 100644
index 00000000000..33b491c2f14
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@join-to-filter@NullHandling=default.iq
@@ -0,0 +1,104 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@join-to-filter@NullHandling=default case-crc:0f1d69fc
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@join-to-filter@NullHandling=sql.iq
new file mode 100644
index 00000000000..59db4614b47
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@join-to-filter@NullHandling=sql.iq
@@ -0,0 +1,105 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithNotFilter@join-to-filter@NullHandling=sql case-crc:0f1d69fc
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.v, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v <> 'xa'
+GROUP BY lookyloo.v;
++------+--------+
+| v | EXPR$1 |
++------+--------+
+| xabc | 1 |
++------+--------+
+(1 row)
+
+!ok
+LogicalAggregate(group=[{2}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[<>($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{2}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[<>($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "not",
+ "field" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ }
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.v",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..7e399655709
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_disabled@NullHandling=default.iq
@@ -0,0 +1,100 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_disabled@NullHandling=default case-crc:b506c194
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..0fea9c0817a
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_disabled@NullHandling=sql.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_disabled@NullHandling=sql case-crc:b506c194
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_enabled@NullHandling=default.iq
new file mode 100644
index 00000000000..2eb9e3dd342
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_enabled@NullHandling=default.iq
@@ -0,0 +1,100 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_enabled@NullHandling=default case-crc:7a64d41c
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_enabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..15ad5587a40
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_enabled@NullHandling=sql.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@all_enabled@NullHandling=sql case-crc:7a64d41c
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@default@NullHandling=default.iq
new file mode 100644
index 00000000000..7acd6a610a1
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@default@NullHandling=default.iq
@@ -0,0 +1,97 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@default@NullHandling=default case-crc:65f33578
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@default@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@default@NullHandling=sql.iq
new file mode 100644
index 00000000000..49f864a5ec8
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@default@NullHandling=sql.iq
@@ -0,0 +1,98 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@default@NullHandling=sql case-crc:65f33578
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-on-value-column_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-on-value-column_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..97429f762d0
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-on-value-column_disabled@NullHandling=default.iq
@@ -0,0 +1,100 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-on-value-column_disabled@NullHandling=default case-crc:efa3501d
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-on-value-column_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-on-value-column_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..f054f1fcb10
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-on-value-column_disabled@NullHandling=sql.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-on-value-column_disabled@NullHandling=sql case-crc:efa3501d
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites-disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites-disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..4b75484d921
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites-disabled@NullHandling=default.iq
@@ -0,0 +1,100 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites-disabled@NullHandling=default case-crc:e4eb72a8
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites-disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites-disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..93a5d135023
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites-disabled@NullHandling=sql.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites-disabled@NullHandling=sql case-crc:e4eb72a8
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites@NullHandling=default.iq
new file mode 100644
index 00000000000..820d83af355
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites@NullHandling=default.iq
@@ -0,0 +1,100 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites@NullHandling=default case-crc:3a686086
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites@NullHandling=sql.iq
new file mode 100644
index 00000000000..2d63d026361
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites@NullHandling=sql.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@filter-rewrites@NullHandling=sql case-crc:3a686086
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@join-to-filter@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@join-to-filter@NullHandling=default.iq
new file mode 100644
index 00000000000..5bed173887f
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@join-to-filter@NullHandling=default.iq
@@ -0,0 +1,100 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@join-to-filter@NullHandling=default case-crc:23bb530a
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@join-to-filter@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@join-to-filter@NullHandling=sql.iq
new file mode 100644
index 00000000000..f4a5ca3cd0f
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@join-to-filter@NullHandling=sql.iq
@@ -0,0 +1,101 @@
+# testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothing@join-to-filter@NullHandling=sql case-crc:23bb530a
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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 lookyloo.k, COUNT(*)
+FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k
+WHERE lookyloo.v = '123'
+GROUP BY lookyloo.k;
++---+--------+
+| k | EXPR$1 |
++---+--------+
++---+--------+
+(0 rows)
+
+!ok
+LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])
+ LogicalJoin(condition=[=($0, $1)], joinType=[inner])
+ LogicalProject(dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, '123')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidAggregate(group=[{1}], EXPR$1=[COUNT()], druid=[logical])
+ DruidJoin(condition=[=($0, $1)], joinType=[inner])
+ DruidProject(dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, '123')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "groupBy",
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "123"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "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" : "j0.k",
+ "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/testLeftJoinSubqueryWithSelectorFilter@all_disabled.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@all_disabled@NullHandling=default.iq
similarity index 65%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_disabled.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@all_disabled@NullHandling=default.iq
index 2fb49c488d8..6217c2a18e9 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@all_disabled@NullHandling=default.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@all_disabled case-crc:6d5ce04a
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@all_disabled@NullHandling=default case-crc:ab8e838b
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,22 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "d0",
+ "value" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@all_disabled@NullHandling=sql.iq
similarity index 65%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_disabled.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@all_disabled@NullHandling=sql.iq
index 2fb49c488d8..a8d6bb7ebdd 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@all_disabled@NullHandling=sql.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@all_disabled case-crc:6d5ce04a
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@all_disabled@NullHandling=sql case-crc:ab8e838b
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,23 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "equals",
+ "column" : "d0",
+ "matchValueType" : "STRING",
+ "matchValue" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@all_enabled@NullHandling=default.iq
similarity index 65%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_enabled.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@all_enabled@NullHandling=default.iq
index f8c20e42d6a..23a5053dcb8 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@all_enabled@NullHandling=default.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@all_enabled case-crc:74a61554
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@all_enabled@NullHandling=default case-crc:77939a13
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,22 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "d0",
+ "value" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@all_enabled@NullHandling=sql.iq
similarity index 65%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@all_enabled.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@all_enabled@NullHandling=sql.iq
index f8c20e42d6a..0ba46744a82 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@all_enabled@NullHandling=sql.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@all_enabled case-crc:74a61554
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@all_enabled@NullHandling=sql case-crc:77939a13
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,23 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "equals",
+ "column" : "d0",
+ "matchValueType" : "STRING",
+ "matchValue" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@default@NullHandling=default.iq
similarity index 64%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@default.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@default@NullHandling=default.iq
index a365f6899bf..0dfb9013551 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@default@NullHandling=default.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@default case-crc:cbdfab50
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@default@NullHandling=default case-crc:8fb61cd8
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
@@ -9,11 +8,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -22,20 +17,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -73,13 +70,22 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "d0",
+ "value" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@default@NullHandling=sql.iq
similarity index 63%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@default.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@default@NullHandling=sql.iq
index a365f6899bf..70d30179c9f 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@default@NullHandling=sql.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@default case-crc:cbdfab50
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@default@NullHandling=sql case-crc:8fb61cd8
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
@@ -9,11 +8,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -22,20 +17,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -73,13 +70,23 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "equals",
+ "column" : "d0",
+ "matchValueType" : "STRING",
+ "matchValue" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled@NullHandling=default.iq
similarity index 65%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled@NullHandling=default.iq
index 398b3cc3a85..ba94c15f690 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled@NullHandling=default.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled case-crc:ca23bb81
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled@NullHandling=default case-crc:cf03d9f0
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,22 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "d0",
+ "value" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled@NullHandling=sql.iq
similarity index 64%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled@NullHandling=sql.iq
index 398b3cc3a85..17c679a8095 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled@NullHandling=sql.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled case-crc:ca23bb81
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@filter-on-value-column_disabled@NullHandling=sql case-crc:cf03d9f0
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,23 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "equals",
+ "column" : "d0",
+ "matchValueType" : "STRING",
+ "matchValue" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites-disabled@NullHandling=default.iq
similarity index 65%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites-disabled@NullHandling=default.iq
index 5c86e793f30..a9a953ea7fa 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites-disabled@NullHandling=default.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled case-crc:c16b9934
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@filter-rewrites-disabled@NullHandling=default case-crc:9cf0e315
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,22 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "d0",
+ "value" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites-disabled@NullHandling=sql.iq
similarity index 64%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites-disabled@NullHandling=sql.iq
index 5c86e793f30..80f1859cd24 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites-disabled@NullHandling=sql.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@filter-rewrites-disabled case-crc:c16b9934
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@filter-rewrites-disabled@NullHandling=sql case-crc:9cf0e315
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,23 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "equals",
+ "column" : "d0",
+ "matchValueType" : "STRING",
+ "matchValue" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites@NullHandling=default.iq
similarity index 65%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites@NullHandling=default.iq
index e1be3203710..99f56f4cea9 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites@NullHandling=default.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@filter-rewrites case-crc:1fe88b1a
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@filter-rewrites@NullHandling=default case-crc:39eaeb27
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,22 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "d0",
+ "value" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites@NullHandling=sql.iq
similarity index 64%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@filter-rewrites.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites@NullHandling=sql.iq
index e1be3203710..c0f92aa3630 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@filter-rewrites@NullHandling=sql.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@filter-rewrites case-crc:1fe88b1a
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@filter-rewrites@NullHandling=sql case-crc:39eaeb27
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,23 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "equals",
+ "column" : "d0",
+ "matchValueType" : "STRING",
+ "matchValue" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@join-to-filter@NullHandling=default.iq
similarity index 65%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@join-to-filter.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@join-to-filter@NullHandling=default.iq
index 590296d4904..634c03424a9 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@join-to-filter@NullHandling=default.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@join-to-filter case-crc:04e8d03a
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@join-to-filter@NullHandling=default case-crc:5c4107c7
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,22 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "d0",
+ "value" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
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/testInnerJoinSubqueryWithSelectorFilter@join-to-filter@NullHandling=sql.iq
similarity index 64%
copy from sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testLeftJoinSubqueryWithSelectorFilter@join-to-filter.iq
copy to sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinSubqueryWithSelectorFilter@join-to-filter@NullHandling=sql.iq
index 590296d4904..1cb08d2f91f 100644
--- 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/testInnerJoinSubqueryWithSelectorFilter@join-to-filter@NullHandling=sql.iq
@@ -1,6 +1,5 @@
-# testLeftJoinSubqueryWithSelectorFilter@join-to-filter case-crc:04e8d03a
-# quidem testcase reason: EQUIV_PLAN
-!set computeInnerJoinCostAsFilter false
+# testInnerJoinSubqueryWithSelectorFilter@join-to-filter@NullHandling=sql case-crc:5c4107c7
+# quidem testcase reason: FILTER_PUSHED_DOWN_FROM_JOIN_CAN_BE_MORE
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
@@ -12,11 +11,7 @@
!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'
-;
+SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc';
+------+-----+
| dim1 | k |
+------+-----+
@@ -25,20 +20,22 @@ WHERE l1.k = 'abc'
(1 row)
!ok
-LogicalJoin(condition=[AND(=($0, $1), =($1, 'abc'))], joinType=[inner])
+LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(dim1=[$1])
LogicalTableScan(table=[[druid, foo]])
- LogicalAggregate(group=[{0}])
- LogicalProject(k=[||($0, '')])
- LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalFilter(condition=[=($0, 'abc')])
+ LogicalAggregate(group=[{0}])
+ LogicalProject(k=[||($0, '')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
-DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
+DruidJoin(condition=[=($0, $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])
+ DruidFilter(condition=[=($0, 'abc')])
+ DruidAggregate(group=[{0}], druid=[logical])
+ DruidProject(k=[||($0, '')], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
@@ -76,13 +73,23 @@ DruidJoin(condition=[AND(=($0, $1), =('abc', $1))], joinType=[inner])
"outputName" : "d0",
"outputType" : "STRING"
} ],
+ "having" : {
+ "type" : "filter",
+ "filter" : {
+ "type" : "equals",
+ "column" : "d0",
+ "matchValueType" : "STRING",
+ "matchValue" : "abc"
+ },
+ "finalize" : true
+ },
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
- "condition" : "((\"dim1\" == \"j0.d0\") && ('abc' == \"j0.d0\"))",
+ "condition" : "(\"dim1\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_disabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_disabled@NullHandling=default.iq
new file mode 100644
index 00000000000..e877cf70afb
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_disabled@NullHandling=default.iq
@@ -0,0 +1,115 @@
+# testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_disabled@NullHandling=default case-crc:c0bbdf34
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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
+FROM foo
+INNER JOIN lookup.lookyloo l ON foo.dim2 = l.k
+INNER JOIN lookup.lookyloo l2 ON foo.dim2 = l2.k
+WHERE l.v = 'xa'
+LIMIT 100
+;
++------+
+| dim1 |
++------+
+| |
+| 1 |
++------+
+(2 rows)
+
+!ok
+LogicalProject(dim1=[$0])
+ LogicalSort(fetch=[100])
+ LogicalJoin(condition=[=($1, $4)], joinType=[inner])
+ LogicalJoin(condition=[=($1, $2)], joinType=[inner])
+ LogicalProject(dim1=[$1], dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidProject(dim1=[$0], druid=[logical])
+ DruidSort(fetch=[100], druid=[logical])
+ DruidJoin(condition=[=($1, $4)], joinType=[inner])
+ DruidJoin(condition=[=($1, $2)], joinType=[inner])
+ DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "joinType" : "INNER"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "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",
+ "limit" : 100,
+ "columns" : [ "dim1" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+}
+!nativePlan
diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_disabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_disabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..dd6bc7df891
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_disabled@NullHandling=sql.iq
@@ -0,0 +1,116 @@
+# testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_disabled@NullHandling=sql case-crc:c0bbdf34
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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
+FROM foo
+INNER JOIN lookup.lookyloo l ON foo.dim2 = l.k
+INNER JOIN lookup.lookyloo l2 ON foo.dim2 = l2.k
+WHERE l.v = 'xa'
+LIMIT 100
+;
++------+
+| dim1 |
++------+
+| |
+| 1 |
++------+
+(2 rows)
+
+!ok
+LogicalProject(dim1=[$0])
+ LogicalSort(fetch=[100])
+ LogicalJoin(condition=[=($1, $4)], joinType=[inner])
+ LogicalJoin(condition=[=($1, $2)], joinType=[inner])
+ LogicalProject(dim1=[$1], dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidProject(dim1=[$0], druid=[logical])
+ DruidSort(fetch=[100], druid=[logical])
+ DruidJoin(condition=[=($1, $4)], joinType=[inner])
+ DruidJoin(condition=[=($1, $2)], joinType=[inner])
+ DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "joinType" : "INNER"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "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",
+ "limit" : 100,
+ "columns" : [ "dim1" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+}
+!nativePlan
diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_enabled@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_enabled@NullHandling=default.iq
new file mode 100644
index 00000000000..d32b7d9edd6
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_enabled@NullHandling=default.iq
@@ -0,0 +1,115 @@
+# testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_enabled@NullHandling=default case-crc:a33b5d02
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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
+FROM foo
+INNER JOIN lookup.lookyloo l ON foo.dim2 = l.k
+INNER JOIN lookup.lookyloo l2 ON foo.dim2 = l2.k
+WHERE l.v = 'xa'
+LIMIT 100
+;
++------+
+| dim1 |
++------+
+| |
+| 1 |
++------+
+(2 rows)
+
+!ok
+LogicalProject(dim1=[$0])
+ LogicalSort(fetch=[100])
+ LogicalJoin(condition=[=($1, $4)], joinType=[inner])
+ LogicalJoin(condition=[=($1, $2)], joinType=[inner])
+ LogicalProject(dim1=[$1], dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidProject(dim1=[$0], druid=[logical])
+ DruidSort(fetch=[100], druid=[logical])
+ DruidJoin(condition=[=($1, $4)], joinType=[inner])
+ DruidJoin(condition=[=($1, $2)], joinType=[inner])
+ DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "selector",
+ "dimension" : "v",
+ "value" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "joinType" : "INNER"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "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",
+ "limit" : 100,
+ "columns" : [ "dim1" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+}
+!nativePlan
diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_enabled@NullHandling=sql.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_enabled@NullHandling=sql.iq
new file mode 100644
index 00000000000..998268eebef
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_enabled@NullHandling=sql.iq
@@ -0,0 +1,116 @@
+# testInnerJoinTableLookupLookupWithFilterWithOuterLimit@all_enabled@NullHandling=sql case-crc:a33b5d02
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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
+FROM foo
+INNER JOIN lookup.lookyloo l ON foo.dim2 = l.k
+INNER JOIN lookup.lookyloo l2 ON foo.dim2 = l2.k
+WHERE l.v = 'xa'
+LIMIT 100
+;
++------+
+| dim1 |
++------+
+| |
+| 1 |
++------+
+(2 rows)
+
+!ok
+LogicalProject(dim1=[$0])
+ LogicalSort(fetch=[100])
+ LogicalJoin(condition=[=($1, $4)], joinType=[inner])
+ LogicalJoin(condition=[=($1, $2)], joinType=[inner])
+ LogicalProject(dim1=[$1], dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidProject(dim1=[$0], druid=[logical])
+ DruidSort(fetch=[100], druid=[logical])
+ DruidJoin(condition=[=($1, $4)], joinType=[inner])
+ DruidJoin(condition=[=($1, $2)], joinType=[inner])
+ DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
+ DruidTableScan(table=[[druid, foo]], druid=[logical])
+ DruidFilter(condition=[=($1, 'xa')])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+ DruidProject(k=[$0], druid=[logical])
+ DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
+
+!druidPlan
+{
+ "queryType" : "scan",
+ "dataSource" : {
+ "type" : "join",
+ "left" : {
+ "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" ]
+ },
+ "resultFormat" : "compactedList",
+ "filter" : {
+ "type" : "equals",
+ "column" : "v",
+ "matchValueType" : "STRING",
+ "matchValue" : "xa"
+ },
+ "columns" : [ "k", "v" ],
+ "columnTypes" : [ "STRING", "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+ }
+ },
+ "rightPrefix" : "j0.",
+ "condition" : "(\"dim2\" == \"j0.k\")",
+ "joinType" : "INNER"
+ },
+ "right" : {
+ "type" : "lookup",
+ "lookup" : "lookyloo"
+ },
+ "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",
+ "limit" : 100,
+ "columns" : [ "dim1" ],
+ "columnTypes" : [ "STRING" ],
+ "granularity" : {
+ "type" : "all"
+ },
+ "legacy" : false
+}
+!nativePlan
diff --git a/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@default@NullHandling=default.iq b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@default@NullHandling=default.iq
new file mode 100644
index 00000000000..4fc3cf4d651
--- /dev/null
+++ b/sql/src/test/quidem/org.apache.druid.sql.calcite.DecoupledPlanningCalciteJoinQueryTest/testInnerJoinTableLookupLookupWithFilterWithOuterLimit@default@NullHandling=default.iq
@@ -0,0 +1,112 @@
+# testInnerJoinTableLookupLookupWithFilterWithOuterLimit@default@NullHandling=default case-crc:1e1b5255
+# quidem testcase reason: SLIGHTLY_WORSE_FILTER_PUSHED_TO_JOIN_OPERAND
+!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
+FROM foo
+INNER JOIN lookup.lookyloo l ON foo.dim2 = l.k
+INNER JOIN lookup.lookyloo l2 ON foo.dim2 = l2.k
+WHERE l.v = 'xa'
+LIMIT 100
+;
++------+
+| dim1 |
++------+
+| |
+| 1 |
++------+
+(2 rows)
+
+!ok
+LogicalProject(dim1=[$0])
+ LogicalSort(fetch=[100])
+ LogicalJoin(condition=[=($1, $4)], joinType=[inner])
+ LogicalJoin(condition=[=($1, $2)], joinType=[inner])
+ LogicalProject(dim1=[$1], dim2=[$2])
+ LogicalTableScan(table=[[druid, foo]])
+ LogicalFilter(condition=[=($1, 'xa')])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+ LogicalProject(k=[$0])
+ LogicalTableScan(table=[[lookup, lookyloo]])
+
+!logicalPlan
+DruidProject(dim1=[$0], druid=[logical])
+ DruidSort(fetch=[100], druid=[logical])
+ DruidJoin(condition=[=($1, $4)], joinType=[inner])
+ DruidJoin(condition=[=($1, $2)], joinType=[inner])
... 39363 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org