CalvinKirs commented on code in PR #36606:
URL: https://github.com/apache/doris/pull/36606#discussion_r1669596988


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindDynamicSplit.java:
##########
@@ -0,0 +1,196 @@
+// 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.nereids.rules.analysis;
+
+import org.apache.doris.analysis.TableName;
+import org.apache.doris.catalog.TableIf;
+import org.apache.doris.catalog.View;
+import org.apache.doris.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.trees.expressions.GreaterThanEqual;
+import org.apache.doris.nereids.trees.expressions.LessThanEqual;
+import org.apache.doris.nereids.trees.expressions.Slot;
+import org.apache.doris.nereids.trees.expressions.SlotReference;
+import org.apache.doris.nereids.trees.expressions.literal.Literal;
+import org.apache.doris.nereids.trees.plans.Plan;
+import org.apache.doris.nereids.trees.plans.commands.info.SplitColumnInfo;
+import org.apache.doris.nereids.trees.plans.logical.LogicalCatalogRelation;
+import org.apache.doris.nereids.trees.plans.logical.LogicalDynamicSplit;
+import org.apache.doris.nereids.trees.plans.logical.LogicalFilter;
+import org.apache.doris.nereids.trees.plans.logical.LogicalProject;
+import org.apache.doris.nereids.trees.plans.logical.LogicalRelation;
+import org.apache.doris.nereids.trees.plans.logical.LogicalSubQueryAlias;
+import org.apache.doris.nereids.trees.plans.logical.LogicalView;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import org.apache.commons.lang3.Range;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ * This class defines the rule to bind a dynamic split operation in the query 
plan.
+ */
+public class BindDynamicSplit implements AnalysisRuleFactory {
+    private static final Logger LOG = 
LoggerFactory.getLogger(BindDynamicSplit.class);
+
+    @Override
+    public List<Rule> buildRules() {
+        return ImmutableList.of(
+                //LogicalDynamicSplit -> LogicalFilter -> 
LogicalCatalogRelation
+                
RuleType.BIND_DYNAMIC_SPLIT.build(logicalDynamicSplit(logicalFilter(logicalRelation()))
+                        .thenApply(ctx -> {
+
+                            Plan result = ctx.root.child();
+                            
LogicalDynamicSplit<LogicalFilter<LogicalRelation>> logicalDynamicSplit = 
ctx.root;
+                            LogicalRelation logicalRelation = 
(LogicalRelation) ((LogicalFilter<?>)
+                                    logicalDynamicSplit.child())
+                                    .child();
+                            return rewritePlan(logicalRelation, result, 
logicalDynamicSplit);
+                        })),
+                //LogicalDynamicSplit -> LogicalProject -> LogicalFilter -> 
LogicalCatalogRelation
+                
RuleType.BIND_DYNAMIC_SPLIT.build(logicalDynamicSplit(logicalProject(logicalFilter(logicalRelation())))
+                        .thenApply(ctx -> {
+
+                            Plan result = ctx.root.child();
+                            LogicalDynamicSplit logicalDynamicSplit = ctx.root;
+                            LogicalRelation logicalRelation = 
(LogicalRelation) ((LogicalProject<?>)
+                                    ((LogicalFilter<?>) 
logicalDynamicSplit.child()).child()).child();
+                            return rewritePlan(logicalRelation, result, 
logicalDynamicSplit);

Review Comment:
   When creating a batch job, the split column must be specified, and it must 
be the actual column name. Therefore, there will be no cases where an alias is 
used for the split column.



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to