Skip to content
Permalink
Browse files
fix: update listPartitions() to support tables from other projects (#974
)

* fix: update listPartitions() to support tables from other projects

* code format

Co-authored-by: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com>

Co-authored-by: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com>
  • Loading branch information
davidrabinowitz and yoshi-code-bot committed Nov 25, 2020
1 parent 9028ee4 commit 1739d57c59cfb6b90ccf3fcc9c07d1449fc17238
Showing with 6 additions and 2 deletions.
  1. +6 −2 google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java
@@ -848,8 +848,12 @@ public Page<Routine> listRoutines(DatasetId datasetId, RoutineListOption... opti
@Override
public List<String> listPartitions(TableId tableId) {
List<String> partitions = new ArrayList<String>();
Table metaTable =
getTable(TableId.of(tableId.getDataset(), tableId.getTable() + "$__PARTITIONS_SUMMARY__"));
String partitionsTable = tableId.getTable() + "$__PARTITIONS_SUMMARY__";
TableId metaTableId =
tableId.getProject() == null
? TableId.of(tableId.getDataset(), partitionsTable)
: TableId.of(tableId.getProject(), tableId.getDataset(), partitionsTable);
Table metaTable = getTable(metaTableId);
Schema metaSchema = metaTable.getDefinition().getSchema();
String partition_id = null;
for (Field field : metaSchema.getFields()) {

0 comments on commit 1739d57

Please sign in to comment.