Skip to content

SQL: Use regular filters for time filtering in subqueries.#17173

Merged
abhishekagarwal87 merged 3 commits intoapache:masterfrom
gianm:fix-time-filter-subquery
Sep 27, 2024
Merged

SQL: Use regular filters for time filtering in subqueries.#17173
abhishekagarwal87 merged 3 commits intoapache:masterfrom
gianm:fix-time-filter-subquery

Conversation

@gianm
Copy link
Copy Markdown
Contributor

@gianm gianm commented Sep 26, 2024

Using the "intervals" feature on subqueries, or any non-table, should be avoided because it isn't a meaningful optimization in those cases, and it's simpler for runtime implementations if they can assume all filters are located in the regular filter object.

Two changes:

  1. Fix the logic in DruidQuery.canUseIntervalFiltering. It was intended
    to return false for QueryDataSource, but actually returned true.

  2. Add a validation to ScanQueryFrameProcessor to ensure that when running
    on an input channel (which would include any subquery), the query has
    "intervals" set to ONLY_ETERNITY.

Prior to this patch, the new test case in testTimeFilterOnSubquery would throw a "Can only handle a single interval" error in the native engine, and "QueryNotSupported" in the MSQ engine.

Using the "intervals" feature on subqueries, or any non-table, should be
avoided because it isn't a meaningful optimization in those cases, and
it's simpler for runtime implementations if they can assume all filters
are located in the regular filter object.

Two changes:

1) Fix the logic in DruidQuery.canUseIntervalFiltering. It was intended
   to return false for QueryDataSource, but actually returned true.

2) Add a validation to ScanQueryFrameProcessor to ensure that when running
   on an input channel (which would include any subquery), the query has
   "intervals" set to ONLY_ETERNITY.

Prior to this patch, the new test case in testTimeFilterOnSubquery would
throw a "Can only handle a single interval" error in the native engine,
and "QueryNotSupported" in the MSQ engine.
@gianm gianm added the Bug label Sep 26, 2024
@github-actions github-actions Bot added Area - Batch Ingestion Area - Querying Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Sep 26, 2024
@abhishekagarwal87 abhishekagarwal87 merged commit dc223f2 into apache:master Sep 27, 2024
@abhishekagarwal87 abhishekagarwal87 added this to the 31.0.0 milestone Sep 27, 2024
@gianm gianm deleted the fix-time-filter-subquery branch September 27, 2024 17:23
kfaraz pushed a commit to kfaraz/druid that referenced this pull request Oct 4, 2024
)

* SQL: Use regular filters for time filtering in subqueries.

Using the "intervals" feature on subqueries, or any non-table, should be
avoided because it isn't a meaningful optimization in those cases, and
it's simpler for runtime implementations if they can assume all filters
are located in the regular filter object.

Two changes:

1) Fix the logic in DruidQuery.canUseIntervalFiltering. It was intended
   to return false for QueryDataSource, but actually returned true.

2) Add a validation to ScanQueryFrameProcessor to ensure that when running
   on an input channel (which would include any subquery), the query has
   "intervals" set to ONLY_ETERNITY.

Prior to this patch, the new test case in testTimeFilterOnSubquery would
throw a "Can only handle a single interval" error in the native engine,
and "QueryNotSupported" in the MSQ engine.

* Mark new case as having extra columns in decoupled mode.

* Adjust test.
kfaraz added a commit that referenced this pull request Oct 5, 2024
…) (#17251)

* SQL: Use regular filters for time filtering in subqueries. (#17173)
* RunWorkOrder: Account for two simultaneous statistics collectors. (#17216)
* DartTableInputSpecSlicer: Fix for TLS workers. (#17224)
* Upgrade avro - minor version (#17230)
* SuperSorter: Don't set allDone if it's already set. (#17238)
* Decoupled planning: improve join support (#17039)
---------
Co-authored-by: Gian Merlino <gianmerlino@gmail.com>
Co-authored-by: Abhishek Agarwal <1477457+abhishekagarwal87@users.noreply.github.com>
Co-authored-by: Zoltan Haindrich <kirk@rxd.hu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 Area - Querying Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants