You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by fo...@apache.org on 2020/04/22 19:27:27 UTC

[avro] branch master updated: AVRO-2801: Cache Hashcode of UTF8 Strings in all Set Methods (#856)

This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e345c4  AVRO-2801: Cache Hashcode of UTF8 Strings in all Set Methods (#856)
8e345c4 is described below

commit 8e345c48e8f9708c27af63754965777314dac85c
Author: belugabehr <12...@users.noreply.github.com>
AuthorDate: Wed Apr 22 15:27:17 2020 -0400

    AVRO-2801: Cache Hashcode of UTF8 Strings in all Set Methods (#856)
    
    Co-authored-by: David Mollitor <dm...@apache.org>
---
 lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java b/lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java
index 2302276..4a8f2ae 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java
@@ -128,6 +128,7 @@ public class Utf8 implements Comparable<Utf8>, CharSequence {
     this.bytes = getBytesFor(string);
     this.length = bytes.length;
     this.string = string;
+    this.hasHash = false;
     return this;
   }
 
@@ -138,6 +139,8 @@ public class Utf8 implements Comparable<Utf8>, CharSequence {
     this.length = other.length;
     System.arraycopy(other.bytes, 0, bytes, 0, length);
     this.string = other.string;
+    this.hash = other.hash;
+    this.hasHash = other.hasHash;
     return this;
   }