google-cloud-bigquery
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java
index 818c456b2..53952bc6c 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java
@@ -50,9 +50,11 @@ public final class InsertAllRequest implements Serializable {
/**
* A Google Big Query row to be inserted into a table. Each {@code RowToInsert} has an associated
- * id used by BigQuery to detect duplicate insertion requests on a best-effort basis. Please
- * notice that data for fields of type {@link LegacySQLTypeName#BYTES} must be provided as a
- * base64 encoded string.
+ * id used by BigQuery to detect duplicate insertion requests on a best-effort basis.
+ *
+ * To ensure proper serialization of numeric data, it is recommended to supply values using a
+ * string-typed representation. Additionally, data for fields of {@link LegacySQLTypeName#BYTES}
+ * must be provided as a base64 encoded string.
*
*
Example usage of creating a row to insert:
*
@@ -65,6 +67,7 @@ public final class InsertAllRequest implements Serializable {
* rowContent.put("booleanFieldName", true);
* rowContent.put("bytesFieldName", "DQ4KDQ==");
* rowContent.put("recordFieldName", recordContent);
+ * rowContent.put("numericFieldName", "1298930929292.129593272");
* RowToInsert row = new RowToInsert("rowId", rowContent);
* }
*
@@ -124,8 +127,11 @@ public boolean equals(Object obj) {
}
/**
- * Creates a row to be inserted with associated id. Please notice that data for fields of type
- * {@link LegacySQLTypeName#BYTES} must be provided as a base64 encoded string.
+ * Creates a row to be inserted with associated id.
+ *
+ *
To ensure proper serialization of numeric data, supply values using a string-typed
+ * representation. Additionally, data for fields of {@link LegacySQLTypeName#BYTES} must be
+ * provided as a base64 encoded string.
*
* @param id id of the row, used to identify duplicates
* @param content the actual content of the row
@@ -135,8 +141,11 @@ public static RowToInsert of(String id, Map content) {
}
/**
- * Creates a row to be inserted without associated id. Please notice that data for fields of
- * type {@link LegacySQLTypeName#BYTES} must be provided as a base64 encoded string.
+ * Creates a row to be inserted without associated id.
+ *
+ * To ensure proper serialization of numeric data, supply values using a string-typed
+ * representation. Additionally, data for fields of type {@link LegacySQLTypeName#BYTES} must be
+ * provided as a base64 encoded string.
*
* @param content the actual content of the row
*/
@@ -178,8 +187,11 @@ public Builder addRow(RowToInsert rowToInsert) {
}
/**
- * Adds a row to be inserted with associated id. Please notice that data for fields of type
- * {@link LegacySQLTypeName#BYTES} must be provided as a base64 encoded string.
+ * Adds a row to be inserted with associated id.
+ *
+ *
To ensure proper serialization of numeric data, supply values using a string-typed
+ * representation. Additionally, data for fields of {@link LegacySQLTypeName#BYTES} must be
+ * provided as a base64 encoded string.
*
*
Example usage of adding a row with associated id:
*
@@ -193,6 +205,7 @@ public Builder addRow(RowToInsert rowToInsert) {
* rowContent.put("booleanFieldName", true);
* rowContent.put("bytesFieldName", "DQ4KDQ==");
* rowContent.put("recordFieldName", recordContent);
+ * rowContent.put("numericFieldName", "1298930929292.129593272");
* builder.addRow("rowId", rowContent);
* }
*/
@@ -202,8 +215,11 @@ public Builder addRow(String id, Map content) {
}
/**
- * Adds a row to be inserted without an associated id. Please notice that data for fields of
- * type {@link LegacySQLTypeName#BYTES} must be provided as a base64 encoded string.
+ * Adds a row to be inserted without an associated id.
+ *
+ * To ensure proper serialization of numeric data, it is recommended to supply values using a
+ * string-typed representation. Additionally, data for fields of type {@link
+ * LegacySQLTypeName#BYTES} must be provided as a base64 encoded string.
*
*
Example usage of adding a row without an associated id:
*
@@ -217,6 +233,7 @@ public Builder addRow(String id, Map content) {
* rowContent.put("booleanFieldName", true);
* rowContent.put("bytesFieldName", "DQ4KDQ==");
* rowContent.put("recordFieldName", recordContent);
+ * rowContent.put("numericFieldName", "1298930929292.129593272");
* builder.addRow(rowContent);
* }
*/
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Table.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Table.java
index ab341c62c..5e1f1a2c0 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Table.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Table.java
@@ -150,6 +150,12 @@ public Builder setLabels(Map labels) {
return this;
}
+ @Override
+ public Builder setRequirePartitionFilter(Boolean requirePartitionFilter) {
+ infoBuilder.setRequirePartitionFilter(requirePartitionFilter);
+ return this;
+ }
+
@Override
public Table build() {
return new Table(bigquery, infoBuilder);
diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java
index e64e85eba..d3e58f980 100644
--- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java
+++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java
@@ -71,6 +71,7 @@ public Table apply(TableInfo tableInfo) {
private final TableDefinition definition;
private final EncryptionConfiguration encryptionConfiguration;
private final Labels labels;
+ private final Boolean requirePartitionFilter;
/** A builder for {@code TableInfo} objects. */
public abstract static class Builder {
@@ -130,6 +131,10 @@ public abstract static class Builder {
public abstract TableInfo build();
public abstract Builder setEncryptionConfiguration(EncryptionConfiguration configuration);
+
+ public Builder setRequirePartitionFilter(Boolean requirePartitionFilter) {
+ return this;
+ }
}
static class BuilderImpl extends Builder {
@@ -149,6 +154,7 @@ static class BuilderImpl extends Builder {
private TableDefinition definition;
private EncryptionConfiguration encryptionConfiguration;
private Labels labels = Labels.ZERO;
+ private Boolean requirePartitionFilter;
BuilderImpl() {}
@@ -168,6 +174,7 @@ static class BuilderImpl extends Builder {
this.definition = tableInfo.definition;
this.encryptionConfiguration = tableInfo.encryptionConfiguration;
this.labels = tableInfo.labels;
+ this.requirePartitionFilter = tableInfo.requirePartitionFilter;
}
BuilderImpl(Table tablePb) {
@@ -191,6 +198,7 @@ static class BuilderImpl extends Builder {
new EncryptionConfiguration.Builder(tablePb.getEncryptionConfiguration()).build();
}
this.labels = Labels.fromPb(tablePb.getLabels());
+ this.requirePartitionFilter = tablePb.getRequirePartitionFilter();
}
@Override
@@ -283,6 +291,12 @@ public Builder setLabels(Map labels) {
return this;
}
+ @Override
+ public Builder setRequirePartitionFilter(Boolean requirePartitionFilter) {
+ this.requirePartitionFilter = requirePartitionFilter;
+ return this;
+ }
+
@Override
public TableInfo build() {
return new TableInfo(this);
@@ -305,6 +319,7 @@ public TableInfo build() {
this.definition = builder.definition;
this.encryptionConfiguration = builder.encryptionConfiguration;
labels = builder.labels;
+ this.requirePartitionFilter = builder.requirePartitionFilter;
}
/** Returns the hash of the table resource. */
@@ -399,6 +414,14 @@ public Map getLabels() {
return labels.userMap();
}
+ /**
+ * Returns true if a partition filter (that can be used for partition elimination) is required for
+ * queries over this table.
+ */
+ public Boolean getRequirePartitionFilter() {
+ return requirePartitionFilter;
+ }
+
/** Returns a builder for the table object. */
public Builder toBuilder() {
return new BuilderImpl(this);
@@ -422,6 +445,7 @@ public String toString() {
.add("definition", definition)
.add("encryptionConfiguration", encryptionConfiguration)
.add("labels", labels)
+ .add("requirePartitionFilter", requirePartitionFilter)
.toString();
}
@@ -482,6 +506,7 @@ Table toPb() {
tablePb.setEncryptionConfiguration(encryptionConfiguration.toPb());
}
tablePb.setLabels(labels.toPb());
+ tablePb.setRequirePartitionFilter(requirePartitionFilter);
return tablePb;
}
diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableInfoTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableInfoTest.java
index 324f562cd..a44f70039 100644
--- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableInfoTest.java
+++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableInfoTest.java
@@ -36,6 +36,9 @@ public class TableInfoTest {
private static final Long CREATION_TIME = 10L;
private static final Long EXPIRATION_TIME = 100L;
private static final Long LAST_MODIFIED_TIME = 20L;
+ private static final Boolean REQUIRE_PARTITION_FILTER = true;
+ private static final EncryptionConfiguration ENCRYPTION_CONFIGURATION =
+ EncryptionConfiguration.newBuilder().setKmsKeyName("KMS_KEY_1").build();
private static final Field FIELD_SCHEMA1 =
Field.newBuilder("StringField", LegacySQLTypeName.STRING)
@@ -91,6 +94,7 @@ public class TableInfoTest {
TableInfo.newBuilder(TABLE_ID, TABLE_DEFINITION)
.setCreationTime(CREATION_TIME)
.setDescription(DESCRIPTION)
+ .setEncryptionConfiguration(ENCRYPTION_CONFIGURATION)
.setEtag(ETAG)
.setExpirationTime(EXPIRATION_TIME)
.setFriendlyName(FRIENDLY_NAME)
@@ -101,6 +105,7 @@ public class TableInfoTest {
.setNumRows(BigInteger.valueOf(NUM_ROWS))
.setSelfLink(SELF_LINK)
.setLabels(Collections.singletonMap("a", "b"))
+ .setRequirePartitionFilter(REQUIRE_PARTITION_FILTER)
.build();
private static final TableInfo VIEW_INFO =
TableInfo.newBuilder(TABLE_ID, VIEW_DEFINITION)
@@ -151,6 +156,7 @@ public void testBuilder() {
assertEquals(TABLE_ID, TABLE_INFO.getTableId());
assertEquals(CREATION_TIME, TABLE_INFO.getCreationTime());
assertEquals(DESCRIPTION, TABLE_INFO.getDescription());
+ assertEquals(ENCRYPTION_CONFIGURATION, TABLE_INFO.getEncryptionConfiguration());
assertEquals(ETAG, TABLE_INFO.getEtag());
assertEquals(EXPIRATION_TIME, TABLE_INFO.getExpirationTime());
assertEquals(FRIENDLY_NAME, TABLE_INFO.getFriendlyName());
@@ -161,6 +167,7 @@ public void testBuilder() {
assertEquals(NUM_BYTES, TABLE_INFO.getNumBytes());
assertEquals(NUM_LONG_TERM_BYTES, TABLE_INFO.getNumLongTermBytes());
assertEquals(BigInteger.valueOf(NUM_ROWS), TABLE_INFO.getNumRows());
+ assertEquals(REQUIRE_PARTITION_FILTER, TABLE_INFO.getRequirePartitionFilter());
assertEquals(TABLE_ID, VIEW_INFO.getTableId());
assertEquals(VIEW_DEFINITION, VIEW_INFO.getDefinition());
@@ -192,33 +199,39 @@ public void testOf() {
assertEquals(TABLE_ID, tableInfo.getTableId());
assertNull(tableInfo.getCreationTime());
assertNull(tableInfo.getDescription());
+ assertNull(tableInfo.getEncryptionConfiguration());
assertNull(tableInfo.getEtag());
assertNull(tableInfo.getExpirationTime());
assertNull(tableInfo.getFriendlyName());
assertNull(tableInfo.getGeneratedId());
assertNull(tableInfo.getLastModifiedTime());
+ assertNull(tableInfo.getRequirePartitionFilter());
assertEquals(TABLE_DEFINITION, tableInfo.getDefinition());
assertNull(tableInfo.getSelfLink());
tableInfo = TableInfo.of(TABLE_ID, VIEW_DEFINITION);
assertEquals(TABLE_ID, tableInfo.getTableId());
assertNull(tableInfo.getCreationTime());
assertNull(tableInfo.getDescription());
+ assertNull(tableInfo.getEncryptionConfiguration());
assertNull(tableInfo.getEtag());
assertNull(tableInfo.getExpirationTime());
assertNull(tableInfo.getFriendlyName());
assertNull(tableInfo.getGeneratedId());
assertNull(tableInfo.getLastModifiedTime());
+ assertNull(tableInfo.getRequirePartitionFilter());
assertEquals(VIEW_DEFINITION, tableInfo.getDefinition());
assertNull(tableInfo.getSelfLink());
tableInfo = TableInfo.of(TABLE_ID, EXTERNAL_TABLE_DEFINITION);
assertEquals(TABLE_ID, tableInfo.getTableId());
assertNull(tableInfo.getCreationTime());
assertNull(tableInfo.getDescription());
+ assertNull(tableInfo.getEncryptionConfiguration());
assertNull(tableInfo.getEtag());
assertNull(tableInfo.getExpirationTime());
assertNull(tableInfo.getFriendlyName());
assertNull(tableInfo.getGeneratedId());
assertNull(tableInfo.getLastModifiedTime());
+ assertNull(tableInfo.getRequirePartitionFilter());
assertEquals(EXTERNAL_TABLE_DEFINITION, tableInfo.getDefinition());
assertNull(tableInfo.getSelfLink());
}
@@ -250,6 +263,7 @@ private void compareTableInfo(TableInfo expected, TableInfo value) {
assertEquals(expected.getDefinition(), value.getDefinition());
assertEquals(expected.getCreationTime(), value.getCreationTime());
assertEquals(expected.getDescription(), value.getDescription());
+ assertEquals(expected.getEncryptionConfiguration(), value.getEncryptionConfiguration());
assertEquals(expected.getEtag(), value.getEtag());
assertEquals(expected.getExpirationTime(), value.getExpirationTime());
assertEquals(expected.getFriendlyName(), value.getFriendlyName());
@@ -260,6 +274,8 @@ private void compareTableInfo(TableInfo expected, TableInfo value) {
assertEquals(expected.getNumRows(), value.getNumRows());
assertEquals(expected.getSelfLink(), value.getSelfLink());
assertEquals(expected.getLabels(), value.getLabels());
+ assertEquals(expected.getRequirePartitionFilter(), value.getRequirePartitionFilter());
+ assertEquals(expected.toString(), value.toString());
assertEquals(expected.hashCode(), value.hashCode());
}
}
diff --git a/pom.xml b/pom.xml
index f69981aef..e4d19783f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.google.cloud
google-cloud-bigquery-parent
pom
- 1.107.0
+ 1.108.0
BigQuery Parent
https://github.com/googleapis/java-bigquery
@@ -63,11 +63,11 @@
UTF-8
github
google-cloud-bigquery-parent
- 1.92.5
+ 1.93.0
1.8.1
1.17.0
- 1.53.1
- 1.27.1
+ 1.54.0
+ 1.27.2
3.11.4
4.13
28.2-android
@@ -76,6 +76,9 @@
1.18
v2-rev20191211-1.30.8
+ 1.7
+ ${auto-value.version}
+ 1.0-rc6