taiyang-li commented on code in PR #8284:
URL: https://github.com/apache/incubator-gluten/pull/8284#discussion_r1897767155


##########
cpp-ch/local-engine/Parser/ExpressionParser.cpp:
##########
@@ -843,4 +868,88 @@ ExpressionParser::parseJsonTuple(const 
substrait::Expression_ScalarFunction & fu
     }
     return res_nodes;
 }
+
+bool ExpressionParser::areEqualNodes(NodeRawConstPtr a, NodeRawConstPtr b)
+{
+    if (a == b)
+        return true;
+
+    if (a->type != b->type || !a->result_type->equals(*(b->result_type)) || 
a->children.size() != b->children.size()
+        || !a->isDeterministic() || !b->isDeterministic())
+        return false;
+
+    switch (a->type)
+    {
+        case DB::ActionsDAG::ActionType::INPUT: {
+            if (a->result_name != b->result_name)
+                return false;
+            break;
+        }
+        case DB::ActionsDAG::ActionType::ALIAS: {
+            if (a->result_name != b->result_name)
+                return false;
+            break;
+        }
+        case DB::ActionsDAG::ActionType::COLUMN: {
+            // dummpy columns cannot be compared
+            if (typeid_cast<const DB::ColumnSet *>(a->column.get()))
+                return a->result_name == b->result_name;
+            if (a->column->compareAt(0, 0, *(b->column), 1) != 0)
+                return false;
+            break;
+        }
+        case DB::ActionsDAG::ActionType::ARRAY_JOIN: {
+            return false;
+        }
+        case DB::ActionsDAG::ActionType::FUNCTION: {
+            if (!a->function_base->isDeterministic() || 
a->function_base->getName() != b->function_base->getName())
+                return false;
+
+            break;
+        }
+        default: {
+            LOG_DEBUG(getLogger("ExpressionParser"), "Unknow node type: 
{}|{}|{}", a->type, a->result_type->getName(), a->result_name);

Review Comment:
   LOG_WARNING



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to