You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ka...@apache.org on 2020/02/14 04:00:31 UTC

[incubator-doris] branch master updated: Fix a sql_parser.cup conflict by a duplicated show index stmt (#2894)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0e997a8  Fix a sql_parser.cup conflict by a duplicated show index stmt (#2894)
0e997a8 is described below

commit 0e997a87983dcde2aca5c1224498cd4e87c5b961
Author: yangzhg <78...@qq.com>
AuthorDate: Fri Feb 14 12:00:23 2020 +0800

    Fix a sql_parser.cup conflict by a duplicated show index stmt (#2894)
---
 fe/src/main/cup/sql_parser.cup                     | 11 +----
 .../org/apache/doris/analysis/ShowIndexStmt.java   | 11 ++++-
 .../org/apache/doris/analysis/ShowKeysStmt.java    | 50 ----------------------
 .../java/org/apache/doris/qe/ShowExecutor.java     |  6 +--
 4 files changed, 13 insertions(+), 65 deletions(-)

diff --git a/fe/src/main/cup/sql_parser.cup b/fe/src/main/cup/sql_parser.cup
index a2e2de6..2f640e6 100644
--- a/fe/src/main/cup/sql_parser.cup
+++ b/fe/src/main/cup/sql_parser.cup
@@ -1931,11 +1931,6 @@ show_param ::=
     {:
         RESULT = new ShowProcesslistStmt();
     :}
-    /* show keys */
-    | keys_or_index from_or_in table_ref:table opt_db:db where_clause:e
-    {:
-        RESULT = new ShowKeysStmt();
-    :}
     /* routine */
     | procedure_or_function KW_STATUS opt_wild_where
     {:
@@ -2159,14 +2154,10 @@ show_param ::=
     {:
         RESULT = new ShowSmallFilesStmt(dbName);
     :}
-    | KW_INDEX KW_FROM table_name:dbTblName opt_db:dbName
+    | keys_or_index from_or_in table_name:dbTblName opt_db:dbName
     {:
         RESULT = new ShowIndexStmt(dbName, dbTblName);
     :}
-    | KW_INDEXES KW_FROM table_name:tableName opt_db:dbName
-    {:
-        RESULT = new ShowIndexStmt(dbName, tableName);
-    :}
     | KW_TRANSACTION opt_db:dbName opt_wild_where
     {:
         RESULT = new ShowTransactionStmt(dbName, parser.where);
diff --git a/fe/src/main/java/org/apache/doris/analysis/ShowIndexStmt.java b/fe/src/main/java/org/apache/doris/analysis/ShowIndexStmt.java
index dd5237b..e025b2c 100644
--- a/fe/src/main/java/org/apache/doris/analysis/ShowIndexStmt.java
+++ b/fe/src/main/java/org/apache/doris/analysis/ShowIndexStmt.java
@@ -35,9 +35,16 @@ public class ShowIndexStmt extends ShowStmt {
     private static final ShowResultSetMetaData META_DATA =
             ShowResultSetMetaData.builder()
                     .addColumn(new Column("Table", ScalarType.createVarchar(64)))
-                    .addColumn(new Column("Index_name", ScalarType.createVarchar(10)))
+                    .addColumn(new Column("Non_unique", ScalarType.createVarchar(10)))
+                    .addColumn(new Column("Key_name", ScalarType.createVarchar(80)))
+                    .addColumn(new Column("Seq_in_index", ScalarType.createVarchar(64)))
                     .addColumn(new Column("Column_name", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Index_type", ScalarType.createVarchar(64)))
+                    .addColumn(new Column("Collation", ScalarType.createVarchar(80)))
+                    .addColumn(new Column("Cardinality", ScalarType.createVarchar(80)))
+                    .addColumn(new Column("Sub_part", ScalarType.createVarchar(80)))
+                    .addColumn(new Column("Packed", ScalarType.createVarchar(80)))
+                    .addColumn(new Column("Null", ScalarType.createVarchar(80)))
+                    .addColumn(new Column("Index_type", ScalarType.createVarchar(80)))
                     .addColumn(new Column("Comment", ScalarType.createVarchar(80)))
                     .build();
     private String dbName;
diff --git a/fe/src/main/java/org/apache/doris/analysis/ShowKeysStmt.java b/fe/src/main/java/org/apache/doris/analysis/ShowKeysStmt.java
deleted file mode 100644
index 7cef398..0000000
--- a/fe/src/main/java/org/apache/doris/analysis/ShowKeysStmt.java
+++ /dev/null
@@ -1,50 +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.analysis;
-
-import org.apache.doris.catalog.Column;
-import org.apache.doris.catalog.ScalarType;
-import org.apache.doris.qe.ShowResultSetMetaData;
-
-// SHOW KEYS FROM TABLE
-public class ShowKeysStmt extends ShowStmt {
-    private static final ShowResultSetMetaData META_DATA =
-            ShowResultSetMetaData.builder()
-                    .addColumn(new Column("Table", ScalarType.createVarchar(64)))
-                    .addColumn(new Column("Non_unique", ScalarType.createVarchar(10)))
-                    .addColumn(new Column("Key_name", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Seq_in_index", ScalarType.createVarchar(64)))
-                    .addColumn(new Column("Column_name", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Collation", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Cardinality", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Sub_part", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Packed", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Null", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Index_type", ScalarType.createVarchar(80)))
-                    .addColumn(new Column("Comment", ScalarType.createVarchar(80)))
-                    .build();
-
-    @Override
-    public void analyze(Analyzer analyzer) {
-    }
-
-    @Override
-    public ShowResultSetMetaData getMetaData() {
-        return META_DATA;
-    }
-}
diff --git a/fe/src/main/java/org/apache/doris/qe/ShowExecutor.java b/fe/src/main/java/org/apache/doris/qe/ShowExecutor.java
index b0284aa..d380a1f 100644
--- a/fe/src/main/java/org/apache/doris/qe/ShowExecutor.java
+++ b/fe/src/main/java/org/apache/doris/qe/ShowExecutor.java
@@ -671,9 +671,9 @@ public class ShowExecutor {
             if (table != null && table instanceof OlapTable) {
                 List<Index> indexes = ((OlapTable) table).getIndexes();
                 for (Index index : indexes) {
-                    rows.add(Lists.newArrayList(showStmt.getTableName().toString(), index.getIndexName(),
-                            index.getColumns().stream().collect(Collectors.joining(",")),
-                            index.getIndexType().name(), index.getComment()));
+                    rows.add(Lists.newArrayList(showStmt.getTableName().toString(), "", index.getIndexName(),
+                            "", index.getColumns().stream().collect(Collectors.joining(",")), "", "", "", "",
+                            "", index.getIndexType().name(), index.getComment()));
                 }
             } else {
                 ErrorReport.reportAnalysisException(ErrorCode.ERR_BAD_TABLE_ERROR,


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