You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Low Risk
Small, localized behavior change limited to hasValue edge cases (unknown columns/out-of-range indices) plus added test coverage.
Overview
Fixes hasValue() in the v2 client to be non-throwing when callers ask for a column that doesn’t exist.
AbstractBinaryFormatReader.hasValue(int) now bounds-checks indices, and hasValue(String) (plus MapBackedRecord.hasValue(int)) catches NoSuchColumnException and returns false instead of propagating an error. Adds an integration test covering missing column names/indices and nullable column behavior for both the binary reader and queryAll record path.
Written by Cursor Bugbot for commit 05ff371. This will update automatically on new commits. Configure here.
The reason will be displayed to describe this comment to others. Learn more.
if we have hasColumn then it will be two methods call.
we need something like nameToColumnIndexSafe(), WDYT?
But this I think overloads interface a bit.
returning -1 by schema.nameToColumnIndex() also looks not a java way.
Idea behind exception is that application code should know what number of columns are in the result:
we let application access schema to check dynamically
or application knows it upfront
so checking value for missing column look more like a bug in application.
The reason will be displayed to describe this comment to others. Learn more.
Using an exception has a little bit performance penalty.
Two methods call, are you worried about performance?
In general, we need to specify the expected behavior of our API. I prefer not use exceptions if we can avoid
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-Fixes issue with hasValue when it throws exception for unknown column
Closes #2755
Checklist
Delete items not relevant to your PR:
Note
Low Risk
Small, localized behavior change limited to
hasValueedge cases (unknown columns/out-of-range indices) plus added test coverage.Overview
Fixes
hasValue()in the v2 client to be non-throwing when callers ask for a column that doesn’t exist.AbstractBinaryFormatReader.hasValue(int)now bounds-checks indices, andhasValue(String)(plusMapBackedRecord.hasValue(int)) catchesNoSuchColumnExceptionand returnsfalseinstead of propagating an error. Adds an integration test covering missing column names/indices and nullable column behavior for both the binary reader andqueryAllrecord path.Written by Cursor Bugbot for commit 05ff371. This will update automatically on new commits. Configure here.