FrankChen021 opened a new pull request, #20328:
URL: https://github.com/apache/druid/pull/20328

   ### Description
   
   Malformed timestamp strings can sometimes be evaluated to a Joda timestamp 
but fail when converted back to Calcite's timestamp representation. The 
resulting `IllegalArgumentException` was classified as an uncategorized server 
error and returned as HTTP 500.
   
   This PR catches conversion failures only while reducing TIMESTAMP constants 
and maps them to the existing `InvalidSqlInput` contract. Invalid constants now 
return HTTP 400 with an error such as:
   
   ```
   Invalid TIMESTAMP constant [CAST('20260-09-11 00:00:00'):TIMESTAMP(3) NOT 
NULL]
   ```
   
   Other planner and runtime exceptions retain their existing classification.
   
   #### Release note
   
   Invalid SQL timestamp constants that cannot be represented by Calcite now 
return HTTP 400 (`invalidInput`) instead of an uncategorized HTTP 500 response.
   
   <hr>
   
   ##### Key changed/added classes in this PR
   
   * `DruidRexExecutor`
   * `CalciteQueryTest`
   * `SqlResourceTest`
   
   <hr>
   
   This PR has:
   
   - [x] been self-reviewed.
   - [x] a release note entry in the PR description.
   - [x] added or updated unit tests to cover new code paths.
   
   Tests:
   
   ```
   mvn test -pl sql 
-Dtest="org.apache.druid.sql.http.SqlResourceTest#testInvalidTimestampLiteral,org.apache.druid.sql.calcite.CalciteQueryTest#testCountStarWithTimeFilterUsingStringLiteralsInvalid_isUnplannable"
 -Pskip-static-checks -Dweb.console.skip=true -T1C
   mvn test -pl sql 
-Dtest="org.apache.druid.sql.calcite.planner.DruidRexExecutorTest" 
-Pskip-static-checks -Dweb.console.skip=true -T1C
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to