You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "gaborgsomogyi (via GitHub)" <gi...@apache.org> on 2024/12/06 15:28:20 UTC

[PR] [FLINK-36612][core] Fix TypeSerializer to detect lombok boolean with is prefix [flink]

gaborgsomogyi opened a new pull request, #25757:
URL: https://github.com/apache/flink/pull/25757

   ## What is the purpose of the change
   
   At the moment Flink not detecting Lombok generated setter correctly. For example `boolean isHealthy` field is generating `boolean isHealthy()` function and not `boolean isIsHealthy()`. In this PR I've added support for that.
   
   ## Brief change log
   
   Fix TypeSerializer to detect lombok boolean with `is` prefix.
   
   ## Verifying this change
   
   Modified existing automated test.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature?no
     - If yes, how is the feature documented? not applicable
   


-- 
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@flink.apache.org

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


Re: [PR] [FLINK-36612][core] Fix TypeSerializer to detect lombok boolean with is prefix [flink]

Posted by "gaborgsomogyi (via GitHub)" <gi...@apache.org>.
gaborgsomogyi commented on code in PR #25757:
URL: https://github.com/apache/flink/pull/25757#discussion_r1874499916


##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java:
##########
@@ -2046,7 +2046,9 @@ private boolean isValidPojoField(Field f, Class<?> clazz, List<Type> typeHierarc
                 }
                 // check for setters (<FieldName>_$eq for scala)
                 if ((methodNameLow.equals("set" + fieldNameLow)
-                                || methodNameLow.equals(fieldNameLow + "_$eq"))
+                                || methodNameLow.equals(fieldNameLow + "_$eq")
+                                || (fieldNameLow.startsWith("is")
+                                        && methodNameLow.equals("set" + fieldNameLow.substring(2))))

Review Comment:
   If that would be a one-liner then I would add that but it would completely blow up the code.
   * By default lombok generates `isHasAncestor` and `setHasAncestor` which is just bad
   * With `@Accessors(fluent = true)` there is no setter generated + the getter has different signature
   



-- 
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@flink.apache.org

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


Re: [PR] [FLINK-36612][core] Fix TypeSerializer to detect lombok boolean with is prefix [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #25757:
URL: https://github.com/apache/flink/pull/25757#issuecomment-2523501580

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d1f8e6afd858001f4e7c29078f9b5a8633e9a552",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d1f8e6afd858001f4e7c29078f9b5a8633e9a552",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d1f8e6afd858001f4e7c29078f9b5a8633e9a552 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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@flink.apache.org

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


Re: [PR] [FLINK-36612][core] Fix TypeSerializer to detect lombok boolean with is prefix [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #25757:
URL: https://github.com/apache/flink/pull/25757#discussion_r1874414244


##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java:
##########
@@ -2046,7 +2046,9 @@ private boolean isValidPojoField(Field f, Class<?> clazz, List<Type> typeHierarc
                 }
                 // check for setters (<FieldName>_$eq for scala)
                 if ((methodNameLow.equals("set" + fieldNameLow)
-                                || methodNameLow.equals(fieldNameLow + "_$eq"))
+                                || methodNameLow.equals(fieldNameLow + "_$eq")
+                                || (fieldNameLow.startsWith("is")
+                                        && methodNameLow.equals("set" + fieldNameLow.substring(2))))

Review Comment:
   Should there be also added a check for `has`?
   for instance
   ```java
   boolean hasAncestor = false;
   ```



-- 
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@flink.apache.org

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


Re: [PR] [FLINK-36612][core] Fix TypeSerializer to detect lombok boolean with is prefix [flink]

Posted by "gaborgsomogyi (via GitHub)" <gi...@apache.org>.
gaborgsomogyi merged PR #25757:
URL: https://github.com/apache/flink/pull/25757


-- 
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@flink.apache.org

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


Re: [PR] [FLINK-36612][core] Fix TypeSerializer to detect lombok boolean with is prefix [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #25757:
URL: https://github.com/apache/flink/pull/25757#discussion_r1874717063


##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java:
##########
@@ -2046,7 +2046,9 @@ private boolean isValidPojoField(Field f, Class<?> clazz, List<Type> typeHierarc
                 }
                 // check for setters (<FieldName>_$eq for scala)
                 if ((methodNameLow.equals("set" + fieldNameLow)
-                                || methodNameLow.equals(fieldNameLow + "_$eq"))
+                                || methodNameLow.equals(fieldNameLow + "_$eq")
+                                || (fieldNameLow.startsWith("is")
+                                        && methodNameLow.equals("set" + fieldNameLow.substring(2))))

Review Comment:
   fair enough



-- 
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@flink.apache.org

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


Re: [PR] [FLINK-36612][core] Fix TypeSerializer to detect lombok boolean with is prefix [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #25757:
URL: https://github.com/apache/flink/pull/25757#discussion_r1874414669


##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java:
##########
@@ -2046,7 +2046,9 @@ private boolean isValidPojoField(Field f, Class<?> clazz, List<Type> typeHierarc
                 }
                 // check for setters (<FieldName>_$eq for scala)
                 if ((methodNameLow.equals("set" + fieldNameLow)
-                                || methodNameLow.equals(fieldNameLow + "_$eq"))
+                                || methodNameLow.equals(fieldNameLow + "_$eq")
+                                || (fieldNameLow.startsWith("is")
+                                        && methodNameLow.equals("set" + fieldNameLow.substring(2))))

Review Comment:
   should there be added a similar check for `has`?
   e.g.
   ```java
   boolean hasAncestor = false;
   ```



-- 
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@flink.apache.org

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


Re: [PR] [FLINK-36612][core] Fix TypeSerializer to detect lombok boolean with is prefix [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #25757:
URL: https://github.com/apache/flink/pull/25757#discussion_r1874414244


##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java:
##########
@@ -2046,7 +2046,9 @@ private boolean isValidPojoField(Field f, Class<?> clazz, List<Type> typeHierarc
                 }
                 // check for setters (<FieldName>_$eq for scala)
                 if ((methodNameLow.equals("set" + fieldNameLow)
-                                || methodNameLow.equals(fieldNameLow + "_$eq"))
+                                || methodNameLow.equals(fieldNameLow + "_$eq")
+                                || (fieldNameLow.startsWith("is")
+                                        && methodNameLow.equals("set" + fieldNameLow.substring(2))))

Review Comment:
   Should there be also added a check for `has`?
   for instance
   ```java
   boolean hasAncestor = false;
   ```



-- 
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@flink.apache.org

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