morrySnow commented on code in PR #33264:
URL: https://github.com/apache/doris/pull/33264#discussion_r1582029296


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java:
##########
@@ -32,23 +38,29 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * show procedure status command
  */
 public class ShowProcedureStatusCommand extends Command implements NoForward {
-
     public static final Logger LOG = 
LogManager.getLogger(ShowProcedureStatusCommand.class);
     public static final ImmutableList<String> TITLE_NAMES = new 
ImmutableList.Builder<String>().add("ProcedureName")
-                                                                
.add("CatalogId").add("DbId").add("PackageName")
-                                                                
.add("OwnerName").add("CreateTime").add("ModifyTime")
-                                                                .build();
+            
.add("CatalogId").add("DbId").add("DbName").add("PackageName").add("OwnerName").add("CreateTime")
+            .add("ModifyTime").build();
+    private static final String colDb = "db";
+    private static final String colProcName = "procedurename";
+    private static final String colName = "name";
+    private final Set<Expression> whereExpr;
 
     /**
      * constructor
      */
-    public ShowProcedureStatusCommand() {
+    public ShowProcedureStatusCommand(final Set<Expression> whereExpr) {
         super(PlanType.SHOW_PROCEDURE_COMMAND);
+        this.whereExpr = whereExpr;

Review Comment:
   ```suggestion
           this.whereExpr = Objects.requireNonNull(whereExpr, "whereExpr should 
not be null");
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java:
##########
@@ -59,10 +71,56 @@ public ShowResultSetMetaData getMetaData() {
         return builder.build();
     }
 
+    private void validateAndExtractFilters(StringBuilder dbFilter, 
StringBuilder procFilter) throws Exception {
+
+        if (whereExpr.isEmpty()) {
+            return;
+        }
+        Set<Expression> likeSet = 
whereExpr.stream().filter(Like.class::isInstance).collect(Collectors.toSet());
+        Set<Expression> equalTo = 
whereExpr.stream().filter(EqualTo.class::isInstance).collect(Collectors.toSet());
+
+        if (whereExpr.size() != likeSet.size() + equalTo.size()) {
+            throw new AnalysisException("Only support equalTo  and Like 
filters.");
+        }
+
+        equalTo.addAll(likeSet);
+
+        Map<String, String> filterMap = equalTo.stream()
+                .collect(Collectors.toMap(exp -> ((Slot) 
exp.child(0)).getName(),
+                        exp -> ((Literal) exp.child(1)).getStringValue()));

Review Comment:
   it u only allow one predicate for one column. u should check it first. or u 
should use multi map here. otherwise toMap will throw duplicate key exception.
   btw, doris' column name is case insensitive, so u should use ci key map.



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