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 2021/11/15 06:09:40 UTC

[GitHub] [incubator-doris] killxdcj opened a new pull request #7121: [Feature] Add an OrToIn expr rewrite rule.

killxdcj opened a new pull request #7121:
URL: https://github.com/apache/incubator-doris/pull/7121


   ## Proposed changes
   
   Add an OrToIn expr rewrite rule.
   
   Detail: #7120
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [ ] Documentation Update (if none of the other choices apply)
   - [ ] Code refactor (Modify the code structure, format the code, etc...)
   - [ ] Optimization. Including functional usability improvements and performance improvements.
   - [ ] Dependency. Such as changes related to third-party components.
   - [ ] Other.
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [ ] I have created an issue on (Fix #7120) and described the bug/feature there in detail
   - [x] Compiling and unit tests pass locally with my changes
   - [x] I have added tests that prove my fix is effective or that my feature works
   - [ ] If these changes need document changes, I have updated the document
   - [ ] Any dependent changes have been merged
   
   ## Further comments
   


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


[GitHub] [incubator-doris] zbtzbtzbt commented on a change in pull request #7121: [Feature] Add an OrToIn expr rewrite rule.

Posted by GitBox <gi...@apache.org>.
zbtzbtzbt commented on a change in pull request #7121:
URL: https://github.com/apache/incubator-doris/pull/7121#discussion_r749050253



##########
File path: fe/fe-core/src/main/java/org/apache/doris/rewrite/OrToInRule.java
##########
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.rewrite;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.doris.analysis.Analyzer;
+import org.apache.doris.analysis.BinaryPredicate;
+import org.apache.doris.analysis.CompoundPredicate;
+import org.apache.doris.analysis.Expr;
+import org.apache.doris.analysis.InPredicate;
+import org.apache.doris.analysis.LiteralExpr;
+import org.apache.doris.analysis.SlotRef;
+import org.apache.doris.common.AnalysisException;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * OR Expr cannot be pushdown on the storage side, rewrite it to InPredicate.
+ * SQL: select * from tbl where k = 0 or k = 1 or k in (2, 3);
+ * After rewrite: select * from tbl where k in (0, 1, 2, 3)
+ * */
+public class OrToInRule implements ExprRewriteRule {

Review comment:
       Hi~ I think we can add rewrite rule in the same java file, because they both belong to Predicate 'OR' rewrite.
   fe/fe-core/src/main/java/org/apache/doris/rewrite/CompoundPredicateWriteRule.java
   related pr: https://github.com/apache/incubator-doris/pull/6518




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


[GitHub] [incubator-doris] zbtzbtzbt commented on pull request #7121: [Feature] Add an OrToIn expr rewrite rule.

Posted by GitBox <gi...@apache.org>.
zbtzbtzbt commented on pull request #7121:
URL: https://github.com/apache/incubator-doris/pull/7121#issuecomment-968594876


   Hi~ I think we can add rewrite rule in the same java file, because they both belong to Predicate 'OR' rewrite.
   fe/fe-core/src/main/java/org/apache/doris/rewrite/CompoundPredicateWriteRule.java
   related pr: https://github.com/apache/incubator-doris/pull/6518
   


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


[GitHub] [incubator-doris] zbtzbtzbt removed a comment on pull request #7121: [Feature] Add an OrToIn expr rewrite rule.

Posted by GitBox <gi...@apache.org>.
zbtzbtzbt removed a comment on pull request #7121:
URL: https://github.com/apache/incubator-doris/pull/7121#issuecomment-968594876


   Hi~ I think we can add rewrite rule in the same java file, because they both belong to Predicate 'OR' rewrite.
   fe/fe-core/src/main/java/org/apache/doris/rewrite/CompoundPredicateWriteRule.java
   related pr: https://github.com/apache/incubator-doris/pull/6518
   


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