-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[Java][JDBC] Converting TIMESTAMP_WITH_TIMEZONE #37021
Comments
Nvm, I figured it out. The issue is we were still using By passing the same custom Would it make sense to make a bug report for the behavior discrepancy between |
Yes, we should error instead of silently dropping a field; and we should support TIMESTAMP WITH TIMEZONE if possible, though I wonder if the semantics are consistent enough between vendors to allow this. (I ran into this with ADBC: you can't add your own converters, so I was considering forking arrow-jdbc for that...) |
Cool that makes sense! I've been digging more into this and I'm a bit confused. It seems like the default is to set the timezone associated with the Shouldn't the TZ be
I tried doing this but then I got an error in
it seems to me like that should be
It's a little weird because you can specify the converter but not the consumer, but the consumer seems to be coupled to the default converter. I'd be happy to start a PR for either:
|
#36519 might be related? The timestamp handling is iffy in general. Any/all of those 3 would be welcome. |
Hmmm that's interesting! I think it's related, although that's about handling timestamps client-side on the driver. The issue here is in the conversion from a JDBC ResultSet. I'll put up a PR with what I think should be the correct behavior, but this might affect the other conversation since it affects what is returned to the driver if using this conversion on the server side. |
### Rationale for this change This was discussed in [this thread](#37021 (comment)). The `getConsumer` implementation depends on the implementation for `getArrowTypeFromJdbcType`, especially for timestamp objects. Since we can provide a different implementation for `JdbcToArrowTypeConverter` it follows we should be able to provide a different implementation for `JdbcConsumerGetter` ### What changes are included in this PR? Adds a way to configure an alternate `JdbcToArrowUtils.getConsumer` function through `JdbcToArrowConfigBuilder.setJdbcConsumerGetter`. It also throws a more helpful exception from the default implementations when a provided type is not mapped. ### Are these changes tested? No, the default behavior remains unchanged. * Related: #37021 * Closes: #37021 Authored-by: Diego Fernandez <aiguo.fernandez@gmail.com> Signed-off-by: David Li <li.davidm96@gmail.com>
Ah - do you mind opening a separate issue for the other PR? |
### Rationale for this change This was discussed in [this thread](apache#37021 (comment)). The `getConsumer` implementation depends on the implementation for `getArrowTypeFromJdbcType`, especially for timestamp objects. Since we can provide a different implementation for `JdbcToArrowTypeConverter` it follows we should be able to provide a different implementation for `JdbcConsumerGetter` ### What changes are included in this PR? Adds a way to configure an alternate `JdbcToArrowUtils.getConsumer` function through `JdbcToArrowConfigBuilder.setJdbcConsumerGetter`. It also throws a more helpful exception from the default implementations when a provided type is not mapped. ### Are these changes tested? No, the default behavior remains unchanged. * Related: apache#37021 * Closes: apache#37021 Authored-by: Diego Fernandez <aiguo.fernandez@gmail.com> Signed-off-by: David Li <li.davidm96@gmail.com>
Describe the usage question you have. Please include as many useful details as possible.
Error description
We have a Java FlightServer for Arrow Flight SQL that connects to various types of datawarehouses through JDBC and converts the results into arrow to send back using
sqlToArrowVectorIterator
. Everything has been working pretty well, but we just ran into some issues withTIMESTAMP_TZ
columns on Snowflake.We were getting the following exception (redacted):
After digging around, I noticed we were getting back a JDBC type
TIMESTAMP_WITH_TIMEZONE
(2014) which wasn't mapped by the default converterJdbcToArrowUtils.getArrowTypeFromJdbcType
. I created my own converter that mapped that type the same way it mapsTIMESTAMP
to get me unblocked (figured I'd deal with the TZ issue later). Now I don't get the exception, but theTIMESTAMP_WITH_TIMEZONE
is excluded from the results. For example here's how I set up the data in Snowflake:And here's what I get when I query through Dbeaver using the AFS JDBC driver through our service:
Debugging attempts
My attempts at debugging this have yielded very strange results:
VectorSchemaRoot
looks correct:acceptPutPreparedStatementUpdate
call, which we haven't implemented so it fails.My guess is that this is a bug on the JDBC driver, but as far as that's concerned the 2 vectors are of the same type, so I don't see why it would just drop one column.
Any help would be greatly appreciated!
Component(s)
Java
The text was updated successfully, but these errors were encountered: