You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "yuzelin (via GitHub)" <gi...@apache.org> on 2023/04/26 04:08:25 UTC

[GitHub] [incubator-paimon] yuzelin opened a new pull request, #1030: [core] Add validation in Schema#Builder

yuzelin opened a new pull request, #1030:
URL: https://github.com/apache/incubator-paimon/pull/1030

   ### Purpose
   
   Currently, Schema#Builder.build hasn't check the arguments. This PR add validation to it.
   
   ### Tests
   
   No.
   
   ### API and Format 
   
   No.
   
   ### Documentation
   
   No.
   


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1030: [core] Add validation in Schema#Builder

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #1030:
URL: https://github.com/apache/incubator-paimon/pull/1030#discussion_r1178605804


##########
paimon-core/src/main/java/org/apache/paimon/schema/Schema.java:
##########
@@ -94,7 +95,22 @@ public String comment() {
     private static List<DataField> normalizeFields(
             List<DataField> fields, List<String> primaryKeys, List<String> partitionKeys) {
         List<String> fieldNames = fields.stream().map(DataField::name).collect(Collectors.toList());
+
+        Set<String> duplicateColumns = duplicate(fieldNames);

Review Comment:
   Add a test for `Schema.newBuilder`?



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] SteNicholas commented on a diff in pull request #1030: [core] Add validation in Schema#Builder

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on code in PR #1030:
URL: https://github.com/apache/incubator-paimon/pull/1030#discussion_r1181450041


##########
paimon-core/src/main/java/org/apache/paimon/schema/Schema.java:
##########
@@ -133,6 +155,12 @@ private static List<DataField> normalizeFields(
         return newFields;
     }
 
+    private static Set<String> duplicate(List<String> names) {

Review Comment:
   Could we return the result that uses `anyMatch(name -> Collections.frequency(names, name) > 1)` that represents whether the `names` is duplicate? Meanwhile uses the return value to invoke `Preconditions.checkState`. 



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] yuzelin commented on a diff in pull request #1030: [core] Add validation in Schema#Builder

Posted by "yuzelin (via GitHub)" <gi...@apache.org>.
yuzelin commented on code in PR #1030:
URL: https://github.com/apache/incubator-paimon/pull/1030#discussion_r1185676698


##########
paimon-core/src/main/java/org/apache/paimon/schema/Schema.java:
##########
@@ -133,6 +155,12 @@ private static List<DataField> normalizeFields(
         return newFields;
     }
 
+    private static Set<String> duplicate(List<String> names) {

Review Comment:
   I collect duplicate columns to put them in error message:
   `Found: {duplicatedColumns}`. 
   Maybe it is not necessary. What's your suggestion?
   



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] JingsongLi merged pull request #1030: [core] Add validation in Schema#Builder

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #1030:
URL: https://github.com/apache/incubator-paimon/pull/1030


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org