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

Fix malformed period throwing ADMIN persona error #16626

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

abhishekrb19
Copy link
Contributor

@amaechler found out that when an invalid period is specified to the TIME_FLOOR function, the DruidException thrown by the Calcite planner targets the ADMIN persona rather than USER. This is easy to reproduce by running: "SELECT TIME_FLOOR(CURRENT_TIMESTAMP, 'PT1Y')" in the web-console.

This PR fixes the persona by explicitly handling the IllegalArgumentException thrown during the Joda Time period instantiation, and make the exception user-facing. Also, the error message is now decorated with more context.

This PR has:

  • been self-reviewed.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • been tested in a test Druid cluster.

The current exception is targeting the ADMIN persona. Catch that and turn
it into a USER persona instead. Also, provide more context in the error
message.
Copy link
Contributor

@zachjsh zachjsh left a comment

Choose a reason for hiding this comment

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

🚀

…rUtils.java

Co-authored-by: Clint Wylie <cjwylie@gmail.com>
@abhishekrb19 abhishekrb19 merged commit b20c3db into apache:master Jun 20, 2024
87 checks passed
@abhishekrb19 abhishekrb19 deleted the validate_timestamp_period branch June 20, 2024 15:40
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.

None yet

3 participants