Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public void setUpBase() throws ExecutionException {
}
}

private String getSpecPath(
protected String getSpecPath(
Class<?> dataflowTemplateClass, Template templateMetadata, String pomPath)
throws ExecutionException {
if (TestProperties.specPath() != null && !TestProperties.specPath().isEmpty()) {
Expand Down Expand Up @@ -334,7 +334,7 @@ private String getSpecPath(
String.format("%s/%s%s", STAGING_PREFIX, flex ? "flex/" : "", templateMetadata.name());
String stagePath = String.format("gs://%s/%s", bucketName, blobPath);

String identifier = flex ? template.flexContainerName() : templateMetadata.name();
String identifier = flex ? templateMetadata.flexContainerName() : templateMetadata.name();

stagedTemplates.get(
identifier,
Expand All @@ -359,7 +359,8 @@ private String getSpecPath(
}
}

String[] mavenCmd = buildMavenStageCommand(STAGING_PREFIX, pom, bucketName, template);
String[] mavenCmd =
buildMavenStageCommand(STAGING_PREFIX, pom, bucketName, templateMetadata);
LOG.info("Running command to stage templates: {}", String.join(" ", mavenCmd));

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,14 @@ private synchronized void maybeCreateInstance() {
try {
InstanceInfo instanceInfo =
InstanceInfo.newBuilder(InstanceId.of(projectId, instanceId))
.setInstanceConfigId(InstanceConfigId.of(projectId, "regional-" + region))
.setInstanceConfigId(
InstanceConfigId.of(
projectId,
(region.startsWith("nam")
|| region.startsWith("eur")
|| region.startsWith("asia"))
? region
: "regional-" + region))
.setDisplayName(instanceId)
.setEdition(Edition.ENTERPRISE_PLUS) // Needed by Full Text Search.
.setNodeCount(nodeCount)
Expand Down Expand Up @@ -639,6 +646,10 @@ public synchronized ImmutableList<Struct> readTableRecords(
}
}

public List<String> getDatabaseDdl() {
return databaseAdminClient.getDatabaseDdl(instanceId, databaseId);
}

/**
* Deletes all created resources (instance, database, and tables) and cleans up all Spanner
* sessions, making the manager object unusable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1287,12 +1287,14 @@ private void listPropertyGraphLabels(Ddl.Builder builder) {
for (int i = 0; i < labelsArray.length(); i++) {
JSONObject label = labelsArray.getJSONObject(i);
String name = label.getString("name");
JSONArray propertyDeclarationNamesArray = label.getJSONArray("propertyDeclarationNames");
JSONArray propertyDeclarationNamesArray = label.optJSONArray("propertyDeclarationNames");

List<String> propertyNames = new ArrayList<>();
for (int j = 0; j < propertyDeclarationNamesArray.length(); j++) {
String propertyName = propertyDeclarationNamesArray.getString(j);
propertyNames.add(propertyName);
if (propertyDeclarationNamesArray != null) {
for (int j = 0; j < propertyDeclarationNamesArray.length(); j++) {
String propertyName = propertyDeclarationNamesArray.getString(j);
propertyNames.add(propertyName);
}
}

ImmutableList<String> immutablePropertyNames = ImmutableList.copyOf(propertyNames);
Expand Down Expand Up @@ -1361,7 +1363,7 @@ private void listPropertyGraphTables(Ddl.Builder builder, String tableType) {
String kind = table.getString("kind");
JSONArray labelNamesArray = table.getJSONArray("labelNames");
String name = table.getString("name");
JSONArray propertyDefinitionsArray = table.getJSONArray("propertyDefinitions");
JSONArray propertyDefinitionsArray = table.optJSONArray("propertyDefinitions");

ImmutableList.Builder<String> keyColumnsBuilder = ImmutableList.builder();
for (int j = 0; j < keyColumnsArray.length(); j++) {
Expand Down Expand Up @@ -1427,19 +1429,21 @@ private void listPropertyGraphTables(Ddl.Builder builder, String tableType) {
propertyDefinitionsBuilder = ImmutableList.builder();

for (String propertyName : propertyGraphLabel.properties) {
for (int k = 0; k < propertyDefinitionsArray.length(); k++) {
JSONObject propertyDefinition = propertyDefinitionsArray.getJSONObject(k);
String propertyDeclarationName =
propertyDefinition.getString("propertyDeclarationName");

if (propertyName.equals(propertyDeclarationName)) {
PropertyGraph.PropertyDeclaration propertyDeclaration =
propertyGraph.getPropertyDeclaration(propertyDeclarationName);
propertyDefinitionsBuilder.add(
new GraphElementTable.PropertyDefinition(
propertyDeclaration.name,
propertyDefinition.getString("valueExpressionSql")));
break;
if (propertyDefinitionsArray != null) {
for (int k = 0; k < propertyDefinitionsArray.length(); k++) {
JSONObject propertyDefinition = propertyDefinitionsArray.getJSONObject(k);
String propertyDeclarationName =
propertyDefinition.getString("propertyDeclarationName");

if (propertyName.equals(propertyDeclarationName)) {
PropertyGraph.PropertyDeclaration propertyDeclaration =
propertyGraph.getPropertyDeclaration(propertyDeclarationName);
propertyDefinitionsBuilder.add(
new GraphElementTable.PropertyDefinition(
propertyDeclaration.name,
propertyDefinition.getString("valueExpressionSql")));
break;
}
}
}
}
Expand Down
Loading
Loading