Skip to content

Commit

Permalink
HIVE-8803 : DESC SCHEMA <DATABASE-NAME> is not working (Navis via Sze…
Browse files Browse the repository at this point in the history
…hon)

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1640412 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Szehon Ho committed Nov 18, 2014
1 parent 72560a5 commit 483d92b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ql/src/java/org/apache/hadoop/hive/ql/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,8 @@ private String getExplainOutput(BaseSemanticAnalyzer sem, QueryPlan plan,
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
try {
task.getJSONPlan(ps, astStringTree, sem.getRootTasks(), sem.getFetchTask(),
false, true, true);
List<Task<?>> rootTasks = sem.getRootTasks();
task.getJSONPlan(ps, astStringTree, rootTasks, sem.getFetchTask(), false, true, true);
ret = baos.toString();
} catch (Exception e) {
LOG.warn("Exception generating explain output: " + e, e);
Expand Down
4 changes: 2 additions & 2 deletions ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
Original file line number Diff line number Diff line change
Expand Up @@ -1316,9 +1316,9 @@ descPartTypeExpr
descStatement
@init { pushMsg("describe statement", state); }
@after { popMsg(state); }
: (KW_DESCRIBE|KW_DESC) (descOptions=KW_FORMATTED|descOptions=KW_EXTENDED|descOptions=KW_PRETTY)? (parttype=descPartTypeExpr) -> ^(TOK_DESCTABLE $parttype $descOptions?)
: (KW_DESCRIBE|KW_DESC) (KW_DATABASE|KW_SCHEMA) KW_EXTENDED? (dbName=identifier) -> ^(TOK_DESCDATABASE $dbName KW_EXTENDED?)
| (KW_DESCRIBE|KW_DESC) (descOptions=KW_FORMATTED|descOptions=KW_EXTENDED|descOptions=KW_PRETTY)? (parttype=descPartTypeExpr) -> ^(TOK_DESCTABLE $parttype $descOptions?)
| (KW_DESCRIBE|KW_DESC) KW_FUNCTION KW_EXTENDED? (name=descFuncNames) -> ^(TOK_DESCFUNCTION $name KW_EXTENDED?)
| (KW_DESCRIBE|KW_DESC) (KW_DATABASE|KW_SCHEMA) KW_EXTENDED? (dbName=identifier) -> ^(TOK_DESCDATABASE $dbName KW_EXTENDED?)
;
Expand Down
1 change: 1 addition & 0 deletions ql/src/test/queries/clientpositive/describe_database.q
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
create database test_db with dbproperties ('key1' = 'value1', 'key2' = 'value2');
desc database extended test_db;
desc schema extended test_db;
drop database test_db;
4 changes: 4 additions & 0 deletions ql/src/test/queries/clientpositive/describe_database_json.q
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ DESCRIBE DATABASE jsondb1;

DESCRIBE DATABASE EXTENDED jsondb1;

DESCRIBE SCHEMA jsondb1;

DESCRIBE SCHEMA EXTENDED jsondb1;

SHOW DATABASES;

SHOW DATABASES LIKE 'json*';
Expand Down
5 changes: 5 additions & 0 deletions ql/src/test/results/clientpositive/describe_database.q.out
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ PREHOOK: type: DESCDATABASE
POSTHOOK: query: desc database extended test_db
POSTHOOK: type: DESCDATABASE
test_db location/in/test hive_test_user USER {key2=value2, key1=value1}
PREHOOK: query: desc schema extended test_db
PREHOOK: type: DESCDATABASE
POSTHOOK: query: desc schema extended test_db
POSTHOOK: type: DESCDATABASE
test_db location/in/test hive_test_user USER {key2=value2, key1=value1}
PREHOOK: query: drop database test_db
PREHOOK: type: DROPDATABASE
PREHOOK: Input: database:test_db
Expand Down
10 changes: 10 additions & 0 deletions ql/src/test/results/clientpositive/describe_database_json.q.out
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ PREHOOK: type: DESCDATABASE
POSTHOOK: query: DESCRIBE DATABASE EXTENDED jsondb1
POSTHOOK: type: DESCDATABASE
#### A masked pattern was here ####
PREHOOK: query: DESCRIBE SCHEMA jsondb1
PREHOOK: type: DESCDATABASE
POSTHOOK: query: DESCRIBE SCHEMA jsondb1
POSTHOOK: type: DESCDATABASE
#### A masked pattern was here ####
PREHOOK: query: DESCRIBE SCHEMA EXTENDED jsondb1
PREHOOK: type: DESCDATABASE
POSTHOOK: query: DESCRIBE SCHEMA EXTENDED jsondb1
POSTHOOK: type: DESCDATABASE
#### A masked pattern was here ####
PREHOOK: query: SHOW DATABASES
PREHOOK: type: SHOWDATABASES
POSTHOOK: query: SHOW DATABASES
Expand Down

0 comments on commit 483d92b

Please sign in to comment.