-
Notifications
You must be signed in to change notification settings - Fork 90
GH-858: Fix error handling in CompositeJdbcConsumer #857
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
GH-858: Fix error handling in CompositeJdbcConsumer #857
Conversation
Turns out not all MinorTypes have a corresponding ArrowType, which can cause the following exception while handling the original exception: ``` Caused by: java.lang.UnsupportedOperationException: Cannot get simple type for type DECIMAL at org.apache.arrow.vector.types.Types$MinorType.getType(Types.java:815) at org.apache.arrow.adapter.jdbc.consumer.CompositeJdbcConsumer.consume(CompositeJdbcConsumer.java:49) ```
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.
Technically this is a breaking change, not that I expect anyone to actually be constructing this exception themselves...
|
||
throw new JdbcConsumerException( | ||
"Exception while consuming JDBC value", e, fieldInfo, arrowType); | ||
"Exception while consuming JDBC value", e, fieldInfo, consumer.vector.getMinorType()); |
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.
Why not just vector.getField()
? That'd be even better (you get the field name and type)
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.
I'm going to guess the original author relied a little too hard on IDE autocomplete and saw getMinorType
but not getField
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.
haha I was the original author! 😂 As long as I've been working with Arrow in Java now, I can't say I fully understand all the different abstractions and their differences, so it's very likely getMinorType
was the only thing I saw in auto-complete related to type
.... But I definitely think Field
would be better here! thanks for the suggestion
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.
ah, oops, sorry about that 😬
To be fair, I do think it's weird that we have a getMinorType
but not a getType
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.
Thanks!
What's Changed
Turns out not all MinorTypes have a corresponding ArrowType, which can cause the following exception while handling the original exception:
This PR changes the value we store in the exception to be the
MinorType
instead so we can still get useful info about the type but avoiding this possible exception.Closes #858.