[
https://issues.apache.org/jira/browse/CALCITE-6284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Nieradzik updated CALCITE-6284:
-----------------------------------
Description:
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}
This throws a {{ClassCastException}} which should be a more user-friendly
message.
Discussion: [https://github.com/apache/calcite/pull/3687]{{{{}}{}}}
was:
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");
}
}
This throws a {{ClassCastException}} which should be a more user-friendly
message.
Discussion: https://github.com/apache/calcite/pull/3687{{{}{}}}
> 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
> Priority: Major
>
> 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}
> This throws a {{ClassCastException}} which should be a more user-friendly
> message.
> Discussion: [https://github.com/apache/calcite/pull/3687]{{{{}}{}}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)