jon-wei commented on a change in pull request #8566: Upgrade Calcite to 1.21
URL: https://github.com/apache/incubator-druid/pull/8566#discussion_r348862757
##########
File path:
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java
##########
@@ -232,6 +242,45 @@ public void cleanup(EnumeratorIterator iterFromMake)
}
}
+ /**
+ * This method wraps the root with a logical sort that applies a limit (no
ordering change).
+ * The CTX_SQL_OUTER_LIMIT flag that controls this wrapping is meant for
internal use only by the
+ * web console, allowing it to apply a limit to queries without rewriting
the original SQL.
+ *
+ * @param root root node
+ * @return root node wrapped with a limiting logical sort if a limit is
specified in the query context.
+ */
+ @Nullable
+ private RelNode possiblyWrapRootWithOuterLimitFromContext(
+ RelRoot root
+ )
+ {
+ Object outerLimitObj =
plannerContext.getQueryContext().get(PlannerContext.CTX_SQL_OUTER_LIMIT);
+ if (outerLimitObj == null) {
+ return root.rel;
+ }
+ Long outerLimit = DimensionHandlerUtils.convertObjectToLong(outerLimitObj,
true);
Review comment:
Collapsed the two calls
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]