Skip to content
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 #12580

Conversation

adarshsanjeev
Copy link
Contributor

While processing ingest queries, granularities which are not supported like 2 hours can be passed in the PARTITIONED BY clause. This PR adds a check for this during parsing.

  • Add validation for invalid partitioned by granularities
  • Add unit test

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@@ -159,7 +160,11 @@ public static Granularity convertSqlNodeToGranularity(SqlNode sqlNode) throws Pa
catch (IllegalArgumentException e) {
throw new ParseException(StringUtils.format("%s is an invalid period string", granularitySqlNode.toString()));
}
return new PeriodGranularity(period, null, null);
Granularity granularity = new PeriodGranularity(period, null, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check shouldn't be here, because the method is merely supposed to be converting the given sqlNode to a Granularity. This check should be performed either in the Planner or the DruidSqlInsertNode IMO.

@@ -159,7 +160,11 @@ public static Granularity convertSqlNodeToGranularity(SqlNode sqlNode) throws Pa
catch (IllegalArgumentException e) {
throw new ParseException(StringUtils.format("%s is an invalid period string", granularitySqlNode.toString()));
}
return new PeriodGranularity(period, null, null);
Granularity granularity = new PeriodGranularity(period, null, null);
Copy link
Contributor

@LakshSingla LakshSingla May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check shouldn't be here, because the method is merely supposed to be converting the given sqlNode to a Granularity. This check should be performed either in the Planner, DruidSqlInsertNode or the FTL file IMO.

@cryptoe
Copy link
Contributor

cryptoe commented Aug 17, 2022

@adarshsanjeev can we close this PR as #12589 already addresses this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants