in zetasql-toolkit-bigquery/src/main/java/com/google/zetasql/toolkit/catalog/bigquery/BigQueryCatalog.java [241:266]
private void validateNamePathForCreation(
List<String> namePath, CreateScope createScope, String resourceType) {
String fullName = String.join(".", namePath);
List<String> flattenedNamePath =
namePath.stream()
.flatMap(pathElement -> Arrays.stream(pathElement.split("\\.")))
.collect(Collectors.toList());
// Names for TEMP BigQuery resources should not be qualified
if (createScope.equals(CreateScope.CREATE_TEMP) && flattenedNamePath.size() > 1) {
String message =
String.format(
"Cannot create BigQuery TEMP %s %s, TEMP resources should not be qualified",
resourceType, fullName);
throw new BigQueryCreateError(message, createScope, fullName);
}
// Names for persistent BigQuery resources should be qualified
if (!createScope.equals(CreateScope.CREATE_TEMP) && flattenedNamePath.size() == 1) {
String message =
String.format(
"Cannot create BigQuery %s %s, persistent BigQuery resources should be qualified",
resourceType, fullName);
throw new BigQueryCreateError(message, createScope, fullName);
}
}