Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-2584

Alter table should accept database name

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 0.7.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      It would be nice if alter table accepts database name.

      For example:

      This would be more useful in certain usecases:

      alter table DB.Tbl set location <location>;

      rather than 2 statements.

      use DB;
      alter table Tbl set location <location>;

      1. HIVE-2584.6.patch
        49 kB
        Chun Chen
      2. HIVE-2584.5.patch
        45 kB
        Chun Chen
      3. HIVE-2584.4.patch
        46 kB
        Chun Chen
      4. HIVE-2584.3.patch
        46 kB
        Chun Chen
      5. HIVE-2584.2.patch
        42 kB
        Chun Chen
      6. HIVE-2584.patch
        31 kB
        Chun Chen

        Issue Links

          Activity

          Hide
          chenchun Chun Chen added a comment -

          marked as duplicate and closed

          Show
          chenchun Chun Chen added a comment - marked as duplicate and closed
          Hide
          navis Navis added a comment -

          I'm on this (including HIVE-4064, HIVE-3589, etc.) .

          Show
          navis Navis added a comment - I'm on this (including HIVE-4064 , HIVE-3589 , etc.) .
          Hide
          leftylev Lefty Leverenz added a comment -

          If most commands accept a database name, we need to add [db_name.] to table_name in the DDL doc (and possibly some other docs). It's already in the CREATE TABLE syntax, but only 5 out of 56 instances of table_name have db_name in syntax or text. Excluding ALTER statements, it's 5 out of 28. For view_name 1 out of 10 has db_name.

          Alternatively, we could change table_name to table_spec, defined as "db_name.table_name" with a list of exceptions. But that would lead to confusion, since people rarely read the DDL doc from the beginning.

          Show
          leftylev Lefty Leverenz added a comment - If most commands accept a database name, we need to add [db_name.] to table_name in the DDL doc (and possibly some other docs). It's already in the CREATE TABLE syntax, but only 5 out of 56 instances of table_name have db_name in syntax or text. Excluding ALTER statements, it's 5 out of 28. For view_name 1 out of 10 has db_name. Alternatively, we could change table_name to table_spec, defined as "db_name.table_name" with a list of exceptions. But that would lead to confusion, since people rarely read the DDL doc from the beginning. LanguageManual DDL
          Hide
          lars_francke Lars Francke added a comment -

          This'd be great to get in to the next version. It's a major undocumented inconsistency between ALTER TABLE and most other commands that do accept a fully qualified name.

          Show
          lars_francke Lars Francke added a comment - This'd be great to get in to the next version. It's a major undocumented inconsistency between ALTER TABLE and most other commands that do accept a fully qualified name.
          Hide
          hiveqa 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/12620402/HIVE-2584.6.patch

          SUCCESS: +1 4813 tests passed

          Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/741/testReport
          Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/741/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: 12620402

          Show
          hiveqa 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/12620402/HIVE-2584.6.patch SUCCESS: +1 4813 tests passed Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/741/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/741/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: 12620402
          Hide
          chenchun Chun Chen added a comment -

          add some code to check return code of rename function.

          Show
          chenchun Chun Chen added a comment - add some code to check return code of rename function.
          Hide
          chenchun Chun Chen added a comment -
          Show
          chenchun Chun Chen added a comment - review: https://reviews.apache.org/r/16447/
          Hide
          hiveqa 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/12620207/HIVE-2584.5.patch

          SUCCESS: +1 4812 tests passed

          Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/731/testReport
          Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/731/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: 12620207

          Show
          hiveqa 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/12620207/HIVE-2584.5.patch SUCCESS: +1 4812 tests passed Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/731/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/731/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: 12620207
          Hide
          hiveqa Hive QA added a comment -

          Overall: -1 no tests executed

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

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

          Messages:

          Executing org.apache.hive.ptest.execution.PrepPhase
          Tests exited with: NonZeroExitCodeException
          Command 'bash /data/hive-ptest/working/scratch/source-prep.sh' failed with exit status 1 and output '+ [[ -n '' ]]
          + export 'ANT_OPTS=-Xmx1g -XX:MaxPermSize=256m '
          + ANT_OPTS='-Xmx1g -XX:MaxPermSize=256m '
          + export 'M2_OPTS=-Xmx1g -XX:MaxPermSize=256m -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128'
          + M2_OPTS='-Xmx1g -XX:MaxPermSize=256m -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128'
          + cd /data/hive-ptest/working/
          + tee /data/hive-ptest/logs/PreCommit-HIVE-Build-730/source-prep.txt
          + [[ false == \t\r\u\e ]]
          + mkdir -p maven ivy
          + [[ svn = \s\v\n ]]
          + [[ -n '' ]]
          + [[ -d apache-svn-trunk-source ]]
          + [[ ! -d apache-svn-trunk-source/.svn ]]
          + [[ ! -d apache-svn-trunk-source ]]
          + cd apache-svn-trunk-source
          + svn revert -R .
          ++ egrep -v '^X|^Performing status on external'
          ++ awk '{print $2}'
          ++ svn status --no-ignore
          + rm -rf
          + svn update
          
          Fetching external item into 'hcatalog/src/test/e2e/harness'
          External at revision 1553117.
          
          At revision 1553117.
          + patchCommandPath=/data/hive-ptest/working/scratch/smart-apply-patch.sh
          + patchFilePath=/data/hive-ptest/working/scratch/build.patch
          + [[ -f /data/hive-ptest/working/scratch/build.patch ]]
          + chmod +x /data/hive-ptest/working/scratch/smart-apply-patch.sh
          + /data/hive-ptest/working/scratch/smart-apply-patch.sh /data/hive-ptest/working/scratch/build.patch
          The patch does not appear to apply with p0, p1, or p2
          + exit 1
          '
          

          This message is automatically generated.

          ATTACHMENT ID: 12620195

          Show
          hiveqa Hive QA added a comment - Overall : -1 no tests executed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12620195/HIVE-2584.4.patch Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/730/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/730/console Messages: Executing org.apache.hive.ptest.execution.PrepPhase Tests exited with: NonZeroExitCodeException Command 'bash /data/hive-ptest/working/scratch/source-prep.sh' failed with exit status 1 and output '+ [[ -n '' ]] + export 'ANT_OPTS=-Xmx1g -XX:MaxPermSize=256m ' + ANT_OPTS='-Xmx1g -XX:MaxPermSize=256m ' + export 'M2_OPTS=-Xmx1g -XX:MaxPermSize=256m -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128' + M2_OPTS='-Xmx1g -XX:MaxPermSize=256m -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128' + cd /data/hive-ptest/working/ + tee /data/hive-ptest/logs/PreCommit-HIVE-Build-730/source-prep.txt + [[ false == \t\r\u\e ]] + mkdir -p maven ivy + [[ svn = \s\v\n ]] + [[ -n '' ]] + [[ -d apache-svn-trunk-source ]] + [[ ! -d apache-svn-trunk-source/.svn ]] + [[ ! -d apache-svn-trunk-source ]] + cd apache-svn-trunk-source + svn revert -R . ++ egrep -v '^X|^Performing status on external' ++ awk '{print $2}' ++ svn status --no-ignore + rm -rf + svn update Fetching external item into 'hcatalog/src/test/e2e/harness' External at revision 1553117. At revision 1553117. + patchCommandPath=/data/hive-ptest/working/scratch/smart-apply-patch.sh + patchFilePath=/data/hive-ptest/working/scratch/build.patch + [[ -f /data/hive-ptest/working/scratch/build.patch ]] + chmod +x /data/hive-ptest/working/scratch/smart-apply-patch.sh + /data/hive-ptest/working/scratch/smart-apply-patch.sh /data/hive-ptest/working/scratch/build.patch The patch does not appear to apply with p0, p1, or p2 + exit 1 ' This message is automatically generated. ATTACHMENT ID: 12620195
          Hide
          hiveqa Hive QA added a comment -

          Overall: -1 no tests executed

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

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

          Messages:

          Executing org.apache.hive.ptest.execution.PrepPhase
          Tests exited with: NonZeroExitCodeException
          Command 'bash /data/hive-ptest/working/scratch/source-prep.sh' failed with exit status 1 and output '+ [[ -n '' ]]
          + export 'ANT_OPTS=-Xmx1g -XX:MaxPermSize=256m '
          + ANT_OPTS='-Xmx1g -XX:MaxPermSize=256m '
          + export 'M2_OPTS=-Xmx1g -XX:MaxPermSize=256m -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128'
          + M2_OPTS='-Xmx1g -XX:MaxPermSize=256m -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128'
          + cd /data/hive-ptest/working/
          + tee /data/hive-ptest/logs/PreCommit-HIVE-Build-729/source-prep.txt
          + [[ false == \t\r\u\e ]]
          + mkdir -p maven ivy
          + [[ svn = \s\v\n ]]
          + [[ -n '' ]]
          + [[ -d apache-svn-trunk-source ]]
          + [[ ! -d apache-svn-trunk-source/.svn ]]
          + [[ ! -d apache-svn-trunk-source ]]
          + cd apache-svn-trunk-source
          + svn revert -R .
          ++ egrep -v '^X|^Performing status on external'
          ++ awk '{print $2}'
          ++ svn status --no-ignore
          + rm -rf target datanucleus.log ant/target shims/target shims/0.20/target shims/0.20S/target shims/0.23/target shims/aggregator/target shims/common/target shims/common-secure/target packaging/target hbase-handler/target testutils/target jdbc/target metastore/target itests/target itests/hcatalog-unit/target itests/test-serde/target itests/qtest/target itests/hive-unit/target itests/custom-serde/target itests/util/target hcatalog/target hcatalog/storage-handlers/hbase/target hcatalog/server-extensions/target hcatalog/core/target hcatalog/webhcat/svr/target hcatalog/webhcat/java-client/target hcatalog/hcatalog-pig-adapter/target hwi/target common/target common/src/gen contrib/target service/target serde/target beeline/target odbc/target cli/target ql/dependency-reduced-pom.xml ql/target
          + svn update
          
          Fetching external item into 'hcatalog/src/test/e2e/harness'
          External at revision 1553093.
          
          At revision 1553093.
          + patchCommandPath=/data/hive-ptest/working/scratch/smart-apply-patch.sh
          + patchFilePath=/data/hive-ptest/working/scratch/build.patch
          + [[ -f /data/hive-ptest/working/scratch/build.patch ]]
          + chmod +x /data/hive-ptest/working/scratch/smart-apply-patch.sh
          + /data/hive-ptest/working/scratch/smart-apply-patch.sh /data/hive-ptest/working/scratch/build.patch
          The patch does not appear to apply with p0, p1, or p2
          + exit 1
          '
          

          This message is automatically generated.

          ATTACHMENT ID: 12620165

          Show
          hiveqa Hive QA added a comment - Overall : -1 no tests executed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12620165/HIVE-2584.3.patch Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/729/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/729/console Messages: Executing org.apache.hive.ptest.execution.PrepPhase Tests exited with: NonZeroExitCodeException Command 'bash /data/hive-ptest/working/scratch/source-prep.sh' failed with exit status 1 and output '+ [[ -n '' ]] + export 'ANT_OPTS=-Xmx1g -XX:MaxPermSize=256m ' + ANT_OPTS='-Xmx1g -XX:MaxPermSize=256m ' + export 'M2_OPTS=-Xmx1g -XX:MaxPermSize=256m -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128' + M2_OPTS='-Xmx1g -XX:MaxPermSize=256m -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128' + cd /data/hive-ptest/working/ + tee /data/hive-ptest/logs/PreCommit-HIVE-Build-729/source-prep.txt + [[ false == \t\r\u\e ]] + mkdir -p maven ivy + [[ svn = \s\v\n ]] + [[ -n '' ]] + [[ -d apache-svn-trunk-source ]] + [[ ! -d apache-svn-trunk-source/.svn ]] + [[ ! -d apache-svn-trunk-source ]] + cd apache-svn-trunk-source + svn revert -R . ++ egrep -v '^X|^Performing status on external' ++ awk '{print $2}' ++ svn status --no-ignore + rm -rf target datanucleus.log ant/target shims/target shims/0.20/target shims/0.20S/target shims/0.23/target shims/aggregator/target shims/common/target shims/common-secure/target packaging/target hbase-handler/target testutils/target jdbc/target metastore/target itests/target itests/hcatalog-unit/target itests/test-serde/target itests/qtest/target itests/hive-unit/target itests/custom-serde/target itests/util/target hcatalog/target hcatalog/storage-handlers/hbase/target hcatalog/server-extensions/target hcatalog/core/target hcatalog/webhcat/svr/target hcatalog/webhcat/java-client/target hcatalog/hcatalog-pig-adapter/target hwi/target common/target common/src/gen contrib/target service/target serde/target beeline/target odbc/target cli/target ql/dependency-reduced-pom.xml ql/target + svn update Fetching external item into 'hcatalog/src/test/e2e/harness' External at revision 1553093. At revision 1553093. + patchCommandPath=/data/hive-ptest/working/scratch/smart-apply-patch.sh + patchFilePath=/data/hive-ptest/working/scratch/build.patch + [[ -f /data/hive-ptest/working/scratch/build.patch ]] + chmod +x /data/hive-ptest/working/scratch/smart-apply-patch.sh + /data/hive-ptest/working/scratch/smart-apply-patch.sh /data/hive-ptest/working/scratch/build.patch The patch does not appear to apply with p0, p1, or p2 + exit 1 ' This message is automatically generated. ATTACHMENT ID: 12620165
          Hide
          hiveqa 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/12617847/HIVE-2584.2.patch

          SUCCESS: +1 4764 tests passed

          Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/579/testReport
          Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/579/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: 12617847

          Show
          hiveqa 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/12617847/HIVE-2584.2.patch SUCCESS: +1 4764 tests passed Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/579/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/579/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: 12617847
          Hide
          hiveqa Hive QA added a comment -

          Overall: -1 at least one tests failed

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

          ERROR: -1 due to 10 failed/errored test(s), 4763 tests executed
          Failed tests:

          org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_drop_multi_partitions
          org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_input3
          org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_insert2_overwrite_partitions
          org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_show_create_table_db_table
          org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_truncate_table
          org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_alter_partition_coltype_2columns
          org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_alter_partition_coltype_invalidtype
          org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_archive_partspec3
          org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_column_rename3
          org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_set_table_property
          

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

          Messages:

          Executing org.apache.hive.ptest.execution.PrepPhase
          Executing org.apache.hive.ptest.execution.ExecutionPhase
          Executing org.apache.hive.ptest.execution.ReportingPhase
          Tests exited with: TestsFailedException: 10 tests failed
          

          This message is automatically generated.

          ATTACHMENT ID: 12617816

          Show
          hiveqa Hive QA added a comment - Overall : -1 at least one tests failed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12617816/HIVE-2584.patch ERROR: -1 due to 10 failed/errored test(s), 4763 tests executed Failed tests: org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_drop_multi_partitions org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_input3 org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_insert2_overwrite_partitions org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_show_create_table_db_table org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_truncate_table org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_alter_partition_coltype_2columns org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_alter_partition_coltype_invalidtype org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_archive_partspec3 org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_column_rename3 org.apache.hadoop.hive.cli.TestNegativeCliDriver.testNegativeCliDriver_set_table_property Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/578/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/578/console Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 10 tests failed This message is automatically generated. ATTACHMENT ID: 12617816
          Hide
          nolanpro Nolan Ehrstrom added a comment -

          +1

          Show
          nolanpro Nolan Ehrstrom added a comment - +1
          Hide
          rkins Rahul Challapalli added a comment -

          Is there any update on this?

          Show
          rkins Rahul Challapalli added a comment - Is there any update on this?

            People

            • Assignee:
              chenchun Chun Chen
              Reporter:
              bharathm Bharath Mundlapudi
            • Votes:
              5 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development