Skip to content

GH-734: Improve CompositeJdbcConsumer error handling and add unit tests #778

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Odin-BN
Copy link

@Odin-BN Odin-BN commented May 30, 2025

What's Changed

This PR improves error handling in 'CompositeJdbConsumer' by safely handling null 'ValueVector' and 'ResultSet' values to prevent 'NullPointerException', and return the intended 'JdbcConsumerException'.

How was this tested?

Added two unit tests in 'CompositeJdbcConsumerTest':

  • 'testHandlesJdbcConsumerExceptionGracefully' verifies 'ArrowType' is captured if vector is valid, and returns the 'JdbcConsumerException' even though 'ResultSet' is null (which gave another NullPointerException previously).
  • 'testJdbcConsumerExceptionWhenArrowTypeIsNull' verifies 'ArrowType' is 'null' and returns the 'JdbcConsumerException'.

All tests pass after the change.

Closes #734

This comment has been minimized.

@Odin-BN
Copy link
Author

Odin-BN commented May 30, 2025

@github-actions please add label: bug-fix

@Odin-BN
Copy link
Author

Odin-BN commented May 30, 2025

Hi @lidavidm ! Would you mind adding the "bug-fix" label to this PR please?

I thought maybe the github actions bot could add it automatically with a message, as assigning the issue but it seems that not.

Thanks in advance!

@lidavidm lidavidm added the bug-fix PRs that fix a big. label Jun 2, 2025
@github-actions github-actions bot added this to the 18.4.0 milestone Jun 2, 2025
@lidavidm
Copy link
Member

lidavidm commented Jun 2, 2025

Yeah, usually I label it when I review - maybe I should adjust it so that it's a reminder to reviewers (I originally thought the PR author could add labels...)

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

I'm not sure this addresses the original bug report, which is about when getType throws when we try to get arrowType. If anything, the right fix is to just get the type directly from the vector, rather than indirecting through getMinorType.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix PRs that fix a big.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The real exception was swallowed by another exception in CompositeJdbcConsumer::consume
2 participants