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

changchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 0637a227b9 [GLUTEN-7907][CH] Fixed data race in 
`ExpresionParser::getUniqueName` (#7908)
0637a227b9 is described below

commit 0637a227b93052c2136a6b91ffe86d4568db8b69
Author: lgbo <[email protected]>
AuthorDate: Tue Nov 12 13:42:35 2024 +0800

    [GLUTEN-7907][CH] Fixed data race in `ExpresionParser::getUniqueName` 
(#7908)
---
 cpp-ch/local-engine/Parser/ExpressionParser.cpp | 2 +-
 cpp-ch/local-engine/Parser/ExpressionParser.h   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpp-ch/local-engine/Parser/ExpressionParser.cpp 
b/cpp-ch/local-engine/Parser/ExpressionParser.cpp
index 30ef92f176..9899e90ddc 100644
--- a/cpp-ch/local-engine/Parser/ExpressionParser.cpp
+++ b/cpp-ch/local-engine/Parser/ExpressionParser.cpp
@@ -624,7 +624,7 @@ const DB::ActionsDAG::Node * 
ExpressionParser::toFunctionNode(
     return &actions_dag.addFunction(function_builder, args, result_name);
 }
 
-UInt64 ExpressionParser::unique_name_counter = 0;
+std::atomic<UInt64> ExpressionParser::unique_name_counter = 0;
 String ExpressionParser::getUniqueName(const String & name) const
 {
     return name + "_" + std::to_string(unique_name_counter++);
diff --git a/cpp-ch/local-engine/Parser/ExpressionParser.h 
b/cpp-ch/local-engine/Parser/ExpressionParser.h
index 5aedb94f2c..95c66146ab 100644
--- a/cpp-ch/local-engine/Parser/ExpressionParser.h
+++ b/cpp-ch/local-engine/Parser/ExpressionParser.h
@@ -20,6 +20,7 @@
 #include <Interpreters/ActionsDAG.h>
 #include <Interpreters/Context_fwd.h>
 #include <substrait/plan.pb.h>
+#include <atomic>
 #include "SerializedPlanParser.h"
 
 
@@ -74,7 +75,7 @@ public:
     String safeGetFunctionName(const substrait::Expression_ScalarFunction & 
func_) const;
 
 private:
-    static UInt64 unique_name_counter;
+    static std::atomic<UInt64> unique_name_counter;
     std::shared_ptr<const ParserContext> context;
 
     DB::ActionsDAG::NodeRawConstPtrs


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to