commit | 4e6a320bf476c4b3c313d86f8ff3c6edf4c2a578 | [log] [tgz] |
---|---|---|
author | Tim Nieradzik <tim@sparse.tech> | Wed Feb 14 18:13:03 2024 +0200 |
committer | Mihai Budiu <mbudiu@feldera.com> | Mon Apr 08 15:21:14 2024 -0700 |
tree | 4675751c7f554e1142731ab2067ee61e1cee8dd4 | |
parent | 1f5ba75d686b5d7832a59cd5e82777b3527cf70d [diff] |
[CALCITE-6265] Type coercion is failing for numeric values in prepared statements Given a column of type `INT`. When providing a `short` value as a placeholder in a prepared statement, a `ClassCastException` is thrown. Test case: ``` final String sql = "select \"empid\" from \"hr\".\"emps\" where \"empid\" in (?, ?)"; CalciteAssert.hr() .query(sql) .consumesPreparedStatement(p -> { p.setShort(1, (short) 100); p.setShort(2, (short) 110); }) .returnsUnordered("empid=100", "empid=110"); ``` Stack trace: ``` java.lang.ClassCastException: class java.lang.Short cannot be cast to class java.lang.Integer (java.lang.Short and java.lang.Integer are in module java.base of loader 'bootstrap') at Baz$1$1.moveNext(Unknown Source) at org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.<init>(Linq4j.java:679) ```
Apache Calcite is a dynamic data management framework.
It contains many of the pieces that comprise a typical database management system but omits the storage primitives. It provides an industry standard SQL parser and validator, a customisable optimizer with pluggable rules and cost functions, logical and physical algebraic operators, various transformation algorithms from SQL to algebra (and the opposite), and many adapters for executing SQL queries over Cassandra, Druid, Elasticsearch, MongoDB, Kafka, and others, with minimal configuration.
For more details, see the home page.
The project uses JIRA for issue tracking. For further information, please see the JIRA accounts guide.