apache / druid

Apache Druid: a high performance real-time analytics database.
https://druid.apache.org/
Apache License 2.0
13.43k stars 3.69k forks source link

Fix malformed period throwing `ADMIN` persona error #16626

Closed abhishekrb19 closed 3 months ago

abhishekrb19 commented 3 months ago

@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: