googleapis / googleapis/google-cloud-java

[java-bigquery] [BigQuery] BigQueryResultSet mangles the data type when calling getLong with a column index

Đang mở
#12,147 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: bigquery priority: p3
Ngôn ngữ chính
Java
Star
2.1k
Fork
1.2k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
154

Mô tả

I tested this on both Mac OS X Sonoma 14.7.7 and Rocky Linux 8 (4.18.0-553.16.1.el8_10.cloud.0.1.x86_64), using OpenJDK 21.0.7 on both. This was using the google-cloud-bigquery v2.52.0 API.

When using executeSelect(), if a query uses the Read API (so this does NOT affect small result sets that use the slower API), if you call getLong() with a column index instead of a column name, it will incorrectly interpret that data as an Integer (int) instead, resulting in the mangling of data for values larger than 2,147,483,647.

The problematic code is here: https://github.com/googleapis/java-bigquery/blob/13894df2d920930319660b220d13a2628ba705c6/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java#L478

That shouldn't be calling getInt() with the column name, it should be calling getLong() with the column name.

#### Steps to reproduce

1. Use the executeSelect() API to run a query with INTEGER fields containing large values (higher than 2,147,483,647), returning a large result set (400,000 rows is adequate). Iterate over the ResultSet.
2. Use getLong() with a column index to retrieve those integer fields.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.