[
https://issues.apache.org/jira/browse/CALCITE-6284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18106850#comment-18106850
]
Yu Xu edited comment on CALCITE-6284 at 8/22/26 4:24 AM:
---------------------------------------------------------
Fixed in
[https://github.com/apache/calcite/commit/eb22ac43ffc4cfc0b2e14d2b71657d5cc71e04e7]
Thank you reported the issue [~tnieradzik]
Thank you for the review [~mbudiu] [~jensen]
was (Author: JIRAUSER307770):
Fixed in
[https://github.com/apache/calcite/commit/eb22ac43ffc4cfc0b2e14d2b71657d5cc71e04e7]
Thank you for the review [~mbudiu] [~jensen]
> Invalid conversion triggers ClassCastException
> ----------------------------------------------
>
> Key: CALCITE-6284
> URL: https://issues.apache.org/jira/browse/CALCITE-6284
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Tim Nieradzik
> Assignee: Yu Xu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.43.0
>
>
> 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:
> {code:java}
> @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");
> }
> } {code}
> Implement a validation with a more user-friendly message.
> See also [GitHub
> discussion|https://github.com/apache/calcite/pull/3687#discussion_r1489891786].
--
This message was sent by Atlassian Jira
(v8.20.10#820010)