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

Location of temporary table for CREATE TABLE SELECT broken by HIVE-7079

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0, 2.1.0
    • None
    • None

    Description

      If a user does not have HDFS write permissions to the default database, and attempts to create a table in a private database to which the user does have permissions using CREATE TABLE AS SELECT from a table in the default database, the following happens:

      use default;
      create table grisha.blahblah as select * from some_table;
      FAILED: SemanticException 0:0 Error creating temporary folder on: hdfs://nn.example.com/user/hive/warehouse. Error encountered near token 'TOK_TMP_FILE’
      

      I've edited this issue because my initial explanation was completely bogus. A more likely explanation is in https://github.com/apache/hive/commit/1614314ef7bd0c3b8527ee32a434ababf7711278

       -                fname = ctx.getExternalTmpPath(
       +                fname = ctx.getExtTmpPathRelTo(  
          // and then something incorrect happens in getExtTmpPathRelTo()
      

      In any event - the bug is that the location chosen for the temporary storage is not in the same place as the target table. It should be same as the target table (/user/hive/warehouse/grisha.db in the above example) because this is where presumably the user running the query would have write permissions to.

      Attachments

        1. HIVE-11427.1.patch
          1 kB
          Yongzhi Chen
        2. HIVE-11427.2.patch
          5 kB
          Yongzhi Chen

        Issue Links

          Activity

            People

              ychena Yongzhi Chen
              grisha Gregory Trubetskoy
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: