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 2020/01/19 13:24:16 UTC

[GitHub] [incubator-doris] caiconghui opened a new pull request #2800: Support new show functions syntax to make user search function more conveniently

caiconghui opened a new pull request #2800: Support new show functions syntax to make user search function more conveniently
URL: https://github.com/apache/incubator-doris/pull/2800
 
 
   Support new Show functions syntax to make functions more friendly for user to use

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman merged pull request #2800: Support new show functions syntax to make user search function more conveniently

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #2800: Support new show functions syntax to make user search function more conveniently
URL: https://github.com/apache/incubator-doris/pull/2800
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2800: Support new show functions syntax to make user search function more conveniently

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2800: Support new show functions syntax to make user search function more conveniently
URL: https://github.com/apache/incubator-doris/pull/2800#discussion_r368301637
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/qe/ShowExecutor.java
 ##########
 @@ -302,44 +304,77 @@ private void handleShowEngines() {
         resultSet = new ShowResultSet(showStmt.getMetaData(), rowSet);
     }
 
-    // Handle show function
-    private void handleShowFunction() throws AnalysisException {
-        ShowFunctionStmt showStmt = (ShowFunctionStmt) stmt;
-
+    // Handle show functions
+    private void handleShowFunctions() throws AnalysisException {
+        ShowFunctionsStmt showStmt = (ShowFunctionsStmt) stmt;
         Database db = ctx.getCatalog().getDb(showStmt.getDbName());
         if (db == null) {
             ErrorReport.reportAnalysisException(ErrorCode.ERR_BAD_DB_ERROR, showStmt.getDbName());
         }
-        List<Function> functions = db.getFunctions();
+        List<Function> functions = showStmt.getIsBuiltin() ? ctx.getCatalog().getBuiltinFunctions() :
+            db.getFunctions();
 
-        List<List<String>> rowSet = Lists.newArrayList();
+        List<List<Comparable>> rowSet = Lists.newArrayList();
         for (Function function : functions) {
-            List<String> row = Lists.newArrayList();
-            // signature
-            row.add(function.getSignature());
-            // return type
-            row.add(function.getReturnType().getPrimitiveType().toString());
-            // function type
-            // intermediate type
-            if (function instanceof ScalarFunction) {
-                row.add("Scalar");
-                row.add("NULL");
-            } else {
-                row.add("Aggregate");
-                AggregateFunction aggFunc = (AggregateFunction) function;
-                Type intermediateType = aggFunc.getIntermediateType();
-                if (intermediateType != null) {
-                    row.add(intermediateType.getPrimitiveType().toString());
-                } else {
+            List<Comparable> row = Lists.newArrayList();
+            if (showStmt.getIsVerbose()) {
+                // signature
+                row.add(function.getSignature());
+                // return type
+                row.add(function.getReturnType().getPrimitiveType().toString());
+                // function type
+                // intermediate type
+                if (function instanceof ScalarFunction) {
+                    row.add("Scalar");
                     row.add("NULL");
+                } else {
+                    row.add("Aggregate");
+                    AggregateFunction aggFunc = (AggregateFunction) function;
+                    Type intermediateType = aggFunc.getIntermediateType();
+                    if (intermediateType != null) {
+                        row.add(intermediateType.getPrimitiveType().toString());
+                    } else {
+                        row.add("NULL");
+                    }
                 }
+                // property
+                row.add(function.getProperties());
+            } else {
+                row.add(function.functionName());
+            }
+
+            // like predicate
+            if (showStmt.getWild() == null || showStmt.like(function.functionName())) {
+                rowSet.add(row);
             }
-            // property
-            row.add(function.getProperties());
-            rowSet.add(row);
         }
+
+        // sort function rows by fisrt column asec
 
 Review comment:
   ```suggestion
           // sort function rows by first column asc
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2800: Support new show functions syntax to make user search function more conveniently

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2800: Support new show functions syntax to make user search function more conveniently
URL: https://github.com/apache/incubator-doris/pull/2800#discussion_r368301681
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/qe/ShowExecutor.java
 ##########
 @@ -302,44 +304,77 @@ private void handleShowEngines() {
         resultSet = new ShowResultSet(showStmt.getMetaData(), rowSet);
     }
 
-    // Handle show function
-    private void handleShowFunction() throws AnalysisException {
-        ShowFunctionStmt showStmt = (ShowFunctionStmt) stmt;
-
+    // Handle show functions
+    private void handleShowFunctions() throws AnalysisException {
+        ShowFunctionsStmt showStmt = (ShowFunctionsStmt) stmt;
         Database db = ctx.getCatalog().getDb(showStmt.getDbName());
         if (db == null) {
             ErrorReport.reportAnalysisException(ErrorCode.ERR_BAD_DB_ERROR, showStmt.getDbName());
         }
-        List<Function> functions = db.getFunctions();
+        List<Function> functions = showStmt.getIsBuiltin() ? ctx.getCatalog().getBuiltinFunctions() :
+            db.getFunctions();
 
-        List<List<String>> rowSet = Lists.newArrayList();
+        List<List<Comparable>> rowSet = Lists.newArrayList();
         for (Function function : functions) {
-            List<String> row = Lists.newArrayList();
-            // signature
-            row.add(function.getSignature());
-            // return type
-            row.add(function.getReturnType().getPrimitiveType().toString());
-            // function type
-            // intermediate type
-            if (function instanceof ScalarFunction) {
-                row.add("Scalar");
-                row.add("NULL");
-            } else {
-                row.add("Aggregate");
-                AggregateFunction aggFunc = (AggregateFunction) function;
-                Type intermediateType = aggFunc.getIntermediateType();
-                if (intermediateType != null) {
-                    row.add(intermediateType.getPrimitiveType().toString());
-                } else {
+            List<Comparable> row = Lists.newArrayList();
 
 Review comment:
   I think the `row` built here can be implemented in `Function`. eg:
   
   function.getInfo(row, isVerbose);
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] caiconghui commented on issue #2800: Support new show functions syntax to make user search function more conveniently

Posted by GitBox <gi...@apache.org>.
caiconghui commented on issue #2800: Support new show functions syntax to make user search function more conveniently
URL: https://github.com/apache/incubator-doris/pull/2800#issuecomment-576004402
 
 
   #2795 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2800: Support new show functions syntax to make user search function more conveniently

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2800: Support new show functions syntax to make user search function more conveniently
URL: https://github.com/apache/incubator-doris/pull/2800#discussion_r368301911
 
 

 ##########
 File path: fe/src/main/cup/sql_parser.cup
 ##########
 @@ -194,14 +194,14 @@ parser code {:
 
 // Total keywords of doris
 terminal String KW_ADD, KW_ADMIN, KW_AFTER, KW_AGGREGATE, KW_ALL, KW_ALTER, KW_AND, KW_ANTI, KW_AS, KW_ASC, KW_AUTHORS, 
-    KW_BACKEND, KW_BACKUP, KW_BETWEEN, KW_BEGIN, KW_BIGINT, KW_BITMAP, KW_BITMAP_UNION, KW_BOOLEAN, KW_BOTH, KW_BROKER, KW_BACKENDS, KW_BY,
+    KW_BACKEND, KW_BACKUP, KW_BETWEEN, KW_BEGIN, KW_BIGINT, KW_BITMAP, KW_BITMAP_UNION, KW_BOOLEAN, KW_BOTH, KW_BROKER, KW_BACKENDS, KW_BY, KW_BUILTIN,
 
 Review comment:
   Add newly added keyword to `keyword ::=`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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