Skip to content
Merged
10 changes: 4 additions & 6 deletions .kokoro/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ function determineMavenOpts() {
| sed -E 's/^(1\.[0-9]\.0).*$/\1/g'
)

case $javaVersion in
"17")
if [[ $javaVersion == 17* ]]
then
# MaxPermSize is no longer supported as of jdk 17
echo -n "-Xmx1024m"
;;
*)
else
echo -n "-Xmx1024m -XX:MaxPermSize=128m"
;;
esac
fi
}

export MAVEN_OPTS=$(determineMavenOpts)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-bigquerystorage'
If you are using Gradle without BOM, add this to your dependencies

```Groovy
implementation 'com.google.cloud:google-cloud-bigquerystorage:2.4.0'
implementation 'com.google.cloud:google-cloud-bigquerystorage:2.4.2'
```

If you are using SBT, add this to your dependencies

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-bigquerystorage" % "2.4.0"
libraryDependencies += "com.google.cloud" % "google-cloud-bigquerystorage" % "2.4.2"
```

## Authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private static DynamicMessage convertJsonToProtoMessageImpl(
if (tableSchema != null) {
// protoSchema is generated from tableSchema so their field ordering should match.
fieldSchema = tableSchema.get(field.getIndex());
if (!fieldSchema.getName().equals(field.getName())) {
if (!fieldSchema.getName().toLowerCase().equals(field.getName())) {
throw new ValidationException(
"Field at index "
+ field.getIndex()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private static DynamicMessage convertJsonToProtoMessageImpl(
if (tableSchema != null) {
// protoSchema is generated from tableSchema so their field ordering should match.
fieldSchema = tableSchema.get(field.getIndex());
if (!fieldSchema.getName().equals(field.getName())) {
if (!fieldSchema.getName().toLowerCase().equals(field.getName())) {
throw new ValidationException(
"Field at index "
+ field.getIndex()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,24 @@ public void testNumericMismatch() throws Exception {
}
}

@Test
public void testMixedCaseFieldNames() throws Exception {
TableFieldSchema field =
TableFieldSchema.newBuilder()
.setName("fooBar")
.setType(TableFieldSchema.Type.STRING)
.setMode(TableFieldSchema.Mode.NULLABLE)
.build();
TableSchema tableSchema = TableSchema.newBuilder().addFields(field).build();

JSONObject json = new JSONObject();
json.put("fooBar", "hello");

DynamicMessage protoMsg =
JsonToProtoMessage.convertJsonToProtoMessage(
TestMixedCaseFieldNames.getDescriptor(), tableSchema, json);
}

@Test
public void testBigNumericMismatch() throws Exception {
TableFieldSchema field =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,25 @@ public void testBigNumericMismatch() throws Exception {
}
}

@Test
public void testMixedCasedFieldNames() throws Exception {
com.google.cloud.bigquery.storage.v1.TableFieldSchema field =
com.google.cloud.bigquery.storage.v1.TableFieldSchema.newBuilder()
.setName("fooBar")
.setType(com.google.cloud.bigquery.storage.v1.TableFieldSchema.Type.STRING)
.setMode(com.google.cloud.bigquery.storage.v1.TableFieldSchema.Mode.NULLABLE)
.build();
com.google.cloud.bigquery.storage.v1.TableSchema tableSchema =
com.google.cloud.bigquery.storage.v1.TableSchema.newBuilder().addFields(field).build();

JSONObject json = new JSONObject();
json.put("fooBar", "hello");

DynamicMessage protoMsg =
com.google.cloud.bigquery.storage.v1.JsonToProtoMessage.convertJsonToProtoMessage(
TestMixedCaseFieldNames.getDescriptor(), tableSchema, json);
}

@Test
public void testDouble() throws Exception {
TestDouble expectedProto = TestDouble.newBuilder().setDouble(1.2).setFloat(3.4f).build();
Expand Down
4 changes: 4 additions & 0 deletions google-cloud-bigquerystorage/src/test/proto/jsonTest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,7 @@ message TestNumeric {
message TestBignumeric {
repeated bytes bignumeric = 1;
}

message TestMixedCaseFieldNames {
required string foobar = 1;
}