Skip to content

fix(bigquery): resultSet.getLong() does not truncate for large int64 values#13718

Open
mahitha-ada wants to merge 4 commits into
googleapis:mainfrom
mahitha-ada:fix-bigquery-getlong-int64
Open

fix(bigquery): resultSet.getLong() does not truncate for large int64 values#13718
mahitha-ada wants to merge 4 commits into
googleapis:mainfrom
mahitha-ada:fix-bigquery-getlong-int64

Conversation

@mahitha-ada

Copy link
Copy Markdown

Fixes #12938

This fixes BigQueryResultImpl.ResultSet#getLong(int) for Read API rows. The index-based getter previously delegated to getInt(String), which truncated large INT64 values and could return negative results.

A regression test now verifies that getLong(int) preserves a value larger than Integer.MAX_VALUE.

Tests:

  • mvn -pl java-bigquery/google-cloud-bigquery -Dtest=BigQueryResultImplTest -DskipITs=true test

@mahitha-ada mahitha-ada requested review from a team as code owners July 9, 2026 13:22
@google-cla

google-cla Bot commented Jul 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a bug in BigQueryResultImpl.getLong(int columnIndex) where it incorrectly called getInt instead of getLong when retrieving data from the Read API (Arrow), which could lead to truncation of 64-bit integer values. A unit test has been added to verify that large INT64 values are correctly preserved when retrieved by column index. There are no review comments, so no feedback is provided.

@lqiu96 lqiu96 changed the title fix: preserve BigQuery getLong int64 values fix(bigquery): resultSet.getLong() does not truncate for large int64 values Jul 9, 2026
@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 9, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 9, 2026
@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 9, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 9, 2026
@lqiu96

lqiu96 commented Jul 9, 2026

Copy link
Copy Markdown
Member

/gcbrun

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.

[google-cloud-bigquery] getLong(int) in BigQueryResultImpl returns int

3 participants