paul-rogers commented on code in PR #12636:
URL: https://github.com/apache/druid/pull/12636#discussion_r922484615


##########
sql/src/main/java/org/apache/druid/sql/calcite/view/DruidViewMacro.java:
##########
@@ -58,7 +58,8 @@ public TranslatableTable apply(final List<Object> arguments)
   {
     final RelDataType rowType;
     try (final DruidPlanner planner = plannerFactory.createPlanner(viewSql, 
new QueryContext())) {
-      rowType = planner.plan().rowType();
+      planner.validate();
+      rowType = planner.prepare().getRowType();

Review Comment:
   The state machine added to the planner enforces that authorization is done 
before planning. However, in this context, we have no auth context. So, by 
using prepare instead, we get the information without the need to authorize. 
There is a comment in `DruidPlanner.authorize(.)` which explains the issue.
   
   And, as you point out, the job of prepare is to provide this info: planning 
(to get a physical execution plan) is overkill.



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