@Test public void testToStringThrowsWhenDatasetIsEmpty() { TableReference tableRef = new TableReference() .setProjectId("foo-proj") .setDatasetId("") .setTableId("tableId"); assertThrows(IllegalArgumentException.class, () -> BigQueryStrings.toString(tableRef)); }
public static String toString(TableReference tableRef) { Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getDatasetId()), "tableRef must contain non-empty DatasetId."); Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getTableId()), "tableRef must contain non-empty TableId."); if (Strings.isNullOrEmpty(tableRef.getProjectId())) { return String.format("%s.%s", tableRef.getDatasetId(), tableRef.getTableId()); } else { return String.format("%s:%s.%s", tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId()); } }
BigQueryStrings { public static String toString(TableReference tableRef) { Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getDatasetId()), "tableRef must contain non-empty DatasetId."); Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getTableId()), "tableRef must contain non-empty TableId."); if (Strings.isNullOrEmpty(tableRef.getProjectId())) { return String.format("%s.%s", tableRef.getDatasetId(), tableRef.getTableId()); } else { return String.format("%s:%s.%s", tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId()); } } }
BigQueryStrings { public static String toString(TableReference tableRef) { Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getDatasetId()), "tableRef must contain non-empty DatasetId."); Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getTableId()), "tableRef must contain non-empty TableId."); if (Strings.isNullOrEmpty(tableRef.getProjectId())) { return String.format("%s.%s", tableRef.getDatasetId(), tableRef.getTableId()); } else { return String.format("%s:%s.%s", tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId()); } }  }
BigQueryStrings { public static String toString(TableReference tableRef) { Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getDatasetId()), "tableRef must contain non-empty DatasetId."); Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getTableId()), "tableRef must contain non-empty TableId."); if (Strings.isNullOrEmpty(tableRef.getProjectId())) { return String.format("%s.%s", tableRef.getDatasetId(), tableRef.getTableId()); } else { return String.format("%s:%s.%s", tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId()); } }  static String toString(TableReference tableRef); static TableReference parseTableReference(String tableRefString); }
BigQueryStrings { public static String toString(TableReference tableRef) { Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getDatasetId()), "tableRef must contain non-empty DatasetId."); Preconditions.checkArgument(!Strings.isNullOrEmpty(tableRef.getTableId()), "tableRef must contain non-empty TableId."); if (Strings.isNullOrEmpty(tableRef.getProjectId())) { return String.format("%s.%s", tableRef.getDatasetId(), tableRef.getTableId()); } else { return String.format("%s:%s.%s", tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId()); } }  static String toString(TableReference tableRef); static TableReference parseTableReference(String tableRefString); static final String DATASET_AND_TABLE_REGEX; }