@Test public void testParseTableReferenceThrowsWhenTableIsEmpty() { assertThrows(IllegalArgumentException.class, () -> BigQueryStrings.parseTableReference(".bar")); }
public static TableReference parseTableReference(String tableRefString) { TableReference tableRef = new TableReference(); int projectIdEnd = tableRefString.lastIndexOf(':'); String datasetAndTableString = tableRefString; if (projectIdEnd != -1) { tableRef.setProjectId(tableRefString.substring(0, projectIdEnd)); datasetAndTableString = tableRefString.substring(projectIdEnd + 1); } Preconditions.checkArgument(datasetAndTableString.matches(DATASET_AND_TABLE_REGEX), "Invalid datasetAndTableString '%s'; must match regex '%s'.", datasetAndTableString, DATASET_AND_TABLE_REGEX); List<String> idParts = DOT_SPLITTER.splitToList(datasetAndTableString); tableRef.setDatasetId(idParts.get(0)); tableRef.setTableId(idParts.get(1)); return tableRef; }
BigQueryStrings { public static TableReference parseTableReference(String tableRefString) { TableReference tableRef = new TableReference(); int projectIdEnd = tableRefString.lastIndexOf(':'); String datasetAndTableString = tableRefString; if (projectIdEnd != -1) { tableRef.setProjectId(tableRefString.substring(0, projectIdEnd)); datasetAndTableString = tableRefString.substring(projectIdEnd + 1); } Preconditions.checkArgument(datasetAndTableString.matches(DATASET_AND_TABLE_REGEX), "Invalid datasetAndTableString '%s'; must match regex '%s'.", datasetAndTableString, DATASET_AND_TABLE_REGEX); List<String> idParts = DOT_SPLITTER.splitToList(datasetAndTableString); tableRef.setDatasetId(idParts.get(0)); tableRef.setTableId(idParts.get(1)); return tableRef; } }
BigQueryStrings { public static TableReference parseTableReference(String tableRefString) { TableReference tableRef = new TableReference(); int projectIdEnd = tableRefString.lastIndexOf(':'); String datasetAndTableString = tableRefString; if (projectIdEnd != -1) { tableRef.setProjectId(tableRefString.substring(0, projectIdEnd)); datasetAndTableString = tableRefString.substring(projectIdEnd + 1); } Preconditions.checkArgument(datasetAndTableString.matches(DATASET_AND_TABLE_REGEX), "Invalid datasetAndTableString '%s'; must match regex '%s'.", datasetAndTableString, DATASET_AND_TABLE_REGEX); List<String> idParts = DOT_SPLITTER.splitToList(datasetAndTableString); tableRef.setDatasetId(idParts.get(0)); tableRef.setTableId(idParts.get(1)); return tableRef; }  }
BigQueryStrings { public static TableReference parseTableReference(String tableRefString) { TableReference tableRef = new TableReference(); int projectIdEnd = tableRefString.lastIndexOf(':'); String datasetAndTableString = tableRefString; if (projectIdEnd != -1) { tableRef.setProjectId(tableRefString.substring(0, projectIdEnd)); datasetAndTableString = tableRefString.substring(projectIdEnd + 1); } Preconditions.checkArgument(datasetAndTableString.matches(DATASET_AND_TABLE_REGEX), "Invalid datasetAndTableString '%s'; must match regex '%s'.", datasetAndTableString, DATASET_AND_TABLE_REGEX); List<String> idParts = DOT_SPLITTER.splitToList(datasetAndTableString); tableRef.setDatasetId(idParts.get(0)); tableRef.setTableId(idParts.get(1)); return tableRef; }  static String toString(TableReference tableRef); static TableReference parseTableReference(String tableRefString); }
BigQueryStrings { public static TableReference parseTableReference(String tableRefString) { TableReference tableRef = new TableReference(); int projectIdEnd = tableRefString.lastIndexOf(':'); String datasetAndTableString = tableRefString; if (projectIdEnd != -1) { tableRef.setProjectId(tableRefString.substring(0, projectIdEnd)); datasetAndTableString = tableRefString.substring(projectIdEnd + 1); } Preconditions.checkArgument(datasetAndTableString.matches(DATASET_AND_TABLE_REGEX), "Invalid datasetAndTableString '%s'; must match regex '%s'.", datasetAndTableString, DATASET_AND_TABLE_REGEX); List<String> idParts = DOT_SPLITTER.splitToList(datasetAndTableString); tableRef.setDatasetId(idParts.get(0)); tableRef.setTableId(idParts.get(1)); return tableRef; }  static String toString(TableReference tableRef); static TableReference parseTableReference(String tableRefString); static final String DATASET_AND_TABLE_REGEX; }