Skip to content

Commit

Permalink
HIVE-2822 [jira] Add JSON output to the hive ddl commands
Browse files Browse the repository at this point in the history
(Chris Dean via Ashutosh Chauhan)

Summary:
JSON output for DDL commands

By setting the variable hive.format=json then ddl commands will
produce json output suitable for client side parsing.  For example, to
list all the databases one might get:

    {
      "databases": [
        "default"
      ]
    }

The goal is to have an option to produce JSON output of the DDL commands that is
easily machine parseable.

For example, "desc my_table" currently gives

    id    bigint
    user  string

and we want to allow a json output:

    {
      "columns": [
        {"name": "id", "type": "bigint"},
        {"name": "user", "type": "string"}
      ]
    }

Test Plan: Run the provided unit tests

Reviewers: JIRA, ashutoshc

Reviewed By: ashutoshc

Differential Revision: https://reviews.facebook.net/D2475

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1309666 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ashutoshc committed Apr 5, 2012
1 parent 7e99317 commit f2aa321
Show file tree
Hide file tree
Showing 18 changed files with 1,540 additions and 333 deletions.
1 change: 1 addition & 0 deletions common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
Expand Up @@ -582,6 +582,7 @@ public static enum ConfVars {
// A comma separated list of hooks which implement HiveDriverRunHook and will be run at the
// beginning and end of Driver.run, these will be run in the order specified
HIVE_DRIVER_RUN_HOOKS("hive.exec.driver.run.hooks", ""),
HIVE_DDL_OUTPUT_FORMAT("hive.ddl.output.format", null),
;

public final String varname;
Expand Down
9 changes: 9 additions & 0 deletions conf/hive-default.xml.template
Expand Up @@ -1259,4 +1259,13 @@
</description>
</property>

<property>
<name>hive.ddl.output.format</name>
<value>text</value>
<description>
The data format to use for DDL output. One of "text" (for human
readable text) or "json" (for a json object).
</description>
</property>

</configuration>

0 comments on commit f2aa321

Please sign in to comment.