diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml
index fc078dbe3f..be7c5c0fe1 100644
--- a/.github/sync-repo-settings.yaml
+++ b/.github/sync-repo-settings.yaml
@@ -16,6 +16,7 @@ branchProtectionRules:
- 'Kokoro - Test: Integration'
- cla/google
- javadoc
+ - unmanaged_dependency_check
- pattern: 1.127.12-sp
isAdminEnforced: true
requiredApprovingReviewCount: 1
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
index 1be1c2a32a..1c8355fdac 100644
--- a/.github/workflows/scorecard.yml
+++ b/.github/workflows/scorecard.yml
@@ -67,6 +67,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@6a89f57882288b3d2f190cda65000eec9e9ebb7c # v2.27.0
+ uses: github/codeql-action/upload-sarif@d835c34a7026e284170c41a0a66c956e03f247d0 # v2.27.7
with:
sarif_file: results.sarif
diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml
index 4df9466e7d..f971b05c95 100644
--- a/.github/workflows/unmanaged_dependency_check.yaml
+++ b/.github/workflows/unmanaged_dependency_check.yaml
@@ -17,7 +17,7 @@ jobs:
# repository
.kokoro/build.sh
- name: Unmanaged dependency check
- uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.39.0
+ uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.41.0
with:
# java-bigquery does not produce a BOM. Fortunately the root pom.xml
# defines google-cloud-bigquery in dependencyManagement section. So
diff --git a/.kokoro/continuous/graalvm-native-17.cfg b/.kokoro/continuous/graalvm-native-17.cfg
index 4bc28d0afa..cbccd336a0 100644
--- a/.kokoro/continuous/graalvm-native-17.cfg
+++ b/.kokoro/continuous/graalvm-native-17.cfg
@@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
- value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.39.0"
+ value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.41.0"
}
env_vars: {
diff --git a/.kokoro/continuous/graalvm-native.cfg b/.kokoro/continuous/graalvm-native.cfg
index 33a4a9d957..d9c9d02051 100644
--- a/.kokoro/continuous/graalvm-native.cfg
+++ b/.kokoro/continuous/graalvm-native.cfg
@@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
- value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.39.0"
+ value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.41.0"
}
env_vars: {
diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg
index ba53eb9ce2..80a629d235 100644
--- a/.kokoro/presubmit/graalvm-native-17.cfg
+++ b/.kokoro/presubmit/graalvm-native-17.cfg
@@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
- value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.39.0""
+ value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.41.0""
}
env_vars: {
diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg
index 418a399b75..644bb62ce7 100644
--- a/.kokoro/presubmit/graalvm-native.cfg
+++ b/.kokoro/presubmit/graalvm-native.cfg
@@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
- value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.39.0"
+ value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.41.0"
}
env_vars: {
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac6b1d9e93..9d8f525e2f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,63 @@
# Changelog
+## [2.45.0](https://github.com/googleapis/java-bigquery/compare/v2.44.0...v2.45.0) (2024-12-13)
+
+
+### Features
+
+* Enable Lossless Timestamps in BQ java client lib ([#3589](https://github.com/googleapis/java-bigquery/issues/3589)) ([c0b874a](https://github.com/googleapis/java-bigquery/commit/c0b874aa0150e63908450b13d019864b8cbfbfe3))
+* Introduce `java.time` methods and variables ([#3586](https://github.com/googleapis/java-bigquery/issues/3586)) ([31fb15f](https://github.com/googleapis/java-bigquery/commit/31fb15fb963c18e4c29391e9fe56dfde31577511))
+
+
+### Bug Fixes
+
+* **test:** Update schema for broken ConnImplBenchmark test ([#3574](https://github.com/googleapis/java-bigquery/issues/3574)) ([8cf4387](https://github.com/googleapis/java-bigquery/commit/8cf4387fae22c81d40635b470b216fa4c126d681))
+
+
+### Dependencies
+
+* Update dependency com.google.api.grpc:proto-google-cloud-bigqueryconnection-v1 to v2.56.0 ([#3582](https://github.com/googleapis/java-bigquery/issues/3582)) ([616ee2a](https://github.com/googleapis/java-bigquery/commit/616ee2aa8ccf3d2975274b256252f2f249775960))
+* Update dependency com.google.apis:google-api-services-bigquery to v2-rev20241111-2.0.0 ([#3591](https://github.com/googleapis/java-bigquery/issues/3591)) ([3eef3a9](https://github.com/googleapis/java-bigquery/commit/3eef3a9959bcfdb76c26fdf9069d9acf89f93a7a))
+* Update dependency com.google.apis:google-api-services-bigquery to v2-rev20241115-2.0.0 ([#3601](https://github.com/googleapis/java-bigquery/issues/3601)) ([41f9adb](https://github.com/googleapis/java-bigquery/commit/41f9adbe4235329fa2bbfd0930f4113e63f72e05))
+* Update dependency com.google.cloud:google-cloud-datacatalog-bom to v1.60.0 ([#3583](https://github.com/googleapis/java-bigquery/issues/3583)) ([34dd8bc](https://github.com/googleapis/java-bigquery/commit/34dd8bc22c8188f2b61dc9939b24a8d820548e2b))
+* Update dependency com.google.cloud:sdk-platform-java-config to v3.41.0 ([#3607](https://github.com/googleapis/java-bigquery/issues/3607)) ([11499d1](https://github.com/googleapis/java-bigquery/commit/11499d16727934fd3dfa5c18226e6f20471a11ac))
+* Update github/codeql-action action to v2.27.5 ([#3588](https://github.com/googleapis/java-bigquery/issues/3588)) ([3f94075](https://github.com/googleapis/java-bigquery/commit/3f9407570fea5317aaf212b058ca1da05985eda9))
+* Update github/codeql-action action to v2.27.6 ([#3597](https://github.com/googleapis/java-bigquery/issues/3597)) ([bc1f3b9](https://github.com/googleapis/java-bigquery/commit/bc1f3b97a0c8ccc6e93a07b2f0ebcf8e05da9b48))
+* Update github/codeql-action action to v2.27.7 ([#3603](https://github.com/googleapis/java-bigquery/issues/3603)) ([528426b](https://github.com/googleapis/java-bigquery/commit/528426bf9b7801b1b9b45758b560f14a4c9bbc57))
+
+
+### Documentation
+
+* **bigquery:** Add javadoc description of timestamp() parameter. ([#3604](https://github.com/googleapis/java-bigquery/issues/3604)) ([6ee0c10](https://github.com/googleapis/java-bigquery/commit/6ee0c103771ef678f66cc7a584bdce27e21f29c4))
+
+## [2.44.0](https://github.com/googleapis/java-bigquery/compare/v2.43.3...v2.44.0) (2024-11-17)
+
+
+### Features
+
+* Enable maxTimeTravelHours in BigQuery java client library ([#3555](https://github.com/googleapis/java-bigquery/issues/3555)) ([bd24fd8](https://github.com/googleapis/java-bigquery/commit/bd24fd8c550bfbd1207b194ed5c863a4a9924d48))
+
+
+### Bug Fixes
+
+* Update experimental methods documentation to [@internalapi](https://github.com/internalapi) ([#3552](https://github.com/googleapis/java-bigquery/issues/3552)) ([20826f1](https://github.com/googleapis/java-bigquery/commit/20826f1b08a3cc5bdcce5637b7ea21d467b2bce2))
+
+
+### Dependencies
+
+* Update dependency com.google.api.grpc:proto-google-cloud-bigqueryconnection-v1 to v2.55.0 ([#3559](https://github.com/googleapis/java-bigquery/issues/3559)) ([950ad0c](https://github.com/googleapis/java-bigquery/commit/950ad0cce6370e332a568d3b2e9ef3911503d206))
+* Update dependency com.google.apis:google-api-services-bigquery to v2-rev20241027-2.0.0 ([#3568](https://github.com/googleapis/java-bigquery/issues/3568)) ([b5ccfcc](https://github.com/googleapis/java-bigquery/commit/b5ccfccb552e731ccb09be923715849a4282d44d))
+* Update dependency com.google.cloud:google-cloud-datacatalog-bom to v1.59.0 ([#3561](https://github.com/googleapis/java-bigquery/issues/3561)) ([1bd24a1](https://github.com/googleapis/java-bigquery/commit/1bd24a1ad28d168587b7cba95ec348cb1308a803))
+* Update dependency com.google.cloud:sdk-platform-java-config to v3.40.0 ([#3576](https://github.com/googleapis/java-bigquery/issues/3576)) ([d5fa951](https://github.com/googleapis/java-bigquery/commit/d5fa951b8255ec1bcbcdf9bb3c29f247e38a0c7e))
+* Update github/codeql-action action to v2.27.1 ([#3567](https://github.com/googleapis/java-bigquery/issues/3567)) ([e154ee3](https://github.com/googleapis/java-bigquery/commit/e154ee300485dc9d900343a8b5ceb7f6633bc3ff))
+* Update github/codeql-action action to v2.27.3 ([#3569](https://github.com/googleapis/java-bigquery/issues/3569)) ([3707a40](https://github.com/googleapis/java-bigquery/commit/3707a402039365c49e1976a388593f621231dc02))
+* Update github/codeql-action action to v2.27.4 ([#3572](https://github.com/googleapis/java-bigquery/issues/3572)) ([2c7b4f7](https://github.com/googleapis/java-bigquery/commit/2c7b4f750f4c8bf03c0ba74402d745341382a209))
+
+
+### Documentation
+
+* Fix BigQuery documentation formating ([#3565](https://github.com/googleapis/java-bigquery/issues/3565)) ([552f491](https://github.com/googleapis/java-bigquery/commit/552f49132af370f66aa1ccdde86e6280f638da22))
+
## [2.43.3](https://github.com/googleapis/java-bigquery/compare/v2.43.2...v2.43.3) (2024-10-29)
diff --git a/benchmark/pom.xml b/benchmark/pom.xml
index a371796e0d..b6daf595e9 100644
--- a/benchmark/pom.xml
+++ b/benchmark/pom.xml
@@ -6,7 +6,7 @@
google-cloud-bigquery-parentcom.google.cloud
- 2.43.3
+ 2.45.0
diff --git a/benchmark/src/main/java/com.google.cloud.bigquery/ConnImplBenchmark.java b/benchmark/src/main/java/com.google.cloud.bigquery/ConnImplBenchmark.java
index f202df6669..670e31ff6e 100644
--- a/benchmark/src/main/java/com.google.cloud.bigquery/ConnImplBenchmark.java
+++ b/benchmark/src/main/java/com.google.cloud.bigquery/ConnImplBenchmark.java
@@ -20,6 +20,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
import java.util.logging.Level;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -48,31 +49,19 @@ public class ConnImplBenchmark {
public int rowLimit;
private ConnectionSettings connectionSettingsReadAPIEnabled, connectionSettingsReadAPIDisabled;
- private long numBuffRows = 100000L;
- private final String DATASET = "new_york_taxi_trips";
private final String QUERY =
"SELECT * FROM bigquery-public-data.new_york_taxi_trips.tlc_yellow_trips_2017 LIMIT %s";
- public static final long NUM_PAGE_ROW_CNT_RATIO =
- 10; // ratio of [records in the current page :: total rows] to be met to use read API
- public static final long NUM_MIN_RESULT_SIZE =
- 200000; // min number of records to use to ReadAPI with
@Setup
public void setUp() throws IOException {
java.util.logging.Logger.getGlobal().setLevel(Level.ALL);
- connectionSettingsReadAPIEnabled =
- ConnectionSettings.newBuilder()
- .setUseReadAPI(true) // enable read api
- .build();
+ connectionSettingsReadAPIEnabled = ConnectionSettings.newBuilder().setUseReadAPI(true).build();
connectionSettingsReadAPIDisabled =
- ConnectionSettings.newBuilder()
- .setUseReadAPI(false) // disable read api
- .build();
+ ConnectionSettings.newBuilder().setUseReadAPI(false).build();
}
@Benchmark
- // uses bigquery.query
public void iterateRecordsWithBigQuery_Query(Blackhole blackhole) throws InterruptedException {
String selectQuery = String.format(QUERY, rowLimit);
BigQuery bigQuery = BigQueryOptions.getDefaultInstance().getService();
@@ -81,81 +70,35 @@ public void iterateRecordsWithBigQuery_Query(Blackhole blackhole) throws Interru
TableResult result = bigQuery.query(config);
long hash = 0L;
int cnt = 0;
- System.out.print("\n Running");
- // iterate al the records and compute the hash
+ long lastTime = System.currentTimeMillis();
+ System.out.println("\n Running");
for (FieldValueList row : result.iterateAll()) {
- hash +=
- row.get("vendor_id").getStringValue() == null
- ? 0
- : row.get("vendor_id").getStringValue().hashCode();
- hash +=
- row.get("pickup_datetime").getStringValue() == null
- ? 0
- : row.get("pickup_datetime").getStringValue().hashCode();
- hash +=
- row.get("dropoff_datetime").getStringValue() == null
- ? 0
- : row.get("dropoff_datetime").getStringValue().hashCode();
- hash +=
- row.get("passenger_count").getValue() == null
- ? 0
- : row.get("passenger_count").getLongValue();
- hash +=
- row.get("trip_distance").getValue() == null
- ? 0
- : row.get("trip_distance").getDoubleValue();
- hash +=
- row.get("pickup_longitude").getValue() == null
- ? 0
- : row.get("pickup_longitude").getDoubleValue();
- hash +=
- row.get("pickup_latitude").getValue() == null
- ? 0
- : row.get("pickup_latitude").getDoubleValue();
- hash +=
- row.get("rate_code").getStringValue() == null
- ? 0
- : row.get("rate_code").getStringValue().hashCode();
- hash +=
- row.get("store_and_fwd_flag").getStringValue() == null
- ? 0
- : row.get("store_and_fwd_flag").getStringValue().hashCode();
- hash +=
- row.get("payment_type").getStringValue() == null
- ? 0
- : row.get("payment_type").getStringValue().hashCode();
- hash +=
- row.get("pickup_location_id").getStringValue() == null
- ? 0
- : row.get("pickup_location_id").getStringValue().hashCode();
- hash +=
- row.get("dropoff_location_id").getStringValue() == null
- ? 0
- : row.get("dropoff_location_id").getStringValue().hashCode();
- hash +=
- row.get("dropoff_longitude").getValue() == null
- ? 0
- : row.get("dropoff_longitude").getDoubleValue();
- hash +=
- row.get("dropoff_latitude").getValue() == null
- ? 0
- : row.get("dropoff_latitude").getDoubleValue();
- hash +=
- row.get("fare_amount").getValue() == null ? 0 : row.get("fare_amount").getDoubleValue();
- hash += row.get("extra").getValue() == null ? 0 : row.get("extra").getDoubleValue();
- hash += row.get("mta_tax").getValue() == null ? 0 : row.get("mta_tax").getDoubleValue();
- hash += row.get("tip_amount").getValue() == null ? 0 : row.get("tip_amount").getDoubleValue();
- hash +=
- row.get("tolls_amount").getValue() == null ? 0 : row.get("tolls_amount").getDoubleValue();
- hash +=
- row.get("imp_surcharge").getValue() == null
- ? 0
- : row.get("imp_surcharge").getDoubleValue();
- hash +=
- row.get("total_amount").getValue() == null ? 0 : row.get("total_amount").getDoubleValue();
+ hash += computeHash(row.get("vendor_id"), FieldValue::getStringValue);
+ hash += computeHash(row.get("pickup_datetime"), FieldValue::getStringValue);
+ hash += computeHash(row.get("dropoff_datetime"), FieldValue::getStringValue);
+ hash += computeHash(row.get("passenger_count"), FieldValue::getLongValue);
+ hash += computeHash(row.get("trip_distance"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("rate_code"), FieldValue::getStringValue);
+ hash += computeHash(row.get("store_and_fwd_flag"), FieldValue::getStringValue);
+ hash += computeHash(row.get("payment_type"), FieldValue::getStringValue);
+ hash += computeHash(row.get("fare_amount"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("extra"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("mta_tax"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("tip_amount"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("tolls_amount"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("imp_surcharge"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("airport_fee"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("total_amount"), FieldValue::getDoubleValue);
+ hash += computeHash(row.get("pickup_location_id"), FieldValue::getStringValue);
+ hash += computeHash(row.get("dropoff_location_id"), FieldValue::getStringValue);
+ hash += computeHash(row.get("data_file_year"), FieldValue::getLongValue);
+ hash += computeHash(row.get("data_file_month"), FieldValue::getLongValue);
- if (++cnt % 100000 == 0) { // just to indicate the progress while long running benchmarks
- System.out.print(".");
+ if (++cnt % 100_000 == 0) {
+ long now = System.currentTimeMillis();
+ long duration = now - lastTime;
+ System.out.println("ROW " + cnt + " Time: " + duration + " ms");
+ lastTime = now;
}
}
System.out.println(cnt + " records processed using bigquery.query");
@@ -202,54 +145,67 @@ public void iterateRecordsWithoutUsingReadAPI(Blackhole blackhole)
blackhole.consume(hash);
}
- // Hashes all the 20 columns of all the rows
private long getResultHash(BigQueryResult bigQueryResultSet) throws SQLException {
ResultSet rs = bigQueryResultSet.getResultSet();
long hash = 0L;
int cnt = 0;
- System.out.print("\n Running");
+ long lastTime = System.currentTimeMillis();
+ System.out.println("\n Running");
while (rs.next()) {
- hash += rs.getString("vendor_id") == null ? 0 : rs.getString("vendor_id").hashCode();
- hash +=
- rs.getString("pickup_datetime") == null ? 0 : rs.getString("pickup_datetime").hashCode();
- hash +=
- rs.getString("dropoff_datetime") == null
- ? 0
- : rs.getString("dropoff_datetime").hashCode();
- hash += rs.getLong("passenger_count");
- hash += rs.getDouble("trip_distance");
- hash += rs.getDouble("pickup_longitude");
- hash += rs.getDouble("pickup_latitude");
- hash += rs.getString("rate_code") == null ? 0 : rs.getString("rate_code").hashCode();
- hash +=
- rs.getString("store_and_fwd_flag") == null
- ? 0
- : rs.getString("store_and_fwd_flag").hashCode();
- hash += rs.getDouble("dropoff_longitude");
- hash += rs.getDouble("dropoff_latitude");
- hash += rs.getString("payment_type") == null ? 0 : rs.getString("payment_type").hashCode();
- hash += rs.getDouble("fare_amount");
- hash += rs.getDouble("extra");
- hash += rs.getDouble("mta_tax");
- hash += rs.getDouble("tip_amount");
- hash += rs.getDouble("tolls_amount");
- hash += rs.getDouble("imp_surcharge");
- hash += rs.getDouble("total_amount");
- hash +=
- rs.getString("pickup_location_id") == null
- ? 0
- : rs.getString("pickup_location_id").hashCode();
- hash +=
- rs.getString("dropoff_location_id") == null
- ? 0
- : rs.getString("dropoff_location_id").hashCode();
- if (++cnt % 100000 == 0) { // just to indicate the progress while long running benchmarks
- System.out.print(".");
+ hash += computeHash(rs, "vendor_id", ResultSet::getString);
+ hash += computeHash(rs, "pickup_datetime", ResultSet::getString);
+ hash += computeHash(rs, "dropoff_datetime", ResultSet::getString);
+ hash += computeHash(rs, "passenger_count", ResultSet::getLong);
+ hash += computeHash(rs, "trip_distance", ResultSet::getDouble);
+ hash += computeHash(rs, "rate_code", ResultSet::getString);
+ hash += computeHash(rs, "store_and_fwd_flag", ResultSet::getString);
+ hash += computeHash(rs, "payment_type", ResultSet::getString);
+ hash += computeHash(rs, "fare_amount", ResultSet::getDouble);
+ hash += computeHash(rs, "extra", ResultSet::getDouble);
+ hash += computeHash(rs, "mta_tax", ResultSet::getDouble);
+ hash += computeHash(rs, "tip_amount", ResultSet::getDouble);
+ hash += computeHash(rs, "tolls_amount", ResultSet::getDouble);
+ hash += computeHash(rs, "imp_surcharge", ResultSet::getDouble);
+ hash += computeHash(rs, "airport_fee", ResultSet::getDouble);
+ hash += computeHash(rs, "total_amount", ResultSet::getDouble);
+ hash += computeHash(rs, "pickup_location_id", ResultSet::getString);
+ hash += computeHash(rs, "dropoff_location_id", ResultSet::getString);
+ hash += computeHash(rs, "data_file_year", ResultSet::getLong);
+ hash += computeHash(rs, "data_file_month", ResultSet::getLong);
+
+ if (++cnt % 100_000 == 0) {
+ long now = System.currentTimeMillis();
+ long duration = now - lastTime;
+ System.out.println("ROW " + cnt + " Time: " + duration + " ms");
+ lastTime = now;
}
}
return hash;
}
+ private long computeHash(
+ ResultSet rs, String columnName, SQLFunction extractor) {
+ try {
+ T value = extractor.apply(rs, columnName);
+ return (value == null) ? 0 : value.hashCode();
+ } catch (SQLException e) {
+ return 0;
+ }
+ }
+
+ @FunctionalInterface
+ private interface SQLFunction {
+ R apply(T t, String columnName) throws SQLException;
+ }
+
+ private long computeHash(FieldValue fieldValue, Function extractor) {
+ if (fieldValue == null || fieldValue.isNull()) {
+ return 0;
+ }
+ T value = extractor.apply(fieldValue);
+ return (value == null) ? 0 : value.hashCode();
+ }
+
public static void main(String[] args) throws Exception {
Options opt = new OptionsBuilder().include(ConnImplBenchmark.class.getSimpleName()).build();
new Runner(opt).run();
diff --git a/google-cloud-bigquery-bom/pom.xml b/google-cloud-bigquery-bom/pom.xml
index c52bc5d4b7..0a689e33f8 100644
--- a/google-cloud-bigquery-bom/pom.xml
+++ b/google-cloud-bigquery-bom/pom.xml
@@ -3,12 +3,12 @@
4.0.0com.google.cloudgoogle-cloud-bigquery-bom
- 2.43.3
+ 2.45.0pomcom.google.cloudsdk-platform-java-config
- 3.39.0
+ 3.41.0
@@ -54,7 +54,7 @@
com.google.cloudgoogle-cloud-bigquery
- 2.43.3
+ 2.45.0
diff --git a/google-cloud-bigquery/clirr-ignored-differences.xml b/google-cloud-bigquery/clirr-ignored-differences.xml
index 9c69fd6a68..b6546847fe 100644
--- a/google-cloud-bigquery/clirr-ignored-differences.xml
+++ b/google-cloud-bigquery/clirr-ignored-differences.xml
@@ -129,4 +129,9 @@
com/google/cloud/bigquery/StandardTableDefinition**BigLakeConfiguration(*)
+
+ 7013
+ com/google/cloud/bigquery/DatasetInfo*
+ *setMaxTimeTravelHours(*)
+
\ No newline at end of file
diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml
index 52538ce4f0..c040d4fc37 100644
--- a/google-cloud-bigquery/pom.xml
+++ b/google-cloud-bigquery/pom.xml
@@ -3,7 +3,7 @@
4.0.0com.google.cloudgoogle-cloud-bigquery
- 2.43.3
+ 2.45.0jarBigQueryhttps://github.com/googleapis/java-bigquery
@@ -11,7 +11,7 @@
com.google.cloudgoogle-cloud-bigquery-parent
- 2.43.3
+ 2.45.0google-cloud-bigquery
@@ -85,10 +85,6 @@
com.google.apigax
-
- org.threeten
- threetenbp
- com.google.code.gsongson
diff --git a/google-cloud-bigquery/src/benchmark/java/com/google/cloud/bigquery/benchmark/Benchmark.java b/google-cloud-bigquery/src/benchmark/java/com/google/cloud/bigquery/benchmark/Benchmark.java
index caec16676f..9d05f6b2b4 100644
--- a/google-cloud-bigquery/src/benchmark/java/com/google/cloud/bigquery/benchmark/Benchmark.java
+++ b/google-cloud-bigquery/src/benchmark/java/com/google/cloud/bigquery/benchmark/Benchmark.java
@@ -23,10 +23,10 @@
import com.google.cloud.bigquery.QueryJobConfiguration;
import com.google.cloud.bigquery.TableResult;
import java.io.FileInputStream;
+import java.time.Clock;
+import java.time.Duration;
+import java.time.Instant;
import java.util.List;
-import org.threeten.bp.Clock;
-import org.threeten.bp.Duration;
-import org.threeten.bp.Instant;
public class Benchmark {
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java
index 675e6c1e86..613134fa06 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java
@@ -244,8 +244,9 @@ private DatasetListOption(BigQueryRpc.Option option, Object value) {
}
/**
- * Returns an option to specify a label filter. See
- * https://cloud.google.com/bigquery/docs/adding-using-labels#filtering_datasets_using_labels
+ * Returns an option to specify a label filter. @see Filtering
+ * using labels
*
* @param labelFilter In the form "labels.key:value"
*/
@@ -280,7 +281,7 @@ private DatasetOption(BigQueryRpc.Option option, Object value) {
/**
* Returns an option to specify the dataset's fields to be returned by the RPC call. If this
- * option is not provided all dataset's fields are returned. { code DatasetOption.fields} can be
+ * option is not provided all dataset's fields are returned. {@code DatasetOption.fields} can be
* used to specify only the fields of interest. {@link Dataset#getDatasetId()} is always
* returned, even if not specified.
*/
@@ -864,8 +865,7 @@ public int hashCode() {
/**
* Lists the project's datasets. This method returns partial information on each dataset: ({@link
* Dataset#getDatasetId()}, {@link Dataset#getFriendlyName()} and {@link
- * Dataset#getGeneratedId()}). To get complete information use either {@link #getDataset(String,
- * DatasetOption...)} or {@link #getDataset(DatasetId, DatasetOption...)}.
+ * Dataset#getGeneratedId()}). To get complete information use {@link #getDataset}.
*
*
Example of listing datasets, specifying the page size.
*
@@ -884,8 +884,7 @@ public int hashCode() {
/**
* Lists the datasets in the provided project. This method returns partial information on each
* dataset: ({@link Dataset#getDatasetId()}, {@link Dataset#getFriendlyName()} and {@link
- * Dataset#getGeneratedId()}). To get complete information use either {@link #getDataset(String,
- * DatasetOption...)} or {@link #getDataset(DatasetId, DatasetOption...)}.
+ * Dataset#getGeneratedId()}). To get complete information use either {@link #getDataset}.
*
*
Example of listing datasets in a project, specifying the page size.
*
@@ -1205,7 +1204,7 @@ public int hashCode() {
* Lists the tables in the dataset. This method returns partial information on each table: ({@link
* Table#getTableId()}, {@link Table#getFriendlyName()}, {@link Table#getGeneratedId()} and type,
* which is part of {@link Table#getDefinition()}). To get complete information use either {@link
- * #getTable(TableId, TableOption...)} or {@link #getTable(String, String, TableOption...)}.
+ * #getTable}.
*
*
Example of listing the tables in a dataset, specifying the page size.
*
@@ -1225,7 +1224,7 @@ public int hashCode() {
* Lists the tables in the dataset. This method returns partial information on each table: ({@link
* Table#getTableId()}, {@link Table#getFriendlyName()}, {@link Table#getGeneratedId()} and type,
* which is part of {@link Table#getDefinition()}). To get complete information use either {@link
- * #getTable(TableId, TableOption...)} or {@link #getTable(String, String, TableOption...)}.
+ * #getTable}.
*
*
Example of listing the tables in a dataset.
*
@@ -1429,8 +1428,7 @@ TableResult listTableData(
/**
* Sends a job cancel request. This call will return immediately. The job status can then be
- * checked using either {@link #getJob(JobId, JobOption...)} or {@link #getJob(String,
- * JobOption...)}).
+ * checked by using {@link #getJob}.
*
*
If the location of the job is not "US" or "EU", {@link #cancel(JobId)} must be used instead.
*
@@ -1454,8 +1452,7 @@ TableResult listTableData(
/**
* Sends a job cancel request. This call will return immediately. The job status can then be
- * checked using either {@link #getJob(JobId, JobOption...)} or {@link #getJob(String,
- * JobOption...)}).
+ * checked using {@link #getJob}.
*
*
If the location of the job is not "US" or "EU", the {@code jobId} must specify the job
* location.
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java
index 5760832157..23cb001ac2 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java
@@ -60,8 +60,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.checkerframework.checker.nullness.qual.NonNull;
-import org.threeten.bp.Instant;
-import org.threeten.bp.temporal.ChronoUnit;
final class BigQueryImpl extends BaseService implements BigQuery {
@@ -450,7 +448,9 @@ public com.google.api.services.bigquery.model.Job call() {
long jobCreationTime = job.getStatistics().getCreationTime();
long jobMinStaleTime = System.currentTimeMillis();
long jobMaxStaleTime =
- Instant.ofEpochMilli(jobMinStaleTime).minus(1, ChronoUnit.DAYS).toEpochMilli();
+ java.time.Instant.ofEpochMilli(jobMinStaleTime)
+ .minus(1, java.time.temporal.ChronoUnit.DAYS)
+ .toEpochMilli();
// Only return the job if it has been created in the past 24 hours.
// This is assuming any job older than 24 hours is a valid duplicate JobID
@@ -1206,7 +1206,7 @@ public TableDataList call() {
new PageImpl<>(
new TableDataPageFetcher(tableId, schema, serviceOptions, cursor, pageOptionMap),
cursor,
- transformTableData(result.getRows(), schema)),
+ transformTableData(result.getRows(), schema, serviceOptions.getUseInt64Timestamps())),
result.getTotalRows());
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
@@ -1214,7 +1214,7 @@ public TableDataList call() {
}
private static Iterable transformTableData(
- Iterable tableDataPb, final Schema schema) {
+ Iterable tableDataPb, final Schema schema, boolean useInt64Timestamps) {
return ImmutableList.copyOf(
Iterables.transform(
tableDataPb != null ? tableDataPb : ImmutableList.of(),
@@ -1223,7 +1223,7 @@ private static Iterable transformTableData(
@Override
public FieldValueList apply(TableRow rowPb) {
- return FieldValueList.fromPb(rowPb.getF(), fields);
+ return FieldValueList.fromPb(rowPb.getF(), fields, useInt64Timestamps);
}
}));
}
@@ -1347,7 +1347,8 @@ public TableResult query(QueryJobConfiguration configuration, JobOption... optio
// If all parameters passed in configuration are supported by the query() method on the backend,
// put on fast path
- QueryRequestInfo requestInfo = new QueryRequestInfo(configuration);
+ QueryRequestInfo requestInfo =
+ new QueryRequestInfo(configuration, getOptions().getUseInt64Timestamps());
if (requestInfo.isFastQuerySupported(null)) {
String projectId = getOptions().getProjectId();
QueryRequest content = requestInfo.toPb();
@@ -1420,7 +1421,8 @@ public com.google.api.services.bigquery.model.QueryResponse call() {
// fetch next pages of results
new QueryPageFetcher(jobId, schema, getOptions(), cursor, optionMap(options)),
cursor,
- transformTableData(results.getRows(), schema)))
+ transformTableData(
+ results.getRows(), schema, getOptions().getUseInt64Timestamps())))
.setJobId(jobId)
.setQueryId(results.getQueryId())
.build();
@@ -1433,7 +1435,8 @@ public com.google.api.services.bigquery.model.QueryResponse call() {
new PageImpl<>(
new TableDataPageFetcher(null, schema, getOptions(), null, optionMap(options)),
null,
- transformTableData(results.getRows(), schema)))
+ transformTableData(
+ results.getRows(), schema, getOptions().getUseInt64Timestamps())))
// Return the JobID of the successful job
.setJobId(
results.getJobReference() != null ? JobId.fromPb(results.getJobReference()) : null)
@@ -1448,7 +1451,8 @@ public TableResult query(QueryJobConfiguration configuration, JobId jobId, JobOp
// If all parameters passed in configuration are supported by the query() method on the backend,
// put on fast path
- QueryRequestInfo requestInfo = new QueryRequestInfo(configuration);
+ QueryRequestInfo requestInfo =
+ new QueryRequestInfo(configuration, getOptions().getUseInt64Timestamps());
if (requestInfo.isFastQuerySupported(jobId)) {
// Be careful when setting the projectID in JobId, if a projectID is specified in the JobId,
// the job created by the query method will use that project. This may cause the query to
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryOptions.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryOptions.java
index e53439f023..465cc83058 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryOptions.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryOptions.java
@@ -34,10 +34,11 @@ public class BigQueryOptions extends ServiceOptions {
private static final int DEFAULT_READ_API_TIME_OUT = 60000;
private static final String BIGQUERY_SCOPE = "https://www.googleapis.com/auth/bigquery";
private static final Set SCOPES = ImmutableSet.of(BIGQUERY_SCOPE);
- private static final long serialVersionUID = -2437598817433266049L;
+ private static final long serialVersionUID = -2437598817433266048L;
private final String location;
// set the option ThrowNotFound when you want to throw the exception when the value not found
private boolean setThrowNotFound;
+ private boolean useInt64Timestamps;
private String queryPreviewEnabled = System.getenv("QUERY_PREVIEW_ENABLED");
public static class DefaultBigQueryFactory implements BigQueryFactory {
@@ -63,6 +64,7 @@ public ServiceRpc create(BigQueryOptions options) {
public static class Builder extends ServiceOptions.Builder {
private String location;
+ private boolean useInt64Timestamps;
private Builder() {}
@@ -84,6 +86,11 @@ public Builder setLocation(String location) {
return this;
}
+ public Builder setUseInt64Timestamps(boolean useInt64Timestamps) {
+ this.useInt64Timestamps = useInt64Timestamps;
+ return this;
+ }
+
@Override
public BigQueryOptions build() {
return new BigQueryOptions(this);
@@ -93,6 +100,7 @@ public BigQueryOptions build() {
private BigQueryOptions(Builder builder) {
super(BigQueryFactory.class, BigQueryRpcFactory.class, builder, new BigQueryDefaults());
this.location = builder.location;
+ this.useInt64Timestamps = builder.useInt64Timestamps;
}
private static class BigQueryDefaults implements ServiceDefaults {
@@ -140,6 +148,10 @@ public void setThrowNotFound(boolean setThrowNotFound) {
this.setThrowNotFound = setThrowNotFound;
}
+ public void setUseInt64Timestamps(boolean useInt64Timestamps) {
+ this.useInt64Timestamps = useInt64Timestamps;
+ }
+
@VisibleForTesting
public void setQueryPreviewEnabled(String queryPreviewEnabled) {
this.queryPreviewEnabled = queryPreviewEnabled;
@@ -149,6 +161,10 @@ public boolean getThrowNotFound() {
return setThrowNotFound;
}
+ public boolean getUseInt64Timestamps() {
+ return useInt64Timestamps;
+ }
+
@SuppressWarnings("unchecked")
@Override
public Builder toBuilder() {
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryRetryAlgorithm.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryRetryAlgorithm.java
index 0429b7f005..7b168c12d1 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryRetryAlgorithm.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryRetryAlgorithm.java
@@ -27,13 +27,13 @@
import com.google.api.gax.retrying.TimedRetryAlgorithmWithContext;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
+import java.time.Duration;
import java.util.Iterator;
import java.util.UUID;
import java.util.concurrent.CancellationException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
-import org.threeten.bp.Duration;
public class BigQueryRetryAlgorithm extends RetryAlgorithm {
private final BigQueryRetryConfig bigQueryRetryConfig;
@@ -67,7 +67,7 @@ public boolean shouldRetry(
// Log retry info
int attemptCount = nextAttemptSettings == null ? 0 : nextAttemptSettings.getAttemptCount();
Duration retryDelay =
- nextAttemptSettings == null ? Duration.ZERO : nextAttemptSettings.getRetryDelay();
+ nextAttemptSettings == null ? Duration.ZERO : nextAttemptSettings.getRetryDelayDuration();
String errorMessage = previousThrowable != null ? previousThrowable.getMessage() : "";
// Implementing shouldRetryBasedOnBigQueryRetryConfig so that we can retry exceptions based on
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java
index daadb9a857..4fc8577853 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java
@@ -164,6 +164,12 @@ public Builder setStorageBillingModel(String storageBillingModel) {
return this;
}
+ @Override
+ public Builder setMaxTimeTravelHours(Long maxTimeTravelHours) {
+ infoBuilder.setMaxTimeTravelHours(maxTimeTravelHours);
+ return this;
+ }
+
@Override
public Dataset build() {
return new Dataset(bigquery, infoBuilder);
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java
index b5fabe97d1..f9b7f03e17 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java
@@ -75,6 +75,7 @@ public Dataset apply(DatasetInfo datasetInfo) {
private final String defaultCollation;
private final ExternalDatasetReference externalDatasetReference;
private final String storageBillingModel;
+ private final Long maxTimeTravelHours;
/** A builder for {@code DatasetInfo} objects. */
public abstract static class Builder {
@@ -142,6 +143,12 @@ public abstract Builder setExternalDatasetReference(
*/
public abstract Builder setStorageBillingModel(String storageBillingModel);
+ /**
+ * Optional. Defines the time travel window in hours. The value can be from 48 to 168 hours (2
+ * to 7 days). The default value is 168 hours if this is not set. The value may be {@code null}.
+ */
+ public abstract Builder setMaxTimeTravelHours(Long maxTimeTravelHours);
+
/**
* The default encryption key for all tables in the dataset. Once this property is set, all
* newly-created partitioned tables in the dataset will have encryption key set to this value,
@@ -200,6 +207,7 @@ static final class BuilderImpl extends Builder {
private String defaultCollation;
private ExternalDatasetReference externalDatasetReference;
private String storageBillingModel;
+ private Long maxTimeTravelHours;
BuilderImpl() {}
@@ -221,6 +229,7 @@ static final class BuilderImpl extends Builder {
this.defaultCollation = datasetInfo.defaultCollation;
this.externalDatasetReference = datasetInfo.externalDatasetReference;
this.storageBillingModel = datasetInfo.storageBillingModel;
+ this.maxTimeTravelHours = datasetInfo.maxTimeTravelHours;
}
BuilderImpl(com.google.api.services.bigquery.model.Dataset datasetPb) {
@@ -260,6 +269,7 @@ public Acl apply(Dataset.Access accessPb) {
ExternalDatasetReference.fromPb(datasetPb.getExternalDatasetReference());
}
this.storageBillingModel = datasetPb.getStorageBillingModel();
+ this.maxTimeTravelHours = datasetPb.getMaxTimeTravelHours();
}
@Override
@@ -372,6 +382,12 @@ public Builder setStorageBillingModel(String storageBillingModel) {
return this;
}
+ @Override
+ public Builder setMaxTimeTravelHours(Long maxTimeTravelHours) {
+ this.maxTimeTravelHours = maxTimeTravelHours;
+ return this;
+ }
+
@Override
public DatasetInfo build() {
return new DatasetInfo(this);
@@ -396,6 +412,7 @@ public DatasetInfo build() {
defaultCollation = builder.defaultCollation;
externalDatasetReference = builder.externalDatasetReference;
storageBillingModel = builder.storageBillingModel;
+ maxTimeTravelHours = builder.maxTimeTravelHours;
}
/** Returns the dataset identity. */
@@ -529,6 +546,14 @@ public String getStorageBillingModel() {
return storageBillingModel;
}
+ /**
+ * Returns the number of hours that deleted or updated data will be available to be queried for
+ * all tables in the dataset.
+ */
+ public Long getMaxTimeTravelHours() {
+ return maxTimeTravelHours;
+ }
+
/**
* Returns information about the external metadata storage where the dataset is defined. Filled
* out when the dataset type is EXTERNAL.
@@ -562,6 +587,7 @@ public String toString() {
.add("defaultCollation", defaultCollation)
.add("externalDatasetReference", externalDatasetReference)
.add("storageBillingModel", storageBillingModel)
+ .add("maxTimeTravelHours", maxTimeTravelHours)
.toString();
}
@@ -646,6 +672,9 @@ public Dataset.Access apply(Acl acl) {
if (storageBillingModel != null) {
datasetPb.setStorageBillingModel(storageBillingModel);
}
+ if (maxTimeTravelHours != null) {
+ datasetPb.setMaxTimeTravelHours(maxTimeTravelHours);
+ }
return datasetPb;
}
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java
index c5a8fab07c..d11df4b956 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java
@@ -26,6 +26,7 @@
import com.google.common.io.BaseEncoding;
import java.io.Serializable;
import java.math.BigDecimal;
+import java.math.BigInteger;
import java.math.RoundingMode;
import java.time.Duration;
import java.time.Instant;
@@ -46,10 +47,11 @@
public class FieldValue implements Serializable {
private static final int MICROSECONDS = 1000000;
- private static final long serialVersionUID = 469098630191710061L;
+ private static final long serialVersionUID = 469098630191710062L;
private final Attribute attribute;
private final Object value;
+ private final Boolean useInt64Timestamps;
/** The field value's attribute, giving information on the field's content type. */
public enum Attribute {
@@ -74,8 +76,13 @@ public enum Attribute {
}
private FieldValue(Attribute attribute, Object value) {
+ this(attribute, value, false);
+ }
+
+ private FieldValue(Attribute attribute, Object value, Boolean useInt64Timestamps) {
this.attribute = checkNotNull(attribute);
this.value = value;
+ this.useInt64Timestamps = useInt64Timestamps;
}
/**
@@ -107,6 +114,10 @@ public Object getValue() {
return value;
}
+ public Boolean getUseInt64Timestamps() {
+ return useInt64Timestamps;
+ }
+
/**
* Returns this field's value as a {@link String}. This method should only be used if the
* corresponding field has primitive type ({@link LegacySQLTypeName#BYTES}, {@link
@@ -207,6 +218,9 @@ public boolean getBooleanValue() {
*/
@SuppressWarnings("unchecked")
public long getTimestampValue() {
+ if (useInt64Timestamps) {
+ return new BigInteger(getStringValue()).longValue();
+ }
// timestamps are encoded in the format 1408452095.22 where the integer part is seconds since
// epoch (e.g. 1408452095.22 == 2014-08-19 07:41:35.220 -05:00)
BigDecimal secondsWithMicro = new BigDecimal(getStringValue());
@@ -317,12 +331,13 @@ public String toString() {
return MoreObjects.toStringHelper(this)
.add("attribute", attribute)
.add("value", value)
+ .add("useInt64Timestamps", useInt64Timestamps)
.toString();
}
@Override
public final int hashCode() {
- return Objects.hash(attribute, value);
+ return Objects.hash(attribute, value, useInt64Timestamps);
}
@Override
@@ -334,7 +349,9 @@ public final boolean equals(Object obj) {
return false;
}
FieldValue other = (FieldValue) obj;
- return attribute == other.attribute && Objects.equals(value, other.value);
+ return attribute == other.attribute
+ && Objects.equals(value, other.value)
+ && Objects.equals(useInt64Timestamps, other.useInt64Timestamps);
}
/**
@@ -353,29 +370,38 @@ public final boolean equals(Object obj) {
*/
@BetaApi
public static FieldValue of(Attribute attribute, Object value) {
- return new FieldValue(attribute, value);
+ return of(attribute, value, false);
+ }
+
+ @BetaApi
+ public static FieldValue of(Attribute attribute, Object value, Boolean useInt64Timestamps) {
+ return new FieldValue(attribute, value, useInt64Timestamps);
}
static FieldValue fromPb(Object cellPb) {
- return fromPb(cellPb, null);
+ return fromPb(cellPb, null, false);
}
@SuppressWarnings("unchecked")
- static FieldValue fromPb(Object cellPb, Field recordSchema) {
+ static FieldValue fromPb(Object cellPb, Field recordSchema, Boolean useInt64Timestamps) {
if (Data.isNull(cellPb)) {
- return FieldValue.of(Attribute.PRIMITIVE, null);
+ return FieldValue.of(Attribute.PRIMITIVE, null, useInt64Timestamps);
}
if (cellPb instanceof String) {
if ((recordSchema != null)
&& (recordSchema.getType() == LegacySQLTypeName.RANGE)
&& (recordSchema.getRangeElementType() != null)) {
return FieldValue.of(
- Attribute.RANGE, Range.of((String) cellPb, recordSchema.getRangeElementType()));
+ Attribute.RANGE,
+ Range.of((String) cellPb, recordSchema.getRangeElementType()),
+ useInt64Timestamps);
}
- return FieldValue.of(Attribute.PRIMITIVE, cellPb);
+ return FieldValue.of(Attribute.PRIMITIVE, cellPb, useInt64Timestamps);
}
if (cellPb instanceof List) {
- return FieldValue.of(Attribute.REPEATED, FieldValueList.fromPb((List