Search in sources :

Example 1 with AppendRowsResponse

use of com.google.cloud.spark.bigquery.repackaged.com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse in project java-bigquerystorage by googleapis.

the class ITBigQueryTimeEncoderTest method TestTimeEncoding.

@Test
public void TestTimeEncoding() throws IOException, InterruptedException, ExecutionException, Descriptors.DescriptorValidationException {
    TableName parent = TableName.of(ServiceOptions.getDefaultProjectId(), DATASET, TABLE);
    TableFieldSchema TEST_STRING = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.STRING).setMode(TableFieldSchema.Mode.NULLABLE).setName("test_str").build();
    TableFieldSchema TEST_TIME = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.TIME).setMode(TableFieldSchema.Mode.REPEATED).setName("test_time_micros").build();
    TableFieldSchema TEST_DATETIME = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.DATETIME).setMode(TableFieldSchema.Mode.REPEATED).setName("test_datetime_micros").build();
    TableSchema tableSchema = TableSchema.newBuilder().addFields(0, TEST_STRING).addFields(1, TEST_TIME).addFields(2, TEST_DATETIME).build();
    try (JsonStreamWriter jsonStreamWriter = JsonStreamWriter.newBuilder(parent.toString(), tableSchema).build()) {
        JSONObject row = new JSONObject();
        row.put("test_str", "Start of the day");
        row.put("test_time_micros", new JSONArray(new long[] { CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(13, 14, 15, 16_000_000)), CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(23, 59, 59, 999_999_000)), CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(0, 0, 0, 0)), CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(1, 2, 3, 4_000)), CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(5, 6, 7, 8_000)) }));
        row.put("test_datetime_micros", new JSONArray(new long[] { CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(1, 1, 1, 12, 0, 0, 0)), CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(1995, 5, 19, 10, 30, 45, 0)), CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(2000, 1, 1, 0, 0, 0, 0)), CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(2026, 3, 11, 5, 45, 12, 9_000_000)), CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(2050, 1, 2, 3, 4, 5, 6_000)) }));
        JSONArray jsonArr = new JSONArray(new JSONObject[] { row });
        ApiFuture<AppendRowsResponse> response = jsonStreamWriter.append(jsonArr, -1);
        Assert.assertFalse(response.get().getAppendResult().hasOffset());
        TableResult result = bigquery.listTableData(tableInfo.getTableId(), BigQuery.TableDataListOption.startIndex(0L));
        Iterator<FieldValueList> iter = result.getValues().iterator();
        FieldValueList currentRow;
        currentRow = iter.next();
        assertEquals("Start of the day", currentRow.get(0).getValue());
        assertEquals("13:14:15.016000", currentRow.get(1).getRepeatedValue().get(0).getStringValue());
        assertEquals("23:59:59.999999", currentRow.get(1).getRepeatedValue().get(1).getStringValue());
        assertEquals("00:00:00", currentRow.get(1).getRepeatedValue().get(2).getStringValue());
        assertEquals("01:02:03.000004", currentRow.get(1).getRepeatedValue().get(3).getStringValue());
        assertEquals("05:06:07.000008", currentRow.get(1).getRepeatedValue().get(4).getStringValue());
        assertEquals("0001-01-01T12:00:00", currentRow.get(2).getRepeatedValue().get(0).getStringValue());
        assertEquals("1995-05-19T10:30:45", currentRow.get(2).getRepeatedValue().get(1).getStringValue());
        assertEquals("2000-01-01T00:00:00", currentRow.get(2).getRepeatedValue().get(2).getStringValue());
        assertEquals("2026-03-11T05:45:12.009000", currentRow.get(2).getRepeatedValue().get(3).getStringValue());
        assertEquals("2050-01-02T03:04:05.000006", currentRow.get(2).getRepeatedValue().get(4).getStringValue());
    }
}
Also used : TableName(com.google.cloud.bigquery.storage.v1beta2.TableName) TableResult(com.google.cloud.bigquery.TableResult) TableSchema(com.google.cloud.bigquery.storage.v1beta2.TableSchema) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) AppendRowsResponse(com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse) FieldValueList(com.google.cloud.bigquery.FieldValueList) TableFieldSchema(com.google.cloud.bigquery.storage.v1beta2.TableFieldSchema) JsonStreamWriter(com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter) Test(org.junit.Test)

Example 2 with AppendRowsResponse

use of com.google.cloud.spark.bigquery.repackaged.com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse in project java-bigquerystorage by googleapis.

the class ITBigQueryBigDecimalByteStringEncoderTest method TestBigDecimalEncoding.

@Test
public void TestBigDecimalEncoding() throws IOException, InterruptedException, ExecutionException, Descriptors.DescriptorValidationException {
    TableName parent = TableName.of(ServiceOptions.getDefaultProjectId(), DATASET, TABLE);
    TableFieldSchema TEST_NUMERIC_ZERO = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.NUMERIC).setMode(TableFieldSchema.Mode.NULLABLE).setName("test_numeric_zero").build();
    TableFieldSchema TEST_NUMERIC_ONE = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.NUMERIC).setMode(TableFieldSchema.Mode.NULLABLE).setName("test_numeric_one").build();
    TableFieldSchema TEST_NUMERIC_REPEATED = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.NUMERIC).setMode(TableFieldSchema.Mode.REPEATED).setName("test_numeric_repeated").build();
    TableSchema tableSchema = TableSchema.newBuilder().addFields(0, TEST_NUMERIC_ZERO).addFields(1, TEST_NUMERIC_ONE).addFields(2, TEST_NUMERIC_REPEATED).build();
    try (JsonStreamWriter jsonStreamWriter = JsonStreamWriter.newBuilder(parent.toString(), tableSchema).build()) {
        JSONObject row = new JSONObject();
        row.put("test_numeric_zero", BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("0")));
        row.put("test_numeric_one", BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("1.2")));
        row.put("test_numeric_repeated", new JSONArray(new byte[][] { BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("0")).toByteArray(), BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("1.2")).toByteArray(), BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("-1.2")).toByteArray(), BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("99999999999999999999999999999.999999999")).toByteArray(), BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("-99999999999999999999999999999.999999999")).toByteArray() }));
        JSONArray jsonArr = new JSONArray(new JSONObject[] { row });
        ApiFuture<AppendRowsResponse> response = jsonStreamWriter.append(jsonArr, -1);
        AppendRowsResponse arr = response.get();
        AppendResult ar = arr.getAppendResult();
        boolean ho = ar.hasOffset();
        TableResult result = bigquery.listTableData(tableInfo.getTableId(), BigQuery.TableDataListOption.startIndex(0L));
        Iterator<FieldValueList> iter = result.getValues().iterator();
        FieldValueList currentRow;
        currentRow = iter.next();
        assertEquals("0", currentRow.get(0).getStringValue());
        assertEquals("1.2", currentRow.get(1).getStringValue());
        assertEquals("0", currentRow.get(2).getRepeatedValue().get(0).getStringValue());
        assertEquals("1.2", currentRow.get(2).getRepeatedValue().get(1).getStringValue());
        assertEquals("-1.2", currentRow.get(2).getRepeatedValue().get(2).getStringValue());
        assertEquals("99999999999999999999999999999.999999999", currentRow.get(2).getRepeatedValue().get(3).getStringValue());
        assertEquals("-99999999999999999999999999999.999999999", currentRow.get(2).getRepeatedValue().get(4).getStringValue());
    }
}
Also used : TableSchema(com.google.cloud.bigquery.storage.v1beta2.TableSchema) JSONArray(org.json.JSONArray) AppendRowsResponse(com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse) TableFieldSchema(com.google.cloud.bigquery.storage.v1beta2.TableFieldSchema) BigDecimal(java.math.BigDecimal) TableName(com.google.cloud.bigquery.storage.v1beta2.TableName) TableResult(com.google.cloud.bigquery.TableResult) JSONObject(org.json.JSONObject) AppendResult(com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse.AppendResult) FieldValueList(com.google.cloud.bigquery.FieldValueList) JsonStreamWriter(com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter) Test(org.junit.Test)

Example 3 with AppendRowsResponse

use of com.google.cloud.spark.bigquery.repackaged.com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse in project java-bigquerystorage by googleapis.

the class ITBigQueryTimeEncoderTest method TestTimeEncoding.

@Test
public void TestTimeEncoding() throws IOException, InterruptedException, ExecutionException, Descriptors.DescriptorValidationException {
    TableName parent = TableName.of(ServiceOptions.getDefaultProjectId(), DATASET, TABLE);
    TableFieldSchema TEST_STRING = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.STRING).setMode(TableFieldSchema.Mode.NULLABLE).setName("test_str").build();
    TableFieldSchema TEST_TIME = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.TIME).setMode(TableFieldSchema.Mode.REPEATED).setName("test_time_micros").build();
    TableFieldSchema TEST_DATETIME = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.DATETIME).setMode(TableFieldSchema.Mode.REPEATED).setName("test_datetime_micros").build();
    TableFieldSchema TEST_DATE_REPEATED = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.DATE).setMode(TableFieldSchema.Mode.REPEATED).setName("test_date_repeated").build();
    TableFieldSchema TEST_DATE = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.DATE).setMode(TableFieldSchema.Mode.NULLABLE).setName("test_date").build();
    TableSchema tableSchema = TableSchema.newBuilder().addFields(0, TEST_STRING).addFields(1, TEST_TIME).addFields(2, TEST_DATETIME).addFields(3, TEST_DATE_REPEATED).addFields(4, TEST_DATE).build();
    try (JsonStreamWriter jsonStreamWriter = JsonStreamWriter.newBuilder(parent.toString(), tableSchema).build()) {
        JSONObject row = new JSONObject();
        row.put("test_str", "Start of the day");
        row.put("test_time_micros", new JSONArray(new long[] { CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(13, 14, 15, 16_000_000)), CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(23, 59, 59, 999_999_000)), CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(0, 0, 0, 0)), CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(1, 2, 3, 4_000)), CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(5, 6, 7, 8_000)) }));
        row.put("test_datetime_micros", new JSONArray(new long[] { CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(1, 1, 1, 12, 0, 0, 0)), CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(1995, 5, 19, 10, 30, 45, 0)), CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(2000, 1, 1, 0, 0, 0, 0)), CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(2026, 3, 11, 5, 45, 12, 9_000_000)), CivilTimeEncoder.encodePacked64DatetimeMicros(LocalDateTime.of(2050, 1, 2, 3, 4, 5, 6_000)) }));
        row.put("test_date_repeated", new JSONArray(new int[] { 0, 300, 14238 }));
        row.put("test_date", 300);
        JSONArray jsonArr = new JSONArray(new JSONObject[] { row });
        ApiFuture<AppendRowsResponse> response = jsonStreamWriter.append(jsonArr, -1);
        Assert.assertFalse(response.get().getAppendResult().hasOffset());
        TableResult result = bigquery.listTableData(tableInfo.getTableId(), BigQuery.TableDataListOption.startIndex(0L));
        Iterator<FieldValueList> iter = result.getValues().iterator();
        FieldValueList currentRow;
        currentRow = iter.next();
        assertEquals("Start of the day", currentRow.get(0).getValue());
        assertEquals("13:14:15.016000", currentRow.get(1).getRepeatedValue().get(0).getStringValue());
        assertEquals("23:59:59.999999", currentRow.get(1).getRepeatedValue().get(1).getStringValue());
        assertEquals("00:00:00", currentRow.get(1).getRepeatedValue().get(2).getStringValue());
        assertEquals("01:02:03.000004", currentRow.get(1).getRepeatedValue().get(3).getStringValue());
        assertEquals("05:06:07.000008", currentRow.get(1).getRepeatedValue().get(4).getStringValue());
        assertEquals("0001-01-01T12:00:00", currentRow.get(2).getRepeatedValue().get(0).getStringValue());
        assertEquals("1995-05-19T10:30:45", currentRow.get(2).getRepeatedValue().get(1).getStringValue());
        assertEquals("2000-01-01T00:00:00", currentRow.get(2).getRepeatedValue().get(2).getStringValue());
        assertEquals("1970-01-01", currentRow.get(3).getRepeatedValue().get(0).getStringValue());
        assertEquals("1970-10-28", currentRow.get(3).getRepeatedValue().get(1).getStringValue());
        assertEquals("2008-12-25", currentRow.get(3).getRepeatedValue().get(2).getStringValue());
        assertEquals("1970-10-28", currentRow.get(4).getStringValue());
        assertEquals("2026-03-11T05:45:12.009000", currentRow.get(2).getRepeatedValue().get(3).getStringValue());
        assertEquals("2050-01-02T03:04:05.000006", currentRow.get(2).getRepeatedValue().get(4).getStringValue());
    }
}
Also used : TableName(com.google.cloud.bigquery.storage.v1beta2.TableName) TableResult(com.google.cloud.bigquery.TableResult) TableSchema(com.google.cloud.bigquery.storage.v1beta2.TableSchema) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) AppendRowsResponse(com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse) FieldValueList(com.google.cloud.bigquery.FieldValueList) TableFieldSchema(com.google.cloud.bigquery.storage.v1beta2.TableFieldSchema) JsonStreamWriter(com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter) Test(org.junit.Test)

Example 4 with AppendRowsResponse

use of com.google.cloud.spark.bigquery.repackaged.com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse in project java-bigquerystorage by googleapis.

the class ITBigQueryBigDecimalByteStringEncoderTest method TestBigDecimalEncoding.

@Test
public void TestBigDecimalEncoding() throws IOException, InterruptedException, ExecutionException, Descriptors.DescriptorValidationException {
    TableName parent = TableName.of(ServiceOptions.getDefaultProjectId(), DATASET, TABLE);
    TableFieldSchema TEST_NUMERIC_ZERO = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.NUMERIC).setMode(TableFieldSchema.Mode.NULLABLE).setName("test_numeric_zero").build();
    TableFieldSchema TEST_NUMERIC_ONE = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.NUMERIC).setMode(TableFieldSchema.Mode.NULLABLE).setName("test_numeric_one").build();
    TableFieldSchema TEST_NUMERIC_REPEATED = TableFieldSchema.newBuilder().setType(TableFieldSchema.Type.NUMERIC).setMode(TableFieldSchema.Mode.REPEATED).setName("test_numeric_repeated").build();
    TableSchema tableSchema = TableSchema.newBuilder().addFields(0, TEST_NUMERIC_ZERO).addFields(1, TEST_NUMERIC_ONE).addFields(2, TEST_NUMERIC_REPEATED).build();
    try (JsonStreamWriter jsonStreamWriter = JsonStreamWriter.newBuilder(parent.toString(), tableSchema).build()) {
        JSONObject row = new JSONObject();
        row.put("test_numeric_zero", BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("0")));
        row.put("test_numeric_one", BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("1.2")));
        row.put("test_numeric_repeated", new JSONArray(new byte[][] { BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("0")).toByteArray(), BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("1.2")).toByteArray(), BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("-1.2")).toByteArray(), BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("99999999999999999999999999999.999999999")).toByteArray(), BigDecimalByteStringEncoder.encodeToNumericByteString(new BigDecimal("-99999999999999999999999999999.999999999")).toByteArray() }));
        JSONArray jsonArr = new JSONArray(new JSONObject[] { row });
        ApiFuture<AppendRowsResponse> response = jsonStreamWriter.append(jsonArr, -1);
        AppendRowsResponse arr = response.get();
        AppendResult ar = arr.getAppendResult();
        boolean ho = ar.hasOffset();
        TableResult result = bigquery.listTableData(tableInfo.getTableId(), BigQuery.TableDataListOption.startIndex(0L));
        Iterator<FieldValueList> iter = result.getValues().iterator();
        FieldValueList currentRow;
        currentRow = iter.next();
        assertEquals("0", currentRow.get(0).getStringValue());
        assertEquals("1.2", currentRow.get(1).getStringValue());
        assertEquals("0", currentRow.get(2).getRepeatedValue().get(0).getStringValue());
        assertEquals("1.2", currentRow.get(2).getRepeatedValue().get(1).getStringValue());
        assertEquals("-1.2", currentRow.get(2).getRepeatedValue().get(2).getStringValue());
        assertEquals("99999999999999999999999999999.999999999", currentRow.get(2).getRepeatedValue().get(3).getStringValue());
        assertEquals("-99999999999999999999999999999.999999999", currentRow.get(2).getRepeatedValue().get(4).getStringValue());
    }
}
Also used : TableSchema(com.google.cloud.bigquery.storage.v1beta2.TableSchema) JSONArray(org.json.JSONArray) AppendRowsResponse(com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse) TableFieldSchema(com.google.cloud.bigquery.storage.v1beta2.TableFieldSchema) BigDecimal(java.math.BigDecimal) TableName(com.google.cloud.bigquery.storage.v1beta2.TableName) TableResult(com.google.cloud.bigquery.TableResult) JSONObject(org.json.JSONObject) AppendResult(com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse.AppendResult) FieldValueList(com.google.cloud.bigquery.FieldValueList) JsonStreamWriter(com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter) Test(org.junit.Test)

Example 5 with AppendRowsResponse

use of com.google.cloud.spark.bigquery.repackaged.com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse in project java-bigquerystorage by googleapis.

the class WriteCommittedStream method writeCommittedStream.

public static void writeCommittedStream(String projectId, String datasetName, String tableName) throws DescriptorValidationException, InterruptedException, IOException {
    try (BigQueryWriteClient client = BigQueryWriteClient.create()) {
        // Initialize a write stream for the specified table.
        // For more information on WriteStream.Type, see:
        // https://googleapis.dev/java/google-cloud-bigquerystorage/latest/com/google/cloud/bigquery/storage/v1beta2/WriteStream.Type.html
        WriteStream stream = WriteStream.newBuilder().setType(WriteStream.Type.COMMITTED).build();
        TableName parentTable = TableName.of(projectId, datasetName, tableName);
        CreateWriteStreamRequest createWriteStreamRequest = CreateWriteStreamRequest.newBuilder().setParent(parentTable.toString()).setWriteStream(stream).build();
        WriteStream writeStream = client.createWriteStream(createWriteStreamRequest);
        // https://googleapis.dev/java/google-cloud-bigquerystorage/latest/com/google/cloud/bigquery/storage/v1/JsonStreamWriter.html
        try (JsonStreamWriter writer = JsonStreamWriter.newBuilder(writeStream.getName(), writeStream.getTableSchema()).build()) {
            // antipattern.
            for (int i = 0; i < 2; i++) {
                // Create a JSON object that is compatible with the table schema.
                JSONArray jsonArr = new JSONArray();
                for (int j = 0; j < 10; j++) {
                    JSONObject record = new JSONObject();
                    record.put("col1", String.format("record %03d-%03d", i, j));
                    jsonArr.put(record);
                }
                // To detect duplicate records, pass the index as the record offset.
                // To disable deduplication, omit the offset or use WriteStream.Type.DEFAULT.
                ApiFuture<AppendRowsResponse> future = writer.append(jsonArr, /*offset=*/
                i * 10);
                AppendRowsResponse response = future.get();
            }
            // Finalize the stream after use.
            FinalizeWriteStreamRequest finalizeWriteStreamRequest = FinalizeWriteStreamRequest.newBuilder().setName(writeStream.getName()).build();
            client.finalizeWriteStream(finalizeWriteStreamRequest);
        }
        System.out.println("Appended records successfully.");
    } catch (ExecutionException e) {
        // If the wrapped exception is a StatusRuntimeException, check the state of the operation.
        // If the state is INTERNAL, CANCELLED, or ABORTED, you can retry. For more information, see:
        // https://grpc.github.io/grpc-java/javadoc/io/grpc/StatusRuntimeException.html
        System.out.println("Failed to append records. \n" + e.toString());
    }
}
Also used : TableName(com.google.cloud.bigquery.storage.v1.TableName) CreateWriteStreamRequest(com.google.cloud.bigquery.storage.v1.CreateWriteStreamRequest) FinalizeWriteStreamRequest(com.google.cloud.bigquery.storage.v1.FinalizeWriteStreamRequest) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) AppendRowsResponse(com.google.cloud.bigquery.storage.v1.AppendRowsResponse) WriteStream(com.google.cloud.bigquery.storage.v1.WriteStream) BigQueryWriteClient(com.google.cloud.bigquery.storage.v1.BigQueryWriteClient) ExecutionException(java.util.concurrent.ExecutionException) JsonStreamWriter(com.google.cloud.bigquery.storage.v1.JsonStreamWriter)

Aggregations

JSONArray (org.json.JSONArray)9 JSONObject (org.json.JSONObject)9 AppendRowsResponse (com.google.cloud.bigquery.storage.v1.AppendRowsResponse)8 JsonStreamWriter (com.google.cloud.bigquery.storage.v1.JsonStreamWriter)5 TableName (com.google.cloud.bigquery.storage.v1.TableName)5 ExecutionException (java.util.concurrent.ExecutionException)5 FieldValueList (com.google.cloud.bigquery.FieldValueList)4 TableResult (com.google.cloud.bigquery.TableResult)4 WriteStream (com.google.cloud.bigquery.storage.v1.WriteStream)4 AppendRowsResponse (com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse)4 JsonStreamWriter (com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter)4 TableFieldSchema (com.google.cloud.bigquery.storage.v1beta2.TableFieldSchema)4 TableName (com.google.cloud.bigquery.storage.v1beta2.TableName)4 TableSchema (com.google.cloud.bigquery.storage.v1beta2.TableSchema)4 Test (org.junit.Test)4 BigQueryWriteClient (com.google.cloud.bigquery.storage.v1.BigQueryWriteClient)3 CreateWriteStreamRequest (com.google.cloud.bigquery.storage.v1.CreateWriteStreamRequest)3 BigQuery (com.google.cloud.bigquery.BigQuery)2 Schema (com.google.cloud.bigquery.Schema)2 Table (com.google.cloud.bigquery.Table)2