FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-858: Fix error handling in CompositeJdbcConsumer by aiguofer · Pull Request #857 · apache/arrow-java · GitHub

GH-858: Fix error handling in CompositeJdbcConsumer - #857

Merged
lidavidm merged 2 commits into
apache:mainfrom
aiguofer:fix_composite_consumer_exception_handling
Sep 25, 2025
Merged

GH-858: Fix error handling in CompositeJdbcConsumer#857
lidavidm merged 2 commits into
apache:mainfrom
aiguofer:fix_composite_consumer_exception_handling

Conversation

aiguofer commented Sep 24, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

What's Changed

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)

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.

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)
```
aiguofer changed the title Fix error handling in CompositeJdbcConsumer GH-858 Fix error handling in CompositeJdbcConsumer Sep 24, 2025
aiguofer changed the title GH-858 Fix error handling in CompositeJdbcConsumer GH-858: Fix error handling in CompositeJdbcConsumer Sep 24, 2025

lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why not just vector.getField()? That'd be even better (you get the field name and type)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm going to guess the original author relied a little too hard on IDE autocomplete and saw getMinorType but not getField

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

ah, oops, sorry about that 😬

To be fair, I do think it's weird that we have a getMinorType but not a getType

lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks!

lidavidm merged commit ec3a424 into apache:main Sep 25, 2025
18 of 24 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception thrown while handling exception in CompositeJdbcConsumer

2 participants


Back | FazBrowse Home | New Git URL