Skip to content

Commit 0a0d897

Browse files
committed
Merge branch 'main' of github.com:googleapis/google-cloud-java into datastore-csm-impl-2
2 parents ec30b98 + 27feef5 commit 0a0d897

8 files changed

Lines changed: 615 additions & 281 deletions

File tree

java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,18 @@ public void testInt64Timestamp() {
151151
assertEquals(expected, received);
152152
}
153153

154+
@Test
155+
public void testLosslessMaxTimestamp() {
156+
// Test the lossless behavior (useInt64Timestamps = true)
157+
// The backend returns a 64-bit integer string for microseconds when this option is enabled
158+
String losslessTimestampString = "253402300799999999";
159+
FieldValue losslessValue =
160+
FieldValue.of(FieldValue.Attribute.PRIMITIVE, losslessTimestampString, true);
161+
162+
// Exactly matches the microsecond equivalent of 9999-12-31 23:59:59.999999
163+
assertEquals(253402300799999999L, losslessValue.getTimestampValue());
164+
}
165+
154166
@Test
155167
public void testEquals() {
156168
FieldValue booleanValue = FieldValue.of(FieldValue.Attribute.PRIMITIVE, "false");

java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,56 @@ static GoogleCredentials loadCredentials(String credentialFile) {
12151215
}
12161216
}
12171217

1218+
@Test
1219+
void testLosslessMaxTimestampIntegration() throws InterruptedException {
1220+
String query = "SELECT TIMESTAMP '9999-12-31 23:59:59.999999 UTC' as max_ts";
1221+
QueryJobConfiguration config = QueryJobConfiguration.newBuilder(query).build();
1222+
1223+
// 1. Test lossless 64-bit integer parsing (useInt64Timestamps = true)
1224+
DataFormatOptions losslessOptions =
1225+
DataFormatOptions.newBuilder().useInt64Timestamp(true).build();
1226+
BigQuery losslessBigQuery =
1227+
bigquery.getOptions().toBuilder()
1228+
.setDataFormatOptions(losslessOptions)
1229+
.build()
1230+
.getService();
1231+
1232+
TableResult losslessResult = losslessBigQuery.query(config);
1233+
assertEquals(1L, losslessResult.getTotalRows());
1234+
for (FieldValueList row : losslessResult.iterateAll()) {
1235+
long exactMicros = row.get("max_ts").getTimestampValue();
1236+
assertEquals(253402300799999999L, exactMicros);
1237+
}
1238+
1239+
// 2. Test lossy FLOAT64 rounding behavior (useInt64Timestamps = false)
1240+
DataFormatOptions floatOptions =
1241+
DataFormatOptions.newBuilder().useInt64Timestamp(false).build();
1242+
BigQuery floatBigQuery =
1243+
bigquery.getOptions().toBuilder().setDataFormatOptions(floatOptions).build().getService();
1244+
1245+
TableResult floatResult = floatBigQuery.query(config);
1246+
assertEquals(1L, floatResult.getTotalRows());
1247+
for (FieldValueList row : floatResult.iterateAll()) {
1248+
long roundedMicros = row.get("max_ts").getTimestampValue();
1249+
assertEquals(253402300800000000L, roundedMicros);
1250+
}
1251+
1252+
// 3. Test ISO8601 timestamp formatting
1253+
DataFormatOptions isoOptions =
1254+
DataFormatOptions.newBuilder()
1255+
.timestampFormatOptions(DataFormatOptions.TimestampFormatOptions.ISO8601_STRING)
1256+
.build();
1257+
BigQuery isoBigQuery =
1258+
bigquery.getOptions().toBuilder().setDataFormatOptions(isoOptions).build().getService();
1259+
1260+
TableResult isoResult = isoBigQuery.query(config);
1261+
assertEquals(1L, isoResult.getTotalRows());
1262+
for (FieldValueList row : isoResult.iterateAll()) {
1263+
String isoValue = row.get("max_ts").getStringValue();
1264+
assertEquals("9999-12-31T23:59:59.999999Z", isoValue);
1265+
}
1266+
}
1267+
12181268
@Test
12191269
void testListDatasets() {
12201270
Page<Dataset> datasets = bigquery.listDatasets("bigquery-public-data");

java-dataplex/grpc-google-cloud-dataplex-v1/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,15 @@
4646
<artifactId>guava</artifactId>
4747
</dependency>
4848
</dependencies>
49+
<build>
50+
<plugins>
51+
<plugin>
52+
<groupId>com.spotify.fmt</groupId>
53+
<artifactId>fmt-maven-plugin</artifactId>
54+
<configuration>
55+
<skip>true</skip>
56+
</configuration>
57+
</plugin>
58+
</plugins>
59+
</build>
4960
</project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lxml==5.3.0
1+
lxml==6.1.0

sdk-platform-java/.cloudbuild/library_generation/scripts/requirements.txt

Lines changed: 270 additions & 140 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
attrs==24.2.0
22
click==8.1.7
33
jinja2==3.1.6
4-
lxml==5.3.0
4+
lxml==6.1.0
55
PyYAML==6.0.2

sdk-platform-java/hermetic_build/library_generation/requirements.txt

Lines changed: 269 additions & 139 deletions
Large diffs are not rendered by default.

sdk-platform-java/java-showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCompositeTracer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ void testCompositeTracer() throws Exception {
124124
.get(AttributeKey.stringKey(ObservabilityAttributes.SERVER_ADDRESS_ATTRIBUTE)))
125125
.isEqualTo(SHOWCASE_SERVER_ADDRESS);
126126

127+
Thread.sleep(100);
127128
// Verify metric name and one basic attribute server.address
128129
Collection<MetricData> actualMetrics = metricReader.collectAllMetrics();
129130

0 commit comments

Comments
 (0)