@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:
[x] been self-reviewed.
[x] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
@amaechler found out that when an invalid period is specified to the
TIME_FLOOR
function, theDruidException
thrown by the Calcite planner targets theADMIN
persona rather thanUSER
. 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: