Skip to content
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

Fix findColumn and get*(String label) methods. #185

Merged
merged 2 commits into from
Dec 20, 2023
Merged

Commits on Dec 19, 2023

  1. Fix findColumn and get*(String label) methods.

    The ResultSet `findColumn` methods (`BQForwardOnlyResultSet.findColumn`,
    `BQScrollableResultSet.findColumn`, and `BQResultSet.findColumn`) called
    `BQResultSetMetadata.getCatalogName` to determine the name of each column
    instead of `BQResultSetMetadata.getColumnLabel`.
    
    This was wrong because `getCatalogName` always returns the BigQuery project ID,
    not the column name.
    
    This bug in turn broke the get methods that are implemented in terms of
    `findColumn`, e.g. `getString(String)`.
    
    This change fixes `findColumn` and adds tests for methods that use it with some
    caveats:
    
    - `BQResultSet` has its findColumn fixed but it's not tested. That's because
    it's unused, even by its tests, which request a `TYPE_SCROLL_INSENSITIVE`
    result set and thus get a `BQScrollableResultSet`.
    
    - `BQScrollableResultSet` only accepts dates and times that can be parsed as
    longs, which disagrees with the more widely used `BQForwardOnlyResultSet`.
    Its date and time accessors are uncovered.
    
    - `getBigDecimal` is excluded because it calls `BigDecimal.setScale`
    without a rounding mode, which no longer works in modern Java. A
    separate change can fix this.
    goomrw committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    cbee724 View commit details
    Browse the repository at this point in the history
  2. Add Javadoc, use common findColumn implementation.

    Addresses code review comments.
    goomrw committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    30350ea View commit details
    Browse the repository at this point in the history