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

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 171f48d6d88 [fix](Nereids) relation in constraints should be multi 
parts (#30293)
171f48d6d88 is described below

commit 171f48d6d88f0b394201657cb621b388a5d777e4
Author: 谢健 <jianx...@gmail.com>
AuthorDate: Wed Jan 24 14:09:53 2024 +0800

    [fix](Nereids) relation in constraints should be multi parts (#30293)
---
 .../src/main/antlr4/org/apache/doris/nereids/DorisParser.g4  |  6 +++---
 .../org/apache/doris/nereids/parser/LogicalPlanBuilder.java  | 12 ++++++------
 2 files changed, 9 insertions(+), 9 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 07a3e27e556..4ec4065ce73 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
@@ -97,12 +97,12 @@ statement
     | PAUSE MATERIALIZED VIEW JOB ON mvName=multipartIdentifier      #pauseMTMV
     | RESUME MATERIALIZED VIEW JOB ON mvName=multipartIdentifier      
#resumeMTMV
     | CANCEL MATERIALIZED VIEW TASK taskId=INTEGER_VALUE ON 
mvName=multipartIdentifier      #cancelMTMVTask
-    | ALTER TABLE table=relation
+    | ALTER TABLE table=multipartIdentifier
         ADD CONSTRAINT constraintName=errorCapturingIdentifier
         constraint                                                        
#addConstraint
-    | ALTER TABLE table=relation
+    | ALTER TABLE table=multipartIdentifier
         DROP CONSTRAINT constraintName=errorCapturingIdentifier           
#dropConstraint
-    | SHOW CONSTRAINTS FROM table=relation                                 
#showConstraint
+    | SHOW CONSTRAINTS FROM table=multipartIdentifier                          
       #showConstraint
     | CALL functionName=identifier LEFT_PAREN (expression (COMMA 
expression)*)? RIGHT_PAREN #callProcedure
     ;
 
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 647b65a6415..9bafca42f94 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
@@ -435,7 +435,6 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Optional;
-import java.util.Set;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
@@ -755,14 +754,14 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
 
     @Override
     public LogicalPlan visitShowConstraint(ShowConstraintContext ctx) {
-        Set<UnboundRelation> unboundRelation = visitRelation(ctx.table)
-                .collect(UnboundRelation.class::isInstance);
-        return new 
ShowConstraintsCommand(unboundRelation.iterator().next().getNameParts());
+        List<String> parts = visitMultipartIdentifier(ctx.table);
+        return new ShowConstraintsCommand(parts);
     }
 
     @Override
     public LogicalPlan visitAddConstraint(AddConstraintContext ctx) {
-        LogicalPlan curTable = visitRelation(ctx.table);
+        List<String> parts = visitMultipartIdentifier(ctx.table);
+        UnboundRelation curTable = new 
UnboundRelation(StatementScopeIdGenerator.newRelationId(), parts);
         ImmutableList<Slot> slots = 
visitIdentifierList(ctx.constraint().slots).stream()
                 .map(UnboundSlot::new)
                 .collect(ImmutableList.toImmutableList());
@@ -786,7 +785,8 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
 
     @Override
     public LogicalPlan visitDropConstraint(DropConstraintContext ctx) {
-        LogicalPlan curTable = visitRelation(ctx.table);
+        List<String> parts = visitMultipartIdentifier(ctx.table);
+        UnboundRelation curTable = new 
UnboundRelation(StatementScopeIdGenerator.newRelationId(), parts);
         return new 
DropConstraintCommand(ctx.constraintName.getText().toLowerCase(), curTable);
     }
 


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

Reply via email to