Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
When passing an incompatible value (e.g. string) to a numeric parameter (e.g. TINYINT) via a prepared statement, a ClassCastException is thrown.
Test case:
@Test void bindStringParameter() { for (SqlTypeName tpe : SqlTypeName.INT_TYPES) { final String sql = "with cte as (select cast(100 as " + tpe.getName() + ") as empid)" + "select * from cte where empid = ?"; CalciteAssert.hr() .query(sql) .consumesPreparedStatement(p -> { p.setString(1, "100"); }) .returnsUnordered("EMPID=100"); } }
Implement a validation with a more user-friendly message.
See also GitHub discussion.
Attachments
Issue Links
- relates to
-
CALCITE-6265 Type coercion is failing for numeric values in prepared statements
- Closed