You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "clintropolis (via GitHub)" <gi...@apache.org> on 2023/03/07 13:38:21 UTC

[GitHub] [druid] clintropolis commented on a diff in pull request #13892: Various changes and fixes to UNNEST.

clintropolis commented on code in PR #13892:
URL: https://github.com/apache/druid/pull/13892#discussion_r1127821972


##########
sql/src/main/java/org/apache/druid/sql/calcite/rule/DruidCorrelateUnnestRule.java:
##########
@@ -44,134 +51,168 @@
  * This class creates the rule to abide by for creating correlations during unnest.
  * Typically, Calcite plans the unnest query such as
  * SELECT * from numFoo, unnest(dim3) in the following way:
+ *
+ * <pre>
  * 80:LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3}])
  *   6:LogicalTableScan(subset=[rel#74:Subset#0.NONE.[]], table=[[druid, numfoo]])
  *   78:Uncollect(subset=[rel#79:Subset#3.NONE.[]])
  *     76:LogicalProject(subset=[rel#77:Subset#2.NONE.[]], EXPR$0=[MV_TO_ARRAY($cor0.dim3)])
  *       7:LogicalValues(subset=[rel#75:Subset#1.NONE.[0]], tuples=[[{ 0 }]])
+ * </pre>
  *
- *  {@link DruidUnnestDatasourceRule} takes care of the Uncollect(last 3 lines) to generate a {@link DruidUnnestDatasourceRel}
- *  thereby reducing the logical plan to:
+ * {@link DruidUnnestRule} takes care of the Uncollect(last 3 lines) to generate a {@link DruidUnnestRel}
+ * thereby reducing the logical plan to:
+ * <pre>
  *        LogicalCorrelate
  *           /       \
  *      DruidRel    DruidUnnestDataSourceRel

Review Comment:
   nit: this javadoc needs updated i suppose



##########
sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/CastOperatorConversion.java:
##########
@@ -76,6 +76,8 @@ public class CastOperatorConversion implements SqlOperatorConversion
       builder.put(type, ExprType.LONG);
     }
 
+    builder.put(SqlTypeName.ARRAY, ExprType.ARRAY);

Review Comment:
   this isn't probably that cool because it loses the array element type. I think maybe #13890 has a better solution for this by switching cast to use `Calcites.getColumnTypeForRelDataType`



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org