Skip to content

Commit

Permalink
Made changes to fix bug GoogleCloudDataproc#221
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuval Medina committed Jul 27, 2020
1 parent 0087ca0 commit 6e5e80c
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.google.cloud.spark.bigquery;

import com.google.cloud.bigquery.Field;
import com.google.cloud.bigquery.FieldList;
import com.google.cloud.bigquery.LegacySQLTypeName;
import com.google.cloud.bigquery.Schema;
import com.google.cloud.bigquery.storage.v1alpha2.ProtoBufProto;
Expand Down Expand Up @@ -204,29 +203,28 @@ public void testSettingARequiredFieldAsNull() throws Exception {
.add(SPARK_NUMERIC_FIELD);


public final Field BIGQUERY_INTEGER_FIELD = Field.newBuilder("Number", LegacySQLTypeName.INTEGER,
(FieldList)null).setMode(Field.Mode.NULLABLE).build();
public final Field BIGQUERY_STRING_FIELD = Field.newBuilder("String", LegacySQLTypeName.STRING, (FieldList) null)
public final Field BIGQUERY_INTEGER_FIELD = Field.newBuilder("Number", LegacySQLTypeName.INTEGER).setMode(Field.Mode.NULLABLE).build();
public final Field BIGQUERY_STRING_FIELD = Field.newBuilder("String", LegacySQLTypeName.STRING)
.setMode(Field.Mode.REQUIRED).build();
public final Field BIGQUERY_NESTED_STRUCT_FIELD = Field.newBuilder("Struct", LegacySQLTypeName.RECORD,
Field.newBuilder("Number", LegacySQLTypeName.INTEGER, (FieldList) null)
Field.newBuilder("Number", LegacySQLTypeName.INTEGER)
.setMode(Field.Mode.NULLABLE).build(),
Field.newBuilder("String", LegacySQLTypeName.STRING, (FieldList) null)
Field.newBuilder("String", LegacySQLTypeName.STRING)
.setMode(Field.Mode.NULLABLE).build())
.setMode(Field.Mode.NULLABLE).build();
public final Field BIGQUERY_ARRAY_FIELD = Field.newBuilder("Array", LegacySQLTypeName.INTEGER, (FieldList) null)
public final Field BIGQUERY_ARRAY_FIELD = Field.newBuilder("Array", LegacySQLTypeName.INTEGER)
.setMode(Field.Mode.REPEATED).build();
public final Field BIGQUERY_FLOAT_FIELD = Field.newBuilder("Float", LegacySQLTypeName.FLOAT, (FieldList)null)
public final Field BIGQUERY_FLOAT_FIELD = Field.newBuilder("Float", LegacySQLTypeName.FLOAT)
.setMode(Field.Mode.NULLABLE).build();
public final Field BIGQUERY_BOOLEAN_FIELD = Field.newBuilder("Boolean", LegacySQLTypeName.BOOLEAN, (FieldList)null)
public final Field BIGQUERY_BOOLEAN_FIELD = Field.newBuilder("Boolean", LegacySQLTypeName.BOOLEAN)
.setMode(Field.Mode.NULLABLE).build();
public final Field BIGQUERY_BYTES_FIELD = Field.newBuilder("Binary", LegacySQLTypeName.BYTES, (FieldList)null)
public final Field BIGQUERY_BYTES_FIELD = Field.newBuilder("Binary", LegacySQLTypeName.BYTES)
.setMode(Field.Mode.NULLABLE).build();
public final Field BIGQUERY_DATE_FIELD = Field.newBuilder("Date", LegacySQLTypeName.DATE, (FieldList)null)
public final Field BIGQUERY_DATE_FIELD = Field.newBuilder("Date", LegacySQLTypeName.DATE)
.setMode(Field.Mode.NULLABLE).build();
public final Field BIGQUERY_TIMESTAMP_FIELD = Field.newBuilder("TimeStamp", LegacySQLTypeName.TIMESTAMP, (FieldList)null)
public final Field BIGQUERY_TIMESTAMP_FIELD = Field.newBuilder("TimeStamp", LegacySQLTypeName.TIMESTAMP)
.setMode(Field.Mode.NULLABLE).build();
public final Field BIGQUERY_NUMERIC_FIELD = Field.newBuilder("Numeric", LegacySQLTypeName.NUMERIC, (FieldList)null)
public final Field BIGQUERY_NUMERIC_FIELD = Field.newBuilder("Numeric", LegacySQLTypeName.NUMERIC)
.setMode(Field.Mode.NULLABLE).build();

public final Schema BIG_BIGQUERY_SCHEMA = Schema.of(BIGQUERY_INTEGER_FIELD, BIGQUERY_STRING_FIELD, BIGQUERY_ARRAY_FIELD,
Expand All @@ -250,14 +248,14 @@ public void testSettingARequiredFieldAsNull() throws Exception {
.setType(DescriptorProtos.FieldDescriptorProto.Type.TYPE_INT64)
.setLabel(DescriptorProtos.FieldDescriptorProto.Label.LABEL_REPEATED);
public final DescriptorProtos.DescriptorProto.Builder NESTED_STRUCT_DESCRIPTOR = DescriptorProtos.DescriptorProto.newBuilder()
.setName("STRUCT1")
.setName("STRUCT4")
.addField(PROTO_INTEGER_FIELD.clone())
.addField(PROTO_STRING_FIELD.clone().setNumber(2)
.setLabel(DescriptorProtos.FieldDescriptorProto.Label.LABEL_OPTIONAL));
public final DescriptorProtos.FieldDescriptorProto.Builder PROTO_STRUCT_FIELD = DescriptorProtos.FieldDescriptorProto.newBuilder()
.setName("Struct")
.setNumber(1)
.setTypeName("STRUCT1")
.setTypeName("STRUCT4")
.setLabel(DescriptorProtos.FieldDescriptorProto.Label.LABEL_OPTIONAL);
public final DescriptorProtos.FieldDescriptorProto.Builder PROTO_DOUBLE_FIELD = DescriptorProtos.FieldDescriptorProto.newBuilder()
.setName("Double")
Expand Down

0 comments on commit 6e5e80c

Please sign in to comment.