-
Notifications
You must be signed in to change notification settings - Fork 615
[jdbc-v2] Convert Clickhouse Array(T) to Java T[] instead of Object[]
#2627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ResultSetImpl.getObject() returns T[] instead of Object[] for array columnsResultSetImpl.getObject() returns T[] instead of Object[] for array columns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🤙
💡 To request another review, post a new comment with "/windsurf-review".
…t[]` for array columns
f5d3319 to
e117cb3
Compare
|
Good day, @dolfinus ! However There is a |
|
else if (type != java.sql.Array.class && value instanceof List<?>The only thing changed there is that generic Object[] replaced with T[]. |
|
@dolfinus |
ResultSetImpl.getObject() returns T[] instead of Object[] for array columnsArray(T) to Java T[] instead of Object[]
|
Thanks! |
Summary
I've faced an issue when reading
Array(Decimal)with clickhouse-jdbc 0.9.2 and Spark 3.5.7 - instead of converting values to Spark'sDecimalType, it failed with exception:This is because
JdbcUtils.convert(value, java.math.BigDecimal.class, column)returnsObject[], and Java doesn't allow casts like those:Even if each item of array is actually a
BigDecimal.Now this method returns
BigDecimal[]for these arguments. This requires some reflection usage to constructT[]with T known only in runtime.I haven't run integration tests on this yet.
Checklist
Delete items not relevant to your PR:
Object[]#2457