-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validation for invalid partitioned by granularities #12589
Add validation for invalid partitioned by granularities #12589
Conversation
if(!GranularityType.isStandard(granularity)) | ||
{ | ||
throw new IAE("The granularity specified in PARTITIONED BY is not supported. " | ||
+ "Please use a standard granularity."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does standard granularity mean? How does the user know that these are the granularities I can use. _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, does simple granularities seem more appropriate? https://druid.apache.org/docs/latest/querying/granularities.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO I would map GranularityType.values() to period and then use a string Joiner with "," and put that in the exception message.
sql/src/main/codegen/config.fmpp
Outdated
@@ -55,7 +55,9 @@ data: { | |||
"org.apache.calcite.sql.SqlNode" | |||
"org.apache.calcite.sql.SqlInsert" | |||
"org.apache.druid.java.util.common.granularity.Granularity" | |||
"org.apache.druid.java.util.common.granularity.GranularityType" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: do you still need granularity type here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !!
Description
This PR is in continuation to #12580 and rejects the ingest queries with
PARTITIONED BY
granularities that are not supported. For example queries withPARTITIONED BY
clause set toTIME_FLOOR(__time, 'PT2H')
are rejected in the validation layer itself. Unit tests for the same have been added.This PR has: