diff --git a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java b/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java index 21df417ecc41..70ade809b8ee 100644 --- a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java +++ b/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java @@ -276,7 +276,9 @@ public Table apply(TableList.Tables tablePb) { .setId(tablePb.getId()) .setKind(tablePb.getKind()) .setTableReference(tablePb.getTableReference()) - .setType(tablePb.getType()); + .setType(tablePb.getType()) + .setCreationTime(tablePb.getCreationTime()) + .setTimePartitioning(tablePb.getTimePartitioning()); } })); } catch (IOException ex) { diff --git a/google-cloud-clients/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java b/google-cloud-clients/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java index 8ee3bac25e55..c69eb2532506 100644 --- a/google-cloud-clients/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java +++ b/google-cloud-clients/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java @@ -111,12 +111,25 @@ public class BigQueryImplTest { StandardTableDefinition.of(TABLE_SCHEMA); private static final ModelTableDefinition MODEL_TABLE_DEFINITION = ModelTableDefinition.newBuilder().build(); + private static final Long EXPIRATION_MS = 86400000L; + private static final Long TABLE_CREATION_TIME = 1546275600000L; + private static final TimePartitioning TIME_PARTITIONING = + TimePartitioning.of(TimePartitioning.Type.DAY, EXPIRATION_MS); + private static final StandardTableDefinition TABLE_DEFINITION_WITH_PARTITIONING = + StandardTableDefinition.newBuilder() + .setSchema(TABLE_SCHEMA) + .setTimePartitioning(TIME_PARTITIONING) + .build(); private static final TableInfo TABLE_INFO = TableInfo.of(TABLE_ID, TABLE_DEFINITION); private static final TableInfo OTHER_TABLE_INFO = TableInfo.of(OTHER_TABLE_ID, TABLE_DEFINITION); private static final TableInfo TABLE_INFO_WITH_PROJECT = TableInfo.of(TABLE_ID_WITH_PROJECT, TABLE_DEFINITION); private static final TableInfo MODEL_TABLE_INFO_WITH_PROJECT = TableInfo.of(TABLE_ID_WITH_PROJECT, MODEL_TABLE_DEFINITION); + private static final TableInfo TABLE_INFO_WITH_PARTITIONS = + TableInfo.newBuilder(TABLE_ID, TABLE_DEFINITION_WITH_PARTITIONING) + .setCreationTime(TABLE_CREATION_TIME) + .build(); private static final LoadJobConfiguration LOAD_JOB_CONFIGURATION = LoadJobConfiguration.of(TABLE_ID, "URI"); private static final LoadJobConfiguration LOAD_JOB_CONFIGURATION_WITH_PROJECT = @@ -721,6 +734,22 @@ public void testListTables() { assertArrayEquals(tableList.toArray(), Iterables.toArray(page.getValues(), Table.class)); } + @Test + public void testListTablesReturnedParameters() { + bigquery = options.getService(); + ImmutableList