Type Discrepancies between PreparedStatement, and row RelDataType

2025-03-21 Thread Chris Dennis
Hi All,

Trying to figure out what’s amiss in my Calcite based driver and whether there 
are bugs in this area in Avatica/Calcite or if I’m using something wrong.

I have a table in a database that reports its columns as: JavaType(long) NOT 
NULL (BIGINT), JavaType(class java.lang.Character) (CHAR)

I then build a prepared statement against the same connection: INSERT INTO foo 
(KEY, \"character\") values (?, ?)
The parameter metadata reports the parameter types as: java.lang.Object 
(BIGINT). java.lang.Object (CHAR)
The Enumerable node that is input to my adapters part of the graph reports its 
row type as: RecordType(JavaType(class java.lang.Long) KEY, JavaType(class 
java.lang.Character) character)

At code generation I’m then presented with a field that claims it’s a 
java.lang.Character, but at runtime I get a ClassCastException because 
arbitrary java types (notably Strings) are getting all the way through from the 
JDBC PreparedStatement unmodified. My understanding of the JDBC spec says that 
the parameter values should get converted, at but it’s not clear to me who’s 
responsibility that is.

Anyone have any thoughts on where I should look first?

Thanks,

Chris



[jira] [Created] (CALCITE-6906) Support ClickHouse Dialect with cube with syntax

2025-03-21 Thread Yu Xu (Jira)
Yu Xu created CALCITE-6906:
--

 Summary: Support ClickHouse Dialect with cube with syntax
 Key: CALCITE-6906
 URL: https://issues.apache.org/jira/browse/CALCITE-6906
 Project: Calcite
  Issue Type: Improvement
  Components: core
Affects Versions: 1.39.0
Reporter: Yu Xu
Assignee: Yu Xu
 Fix For: 1.40.0


Currently ClickHouse dialect not support group by ... with cube syntax,but in 
ClickHouse it support it which can refer 
to:[https://clickhouse.com/docs/sql-reference/statements/select/group-by]

at the same time I had test the syntax from earlier version 18.0 ~ latest all 
support the syntax,

eg:

select * from (select 1 as a,2 as b,3 as c from system.numbers  limit 1) a 
group by a,b,c with CUBE;

result:

1    2    3
1    2    0
1    0    3
1    0    0
0    2    3
0    2    0
0    0    3
0    0    0

 

so we need to support it in Caclite.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (CALCITE-6905) Comparing string and int produce exception

2025-03-21 Thread Alexander Drugov (Jira)
Alexander Drugov created CALCITE-6905:
-

 Summary: Comparing string and int produce exception
 Key: CALCITE-6905
 URL: https://issues.apache.org/jira/browse/CALCITE-6905
 Project: Calcite
  Issue Type: Bug
Affects Versions: 1.39.0
Reporter: Alexander Drugov


With java class
{code:java}
public class Employee {
  public String id
  ...
}{code}
{code:sql}
select * from employees e where e.id = 1{code}
This query produce {_}java.lang.NoSuchMethodException: 
org.apache.calcite.runtime.SqlFunctions.eq(java.lang.String, int){_}. But this 
worked at 1.38 version.

 

However I successfully can execute:
{code:sql}
with t as (
  select '123' id
)
select id from t where id = 123
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)