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


##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidOuterQueryRel.java:
##########
@@ -116,12 +114,20 @@ public DruidQuery toDruidQuery(final boolean 
finalizeAggregations)
   @Override
   public DruidQuery toDruidQueryForExplaining()
   {
+    final RowSignature sourceRowSignature;
+    if (sourceRel instanceof DruidRel) {
+      final DruidQuery subQuery = ((DruidRel) 
sourceRel).toDruidQueryForExplaining();
+      sourceRowSignature = subQuery.getOutputRowSignature();
+    } else {
+      // fallback for cases other than group by inner query with order by with 
alias on __time column
+      sourceRowSignature = RowSignatures.fromRelDataType(
+          sourceRel.getRowType().getFieldNames(),
+          sourceRel.getRowType()

Review Comment:
   This was a case encountered during aliasing. If a query was specified with 
an alias say for example `select __time as t, dim1 as d from foo` for the inner 
query the field name was changing to `t` from `__time` for that reason the 
fallback was used. https://github.com/apache/druid/pull/12418 should have some 
more details



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