zachjsh commented on code in PR #15836:
URL: https://github.com/apache/druid/pull/15836#discussion_r1483698824
##########
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java:
##########
@@ -96,28 +104,61 @@ public static Granularity
convertSqlNodeToGranularityThrowingParseExceptions(Sql
}
/**
- * This method is used to extract the granularity from a SqlNode
representing following function calls:
- * 1. FLOOR(__time TO TimeUnit)
- * 2. TIME_FLOOR(__time, 'PT1H')
+ * This method is used to extract the granularity from a SqlNode which
represents
+ * the argument to the {@code PARTITIONED BY} clause. The node can be any of
the following:
+ * <ul>
+ * <li>A literal with a string that matches the SQL keywords
+ * {@code HOUR, DAY, MONTH, YEAR, ALL [TIME]}</li>
+ * <li>A literal string with a period in ISO 8601 format.</li>
Review Comment:
Good catch, added tests, and added the proper functionality to make this
work.
##########
sql/src/test/resources/calcite/expected/ingest/insertWithClusteredBy-logicalPlan.txt:
##########
@@ -1,4 +1,4 @@
-LogicalInsert(target=[druid.dst], partitionedBy=[{type=period, period=P1D,
timeZone=UTC, origin=null}], clusteredBy=[2, `dim1`, CEIL(`m2`)])
+LogicalInsert(target=[druid.dst], partitionedBy=[FLOOR(`__time` TO DAY)],
clusteredBy=[2, `dim1`, CEIL(`m2`)])
Review Comment:
added
--
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]