This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 022be4663f9 [fix](Nereids) merge file TVFProperties and Properties by 
mistake (#25534)
022be4663f9 is described below

commit 022be4663f92d1f47fc29ce5583e2ecf0c4f99e7
Author: morrySnow <[email protected]>
AuthorDate: Tue Oct 17 18:56:37 2023 +0800

    [fix](Nereids) merge file TVFProperties and Properties by mistake (#25534)
---
 .../antlr4/org/apache/doris/nereids/DorisParser.g4 | 10 +--
 .../doris/nereids/analyzer/UnboundTVFRelation.java | 10 +--
 .../doris/nereids/parser/LogicalPlanBuilder.java   | 18 ++--
 .../nereids/rules/analysis/BindExpression.java     |  4 +-
 .../nereids/trees/expressions/TVFProperties.java   | 95 ----------------------
 .../expressions/visitor/ExpressionVisitor.java     |  5 --
 6 files changed, 21 insertions(+), 121 deletions(-)

diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 
b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
index a5c93080f76..893fddc0ffe 100644
--- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
+++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
@@ -89,7 +89,7 @@ planType
 outFileClause
     : INTO OUTFILE filePath=constant
         (FORMAT AS format=identifier)?
-        (PROPERTIES LEFT_PAREN properties+=tvfProperty (COMMA 
properties+=tvfProperty)* RIGHT_PAREN)?
+        (PROPERTIES LEFT_PAREN properties+=property (COMMA 
properties+=property)* RIGHT_PAREN)?
     ;
 
 query
@@ -262,15 +262,15 @@ relationPrimary
     : multipartIdentifier specifiedPartition? tableAlias sample? relationHint? 
lateralView*           #tableName
     | LEFT_PAREN query RIGHT_PAREN tableAlias lateralView*                     
               #aliasedQuery
     | tvfName=identifier LEFT_PAREN
-      (properties+=tvfProperty (COMMA properties+=tvfProperty)*)?
+      (properties+=property (COMMA properties+=property)*)?
       RIGHT_PAREN tableAlias                                                   
               #tableValuedFunction
     ;
 
-tvfProperty
-    : key=tvfPropertyItem EQ value=tvfPropertyItem
+property
+    : key=propertyItem EQ value=propertyItem
     ;
 
-tvfPropertyItem : identifier | constant ;
+propertyItem : identifier | constant ;
 
 tableAlias
     : (AS? strictIdentifier identifierList?)?
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/analyzer/UnboundTVFRelation.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/analyzer/UnboundTVFRelation.java
index 83c9d4fa286..51ffb722b77 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/analyzer/UnboundTVFRelation.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/analyzer/UnboundTVFRelation.java
@@ -22,8 +22,8 @@ import org.apache.doris.nereids.memo.GroupExpression;
 import org.apache.doris.nereids.properties.LogicalProperties;
 import org.apache.doris.nereids.properties.UnboundLogicalProperties;
 import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.Properties;
 import org.apache.doris.nereids.trees.expressions.Slot;
-import org.apache.doris.nereids.trees.expressions.TVFProperties;
 import 
org.apache.doris.nereids.trees.expressions.functions.table.TableValuedFunction;
 import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.PlanType;
@@ -41,13 +41,13 @@ import java.util.Optional;
 public class UnboundTVFRelation extends LogicalRelation implements 
TVFRelation, Unbound {
 
     private final String functionName;
-    private final TVFProperties properties;
+    private final Properties properties;
 
-    public UnboundTVFRelation(RelationId id, String functionName, 
TVFProperties properties) {
+    public UnboundTVFRelation(RelationId id, String functionName, Properties 
properties) {
         this(id, functionName, properties, Optional.empty(), Optional.empty());
     }
 
-    public UnboundTVFRelation(RelationId id, String functionName, 
TVFProperties properties,
+    public UnboundTVFRelation(RelationId id, String functionName, Properties 
properties,
             Optional<GroupExpression> groupExpression, 
Optional<LogicalProperties> logicalProperties) {
         super(id, PlanType.LOGICAL_UNBOUND_TVF_RELATION, groupExpression, 
logicalProperties);
         this.functionName = Objects.requireNonNull(functionName, "functionName 
can not be null");
@@ -58,7 +58,7 @@ public class UnboundTVFRelation extends LogicalRelation 
implements TVFRelation,
         return functionName;
     }
 
-    public TVFProperties getProperties() {
+    public Properties getProperties() {
         return properties;
     }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index 595d7e8023b..3bdca9e5120 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -77,6 +77,8 @@ import org.apache.doris.nereids.DorisParser.PlanTypeContext;
 import org.apache.doris.nereids.DorisParser.PredicateContext;
 import org.apache.doris.nereids.DorisParser.PredicatedContext;
 import org.apache.doris.nereids.DorisParser.PrimitiveDataTypeContext;
+import org.apache.doris.nereids.DorisParser.PropertyContext;
+import org.apache.doris.nereids.DorisParser.PropertyItemContext;
 import org.apache.doris.nereids.DorisParser.QualifiedNameContext;
 import org.apache.doris.nereids.DorisParser.QueryContext;
 import org.apache.doris.nereids.DorisParser.QueryOrganizationContext;
@@ -104,8 +106,6 @@ import 
org.apache.doris.nereids.DorisParser.TableNameContext;
 import org.apache.doris.nereids.DorisParser.TableValuedFunctionContext;
 import org.apache.doris.nereids.DorisParser.TimestampaddContext;
 import org.apache.doris.nereids.DorisParser.TimestampdiffContext;
-import org.apache.doris.nereids.DorisParser.TvfPropertyContext;
-import org.apache.doris.nereids.DorisParser.TvfPropertyItemContext;
 import org.apache.doris.nereids.DorisParser.TypeConstructorContext;
 import org.apache.doris.nereids.DorisParser.UnitIdentifierContext;
 import org.apache.doris.nereids.DorisParser.UpdateAssignmentContext;
@@ -165,11 +165,11 @@ import org.apache.doris.nereids.trees.expressions.Not;
 import org.apache.doris.nereids.trees.expressions.NullSafeEqual;
 import org.apache.doris.nereids.trees.expressions.Or;
 import org.apache.doris.nereids.trees.expressions.OrderExpression;
+import org.apache.doris.nereids.trees.expressions.Properties;
 import org.apache.doris.nereids.trees.expressions.Regexp;
 import org.apache.doris.nereids.trees.expressions.ScalarSubquery;
 import org.apache.doris.nereids.trees.expressions.StatementScopeIdGenerator;
 import org.apache.doris.nereids.trees.expressions.Subtract;
-import org.apache.doris.nereids.trees.expressions.TVFProperties;
 import org.apache.doris.nereids.trees.expressions.TimestampArithmetic;
 import org.apache.doris.nereids.trees.expressions.WhenClause;
 import org.apache.doris.nereids.trees.expressions.WindowExpression;
@@ -666,13 +666,13 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
             String functionName = ctx.tvfName.getText();
 
             Builder<String, String> map = ImmutableMap.builder();
-            for (TvfPropertyContext argument : ctx.properties) {
-                String key = parseTVFPropertyItem(argument.key);
-                String value = parseTVFPropertyItem(argument.value);
+            for (PropertyContext argument : ctx.properties) {
+                String key = parsePropertyItem(argument.key);
+                String value = parsePropertyItem(argument.value);
                 map.put(key, value);
             }
             LogicalPlan relation = new 
UnboundTVFRelation(StatementScopeIdGenerator.newRelationId(),
-                    functionName, new TVFProperties(map.build()));
+                    functionName, new Properties(map.build()));
             return withTableAlias(relation, ctx.tableAlias());
         });
     }
@@ -1528,7 +1528,7 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
             format = ctx.format.getText();
         }
         Map<String, String> properties = Maps.newHashMap();
-        for (TvfPropertyContext argument : ctx.properties) {
+        for (PropertyContext argument : ctx.properties) {
             String key = parseConstant(argument.key.constant());
             String value = parseConstant(argument.value.constant());
             properties.put(key, value);
@@ -1958,7 +1958,7 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
         }
     }
 
-    private String parseTVFPropertyItem(TvfPropertyItemContext item) {
+    private String parsePropertyItem(PropertyItemContext item) {
         if (item.constant() != null) {
             return parseConstant(item.constant());
         }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindExpression.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindExpression.java
index 41422b1b1bf..ecd8ce93cab 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindExpression.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindExpression.java
@@ -39,9 +39,9 @@ import org.apache.doris.nereids.trees.expressions.BoundStar;
 import org.apache.doris.nereids.trees.expressions.EqualTo;
 import org.apache.doris.nereids.trees.expressions.Expression;
 import org.apache.doris.nereids.trees.expressions.NamedExpression;
+import org.apache.doris.nereids.trees.expressions.Properties;
 import org.apache.doris.nereids.trees.expressions.Slot;
 import org.apache.doris.nereids.trees.expressions.SlotReference;
-import org.apache.doris.nereids.trees.expressions.TVFProperties;
 import org.apache.doris.nereids.trees.expressions.functions.BoundFunction;
 import org.apache.doris.nereids.trees.expressions.functions.Function;
 import org.apache.doris.nereids.trees.expressions.functions.FunctionBuilder;
@@ -696,7 +696,7 @@ public class BindExpression implements AnalysisRuleFactory {
         FunctionRegistry functionRegistry = env.getFunctionRegistry();
 
         String functionName = unboundTVFRelation.getFunctionName();
-        TVFProperties arguments = unboundTVFRelation.getProperties();
+        Properties arguments = unboundTVFRelation.getProperties();
         FunctionBuilder functionBuilder = 
functionRegistry.findFunctionBuilder(functionName, arguments);
         Expression function = functionBuilder.build(functionName, arguments);
         if (!(function instanceof TableValuedFunction)) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/TVFProperties.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/TVFProperties.java
deleted file mode 100644
index 6a8cfc585d4..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/TVFProperties.java
+++ /dev/null
@@ -1,95 +0,0 @@
-// 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.trees.expressions;
-
-import org.apache.doris.nereids.exceptions.UnboundException;
-import org.apache.doris.nereids.trees.expressions.shape.LeafExpression;
-import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
-import org.apache.doris.nereids.types.DataType;
-import org.apache.doris.nereids.types.MapType;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/**
- * TVFProperties
- */
-public class TVFProperties extends Expression implements LeafExpression {
-    private final Map<String, String> keyValues;
-
-    public TVFProperties(Map<String, String> properties) {
-        super(ImmutableList.of());
-        this.keyValues = Objects.requireNonNull(properties, "properties can 
not be null");
-    }
-
-    public Map<String, String> getMap() {
-        return keyValues;
-    }
-
-    @Override
-    public boolean nullable() {
-        return false;
-    }
-
-    @Override
-    public DataType getDataType() throws UnboundException {
-        return MapType.INSTANCE;
-    }
-
-    @Override
-    public String toSql() {
-        return getMap()
-                .entrySet()
-                .stream()
-                .map(kv -> "'" + kv.getKey() + "' = '" + kv.getValue() + "'")
-                .collect(Collectors.joining(", "));
-    }
-
-    @Override
-    public String toString() {
-        return "TVFProperties(" + toSql() + ")";
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        if (!super.equals(o)) {
-            return false;
-        }
-        TVFProperties that = (TVFProperties) o;
-        return Objects.equals(keyValues, that.keyValues);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(super.hashCode(), keyValues);
-    }
-
-    @Override
-    public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
-        return visitor.visitTVFProperties(this, context);
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ExpressionVisitor.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ExpressionVisitor.java
index d95f35a6f69..ffba3bb1f4d 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ExpressionVisitor.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ExpressionVisitor.java
@@ -69,7 +69,6 @@ import org.apache.doris.nereids.trees.expressions.Slot;
 import org.apache.doris.nereids.trees.expressions.SlotReference;
 import org.apache.doris.nereids.trees.expressions.SubqueryExpr;
 import org.apache.doris.nereids.trees.expressions.Subtract;
-import org.apache.doris.nereids.trees.expressions.TVFProperties;
 import org.apache.doris.nereids.trees.expressions.TimestampArithmetic;
 import org.apache.doris.nereids.trees.expressions.UnaryArithmetic;
 import org.apache.doris.nereids.trees.expressions.UnaryOperator;
@@ -415,10 +414,6 @@ public abstract class ExpressionVisitor<R, C>
         return visit(variableDesc, context);
     }
 
-    public R visitTVFProperties(TVFProperties tvfProperties, C context) {
-        return visit(tvfProperties, context);
-    }
-
     public R visitInterval(Interval interval, C context) {
         return visit(interval, context);
     }


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

Reply via email to