You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current implementation of Spark when working with arrays of data returned from ClickHouse through the clickhouse-java driver, there is a type conversion error. When the driver returns an array of primitive types (e.g., bytes or integers), Spark attempts to cast them to an array of objects, which is not possible in Java and Scala, as arrays of primitives are not subtypes of arrays of objects. This leads to a ClassCastException.
Steps to reproduce
CREATE TABLE statements for tables involved:
CREATETABLEexample_table (
id UInt32,
data Array(Int32)
) ENGINE = MergeTree()
ORDER BY id;
INSERT INTO example_table VALUES (1, [1, 2, 3]), (2, [4, 5, 6]);
At first we implement custom Clickhouse dialect that handles Array(T) because in native Spark, Array(T) is unsupported type
Describe the bug
In the current implementation of Spark when working with arrays of data returned from ClickHouse through the clickhouse-java driver, there is a type conversion error. When the driver returns an array of primitive types (e.g., bytes or integers), Spark attempts to cast them to an array of objects, which is not possible in Java and Scala, as arrays of primitives are not subtypes of arrays of objects. This leads to a
ClassCastException
.Steps to reproduce
CREATE TABLE
statements for tables involved:At first we implement custom Clickhouse dialect that handles
Array(T)
because in native Spark,Array(T)
is unsupported typeExpected behaviour
The driver should return an array of objects instead of an array of primitives to avoid
ClassCastException
in Spark.Code example
Example code snippet in Spark that demonstrates the issue:
Error log
Configuration
Environment
ClickHouse server
clickhouse-server:latest-alpine
The text was updated successfully, but these errors were encountered: