JingsongLi commented on code in PR #230:
URL: https://github.com/apache/flink-table-store/pull/230#discussion_r926500262


##########
flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkCatalog.java:
##########
@@ -162,6 +269,29 @@ private SchemaChange toSchemaChange(TableChange change) {
         }
     }
 
+    private UpdateSchema toUpdateSchema(
+            StructType schema, Transform[] partitions, Map<String, String> 
properties) {
+        Preconditions.checkArgument(
+                Arrays.stream(partitions)
+                        .allMatch(
+                                partition -> {
+                                    NamedReference[] references = 
partition.references();
+                                    return references.length == 1
+                                            && references[0] instanceof 
FieldReference;
+                                }));
+
+        return new UpdateSchema(
+                (RowType) toFlinkType(schema),
+                Arrays.stream(partitions)
+                        .map(partition -> partition.references()[0].describe())
+                        .collect(Collectors.toList()),
+                Arrays.stream(properties.getOrDefault(PRIMARY_KEY_IDENTIFIER, 
"").split(","))

Review Comment:
   Here should be 
   ```
   Optional.ofNullable(properties.remove(PRIMARY_KEY_IDENTIFIER)).orElse("");
   ```
   `PRIMARY_KEY_IDENTIFIER` is just for Spark. (`properties` may be a immutable 
map, should copy a new one)



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