soumyakanti3578 commented on code in PR #5379:
URL: https://github.com/apache/hive/pull/5379#discussion_r1702124002


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRulesRegistry.java:
##########
@@ -27,23 +27,35 @@
 import com.google.common.collect.ListMultimap;
 import com.google.common.collect.SetMultimap;
 import com.google.common.collect.Sets;
+import org.apache.calcite.rel.core.Filter;
 
 public class HiveRulesRegistry {
 
-  private SetMultimap<RelOptRule, RelNode> registryVisited;
-  private ListMultimap<RelNode, Set<String>> registryPushedPredicates;
+  private final SetMultimap<RelOptRule, String> registryVisited;
+  private final ListMultimap<RelNode, Set<String>> registryPushedPredicates;
 
   public HiveRulesRegistry() {
     this.registryVisited = HashMultimap.create();
     this.registryPushedPredicates = ArrayListMultimap.create();
   }
 
   public void registerVisited(RelOptRule rule, RelNode operator) {
-    this.registryVisited.put(rule, operator);
+    this.registryVisited.put(rule, getRelNodeIdentifier(operator));
   }
 
-  public Set<RelNode> getVisited(RelOptRule rule) {
-    return this.registryVisited.get(rule);
+  public boolean hasBeenVisitedBy(RelOptRule rule, RelNode node) {
+    return this.registryVisited.get(rule).contains(getRelNodeIdentifier(node));
+  }
+
+  private String getRelNodeIdentifier(RelNode node) {
+    if (node instanceof Filter) {
+      String inputClass = ((Filter) 
node).getInput().getClass().getSimpleName();
+      String condition = ((Filter) node).getCondition().toString();
+      String rowType = node.getRowType().toString();
+      return "input=" + inputClass + " condition=" + condition + " rowtype=" + 
rowType;
+    }

Review Comment:
   Thanks! This is a good idea!



-- 
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