AmatyaAvadhanula commented on code in PR #12404:
URL: https://github.com/apache/druid/pull/12404#discussion_r897978705
##########
server/src/main/java/org/apache/druid/metadata/SQLMetadataConnector.java:
##########
@@ -350,6 +377,43 @@ tableName, getPayloadType(), getCollation()
);
}
+ public void alterEntryTable(final String tableName)
+ {
+ try {
+ retryWithHandle(
+ new HandleCallback<Void>()
+ {
+ @Override
+ public Void withHandle(Handle handle)
+ {
+ final Batch batch = handle.createBatch();
+ if (!tableContainsColumn(handle, tableName, "type")) {
+ log.info("Adding column: type to table[%s]", tableName);
+ batch.add(StringUtils.format("ALTER TABLE %1$s ADD COLUMN type
VARCHAR(255)", tableName));
+ }
+ if (!tableContainsColumn(handle, tableName, "group_id")) {
+ log.info("Adding column: group_id to table[%s]", tableName);
+ batch.add(StringUtils.format("ALTER TABLE %1$s ADD COLUMN
group_id VARCHAR(255)", tableName));
+ }
+ batch.execute();
Review Comment:
Isn't that the same as a batch execution with no statements?
##########
server/src/main/java/org/apache/druid/metadata/SQLMetadataConnector.java:
##########
@@ -350,6 +377,43 @@ tableName, getPayloadType(), getCollation()
);
}
+ public void alterEntryTable(final String tableName)
+ {
+ try {
+ retryWithHandle(
+ new HandleCallback<Void>()
+ {
+ @Override
+ public Void withHandle(Handle handle)
+ {
+ final Batch batch = handle.createBatch();
+ if (!tableContainsColumn(handle, tableName, "type")) {
+ log.info("Adding column: type to table[%s]", tableName);
+ batch.add(StringUtils.format("ALTER TABLE %1$s ADD COLUMN type
VARCHAR(255)", tableName));
+ }
+ if (!tableContainsColumn(handle, tableName, "group_id")) {
+ log.info("Adding column: group_id to table[%s]", tableName);
+ batch.add(StringUtils.format("ALTER TABLE %1$s ADD COLUMN
group_id VARCHAR(255)", tableName));
+ }
+ batch.execute();
+ return null;
+ }
+ }
+ );
+ }
+ catch (Exception e) {
+ log.warn(e, "Exception altering table");
+ }
+ }
+
+ @Override
+ public String getTaskTableName()
Review Comment:
Thanks, removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]