Hive
  1. Hive
  2. HIVE-6853

show create table for hbase tables should exclude LOCATION

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.14.0
    • Component/s: StorageHandler
    • Labels:
      None

      Description

      If you create a table on top of hbase in hive and issue a "show create table <hbase_table>", it gives a bad DDL. It should not show LOCATION:

      [hive]$ cat /tmp/test_create.sql
      CREATE EXTERNAL TABLE nba_twitter.hbase2(
      key string COMMENT 'from deserializer',
      name string COMMENT 'from deserializer',
      pdt string COMMENT 'from deserializer',
      service string COMMENT 'from deserializer',
      term string COMMENT 'from deserializer',
      update1 string COMMENT 'from deserializer')
      ROW FORMAT SERDE
      'org.apache.hadoop.hive.hbase.HBaseSerDe'
      STORED BY
      'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
      WITH SERDEPROPERTIES (
      'serialization.format'='1',
      'hbase.columns.mapping'=':key,srv:name,srv:pdt,srv:service,srv:term,srv:update')
      LOCATION
      'hdfs://nameservice1/user/hive/warehouse/nba_twitter.db/hbase'
      TBLPROPERTIES (
      'hbase.table.name'='NBATwitter',
      'transient_lastDdlTime'='1386172188')
      Trying to create a table using the above fails:

      [hive]$ hive -f /tmp/test_create.sql
      cli "-f /tmp/test_create.sql"
      Logging initialized using configuration in jar:file:/opt/cloudera/parcels/CDH-4.4.0-1.cdh4.4.0.p0.39/lib/hive/lib/hive-common-0.10.0-cdh4.4.0.jar!/hive-log4j.properties
      FAILED: Error in metadata: MetaException(message:LOCATION may not be specified for HBase.)
      FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

      However, if I remove the LOCATION, then the DDL is valid.

      1. HIVE-6853-0.patch
        4 kB
        Miklos Christine
      2. HIVE-6853.patch
        4 kB
        Miklos Christine

        Activity

        Hide
        Thejas M Nair added a comment -

        This has been fixed in 0.14 release. Please open new jira if you see any issues.

        Show
        Thejas M Nair added a comment - This has been fixed in 0.14 release. Please open new jira if you see any issues.
        Hide
        Ashutosh Chauhan added a comment -

        Committed to trunk. Thanks, Miklos!

        Show
        Ashutosh Chauhan added a comment - Committed to trunk. Thanks, Miklos!
        Hide
        Ashutosh Chauhan added a comment -

        +1

        Show
        Ashutosh Chauhan added a comment - +1
        Hide
        Hive QA added a comment -

        Overall: +1 all checks pass

        Here are the results of testing the latest attachment:
        https://issues.apache.org/jira/secure/attachment/12639336/HIVE-6853.patch

        SUCCESS: +1 5556 tests passed

        Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/2194/testReport
        Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/2194/console

        Messages:

        Executing org.apache.hive.ptest.execution.PrepPhase
        Executing org.apache.hive.ptest.execution.ExecutionPhase
        Executing org.apache.hive.ptest.execution.ReportingPhase
        

        This message is automatically generated.

        ATTACHMENT ID: 12639336

        Show
        Hive QA added a comment - Overall : +1 all checks pass Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12639336/HIVE-6853.patch SUCCESS: +1 5556 tests passed Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/2194/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/2194/console Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase This message is automatically generated. ATTACHMENT ID: 12639336
        Hide
        Szehon Ho added a comment -

        Thanks , for the most part it LGTM. I guess its not the cleanest, as its breaking the StorageHandler abstraction. Probably cleaner to add some hook to StorageHandler interface, but due to backward compatibility, its probably not worth it for this use-case.

        +1 (non-binding)

        Show
        Szehon Ho added a comment - Thanks , for the most part it LGTM. I guess its not the cleanest, as its breaking the StorageHandler abstraction. Probably cleaner to add some hook to StorageHandler interface, but due to backward compatibility, its probably not worth it for this use-case. +1 (non-binding)
        Hide
        Miklos Christine added a comment -

        bq: is it needed to make a StringBuilder when there is only one string to return?
        Fixed. I removed it and just returned the string.

        Show
        Miklos Christine added a comment - bq: is it needed to make a StringBuilder when there is only one string to return? Fixed. I removed it and just returned the string.
        Hide
        Szehon Ho added a comment -

        Thanks for the fix, only one minor comment, is it needed to make a StringBuilder when there is only one string to return?

        Also can you upload the patch in right name-format? The precommit test takes patches in the form HIVE-XXXX.patch or HIVE-XXXX.n.patch only.

        Show
        Szehon Ho added a comment - Thanks for the fix, only one minor comment, is it needed to make a StringBuilder when there is only one string to return? Also can you upload the patch in right name-format? The precommit test takes patches in the form HIVE-XXXX.patch or HIVE-XXXX.n.patch only.
        Hide
        Miklos Christine added a comment -

        Attaching a patch that checks if the table uses the HBaseStorageHandler and removes the LOCATION field in the show create table method.

        Show
        Miklos Christine added a comment - Attaching a patch that checks if the table uses the HBaseStorageHandler and removes the LOCATION field in the show create table method.

          People

          • Assignee:
            Miklos Christine
            Reporter:
            Miklos Christine
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development