zachjsh commented on code in PR #14441:
URL: https://github.com/apache/druid/pull/14441#discussion_r1239262521
##########
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java:
##########
@@ -302,6 +309,82 @@ public static SqlOrderBy convertClusterByToOrderBy(SqlNode
query, SqlNodeList cl
);
}
+ /**
+ * Return resolved clustered by columns specified to output columns.
+ * For example,
+ * EXPLAIN PLAN FOR
+ * INSERT INTO w000
+ * SELECT
+ * TIME_PARSE("timestamp") AS __time,
+ * page AS page_alias,
+ * FLOOR("cost"),
+ * country,
+ * citName
+ * FROM ...
+ * PARTITIONED BY DAY
+ * CLUSTERED BY 1, 2, 3, cityName
+ *
+ * The above SQL will return the following clusteredBy columns: ["__time",
"page_alias", "FLOOR(\"cost\")", cityName"]
+ * Any ordinal and expression specified in the CLUSTERED BY clause will
resolve to the final output column name.
+ * @param clusteredByNodes List of {@link SqlNode}s representing columns to
be clustered by.
+ * @param sourceNode The select or order by source node.
+ */
+ @Nullable
+ public static List<String>
resolveClusteredByColumnsToOutputColumns(SqlNodeList clusteredByNodes, SqlNode
sourceNode)
Review Comment:
General question about logic here; we seem to constrain the types of
objects, and their child members a lot here, wondering how we know the types
for sure? If they are different types than expected, are we expected to fail
earlier with better error messaging?
--
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]