somu-imply commented on code in PR #13799:
URL: https://github.com/apache/druid/pull/13799#discussion_r1126754201


##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidCorrelateUnnestRel.java:
##########
@@ -136,13 +140,22 @@ public DruidQuery toDruidQuery(boolean 
finalizeAggregations)
     final DruidRel<?> druidQueryRel = (DruidRel<?>) left;
     final DruidQuery leftQuery = 
Preconditions.checkNotNull((druidQueryRel).toDruidQuery(false), "leftQuery");
     final DataSource leftDataSource;
+    final PartialDruidQuery partialQueryFromLeft = 
druidQueryRel.getPartialDruidQuery();
+    final PartialDruidQuery corrPartialQuey;
+
+    // If there is a LIMIT in the left query
+    // It should be honored before unnest
+    // Create a query data source in that case

Review Comment:
   Yes we have a test case, the query is like
   `SELECT d3 FROM (select * from druid.numfoo where dim2 IN 
('a','b','ab','abc') LIMIT 2), UNNEST(MV_TO_ARRAY(dim3)) as unnested (d3)`
   
   Here the limit from the left cannot be applied outside



-- 
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