amogh-jahagirdar commented on code in PR #10023:
URL: https://github.com/apache/iceberg/pull/10023#discussion_r1558672872


##########
api/src/main/java/org/apache/iceberg/util/CharSequenceWrapper.java:
##########
@@ -29,13 +29,16 @@ public static CharSequenceWrapper wrap(CharSequence seq) {
   }
 
   private CharSequence wrapped;
+  // lazily computed & cached hashCode
+  private transient int hashCode = 0;

Review Comment:
   Hmm, I'm not sure I'd set a default value of 0, since that technically can 
be a legit hashCode value for some series of characters no? 
   I think I'd make this an Integer hashCode and have it be null to identify 
that nothing is cached yet.



##########
api/src/main/java/org/apache/iceberg/util/CharSequenceWrapper.java:
##########
@@ -29,13 +29,16 @@ public static CharSequenceWrapper wrap(CharSequence seq) {
   }
 
   private CharSequence wrapped;
+  // lazily computed & cached hashCode
+  private transient int hashCode = 0;

Review Comment:
   But good call making it transient, that's important since it shouldn't be 
serialized and the cache somehow used across JVMs



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to