FrankChen021 commented on code in PR #20607:
URL: https://github.com/apache/druid/pull/20607#discussion_r4294665747


##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java:
##########
@@ -834,7 +839,7 @@ static Pair<DataSource, Filtration> getFiltration(
 
     // Time filters within the datasource narrow the query intervals too, 
which lets the broker prune segments.
     final Filtration queryFiltration =
-        Filtration.create(filter, getBaseIntervals(dataSource, 
rowSignature)).optimize(rowSignature);
+        Filtration.create(filter, getBaseIntervals(dataSource, timeCondition, 
rowSignature)).optimize(rowSignature);

Review Comment:
   [P1] Context is ignored for policy-wrapped tables
   
   **Finding:** Native SQL applies policies before this method, representing 
protected tables as RestrictedDataSource. ExecutionVertex.isTableBased() 
returns false for that wrapper, so the early return bypasses the new 
timeCondition interval and the native engine reads outside the requested window.
   
   **Suggestion:** Treat RestrictedDataSource as table-based for interval 
filtering, and add a restricted-table regression test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to