You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/11/07 10:06:30 UTC

[GitHub] [doris] 924060929 commented on a diff in pull request #13879: [feature](nereids) Support row policy

924060929 commented on code in PR #13879:
URL: https://github.com/apache/doris/pull/13879#discussion_r1015227471


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/analyzer/UnboundRelation.java:
##########
@@ -43,33 +43,41 @@
 public class UnboundRelation extends LogicalLeaf implements Relation, Unbound {
     private final List<String> nameParts;
 
+    private boolean policyChecked;
+
     public UnboundRelation(List<String> nameParts) {
-        this(nameParts, Optional.empty(), Optional.empty());
+        this(nameParts, false);
+    }
+
+    public UnboundRelation(List<String> nameParts, boolean policyChecked) {
+        this(nameParts, policyChecked, Optional.empty(), Optional.empty());
     }

Review Comment:
   The policyChecked hacking the UnboundRelation, I can imagine that there will be lots of field need added.
   How about generate a CheckPolicy in the LogicalPlanBuilder?
   And then you can write a rule to generate a new filter to the logicalRelation, like this:
   
   ```java
   logicalCheckPolicy(logicalRelation()).thenApply(ctx ->
       LogicalCheckPolicy checkPolicy = ctx.root;
       LogicalRelation relation = checkPolicy.child();
       Optional<String> filter = checkPolicy.getFilter(relation);
       if (filter.isEmpty()) {
           return relation; // no any policy, so we remove the LogicalCheckPolicy Plan
       }
       // has policy, we should remove LogicalCheckPolicy and add a filter to relation
       Expression filter = new NereidsParser().parseExpression(filter.get());
       return new LogicalFilter(filter, relation);
   )
   ```
   



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org