calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mm...@apache.org
Subject [11/16] calcite git commit: Fix data race in RexCall.toString() (Christian Beikov)
Date Tue, 05 Sep 2017 14:36:54 GMT
Fix data race in RexCall.toString() (Christian Beikov)

Close apache/calcite#531


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/ddae8411
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/ddae8411
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/ddae8411

Branch: refs/heads/branch-1.14
Commit: ddae8411cf3fc92360da7e856dce9d3c6b1f7524
Parents: cc20ca1
Author: Christian Beikov <christian.beikov@gmail.com>
Authored: Mon Aug 28 16:20:43 2017 +0200
Committer: Julian Hyde <jhyde@apache.org>
Committed: Tue Aug 29 17:13:32 2017 -0700

----------------------------------------------------------------------
 core/src/main/java/org/apache/calcite/rex/RexCall.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/ddae8411/core/src/main/java/org/apache/calcite/rex/RexCall.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rex/RexCall.java b/core/src/main/java/org/apache/calcite/rex/RexCall.java
index 5a1f112..ac9e09e 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexCall.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexCall.java
@@ -93,11 +93,14 @@ public class RexCall extends RexNode {
   }
 
   public String toString() {
-    if (digest == null) {
-      digest = computeDigest(
+    // This data race is intentional
+    String localDigest = digest;
+    if (localDigest == null) {
+      localDigest = computeDigest(
           isA(SqlKind.CAST) || isA(SqlKind.NEW_SPECIFICATION));
+      digest = localDigest;
     }
-    return digest;
+    return localDigest;
   }
 
   public <R> R accept(RexVisitor<R> visitor) {


Mime
View raw message