stoty commented on code in PR #1586:
URL: https://github.com/apache/phoenix/pull/1586#discussion_r1162935895


##########
phoenix-core/src/main/java/org/apache/phoenix/schema/transform/Transform.java:
##########
@@ -472,25 +473,41 @@ public static void doCutover(PhoenixConnection 
connection, SystemTransformRecord
         getMetadataDifference(connection, systemTransformRecord, columnNames, 
columnValues);
         // TODO In the future, we need to handle rowkey changes and column 
type changes as well
 
-        String
-                changeViewStmt = "UPSERT INTO SYSTEM.CATALOG (TENANT_ID, 
TABLE_SCHEM, TABLE_NAME %s) VALUES (%s, %s, '%s' %s)";
+        String changeViewStmt = "UPSERT INTO SYSTEM.CATALOG "
+            + "(TENANT_ID, TABLE_SCHEM, TABLE_NAME %s) VALUES (?, ?, ? %s)";
 
         String
-                changeTable = String.format(
-                "UPSERT INTO SYSTEM.CATALOG (TENANT_ID, TABLE_SCHEM, 
TABLE_NAME, PHYSICAL_TABLE_NAME %s) VALUES (%s, %s, '%s','%s' %s)",
-                (columnNames.size() > 0? "," + String.join(",", 
columnNames):""),
-                (tenantId==null? null: ("'" + tenantId + "'")),
-                (schema==null ? null : ("'" + schema + "'")), tableName, 
newTableName,
-                (columnValues.size() > 0? "," + String.join(",", 
columnValues):""));
+                changeTable = String.format("UPSERT INTO SYSTEM.CATALOG "
+                + "(TENANT_ID, TABLE_SCHEM, TABLE_NAME, PHYSICAL_TABLE_NAME %s 
) "
+                + "VALUES(?, ?, ?, ? %s)", columnNames.size() > 0 ? ","
+                + String.join(",", columnNames) : "",

Review Comment:
   This is another case, when we should generate ? s and call setString for 
each element,



-- 
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]

Reply via email to