Uploaded image for project: 'Sentry (Retired)'
  1. Sentry (Retired)
  2. SENTRY-1646

Unable to truncate table <database>.<tablename>; from "default" databases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.7.0, 1.8.0, 2.0.0
    • 1.8.0, 2.0.0
    • Hive Plugin
    • None

    Description

      When the user is doing truncate table <database>.<tablename>; from "default" databases, it throws below error :

      0: jdbc:hive2://localhost:10000/default> truncate table test.test;
      Error: Error while compiling statement: FAILED: SemanticException No valid privileges
       User user1 does not have privileges for TRUNCATETABLE
       The required privileges: Server=server1->Db=default->Table=test->action=*; (state=42000,code=40000)
      

      It works if user does "use database;" and then runs truncate table:

      0: jdbc:hive2://localhost:10000/default> use test;
      INFO  : Compiling command(queryId=hive_20170228141111_654cb0ff-6925-42a4-ba67-a151cd2e4f41): use test
      INFO  : Semantic Analysis Completed
      INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
      INFO  : Completed compiling command(queryId=hive_20170228141111_654cb0ff-6925-42a4-ba67-a151cd2e4f41); Time taken: 0.128 seconds
      INFO  : Executing command(queryId=hive_20170228141111_654cb0ff-6925-42a4-ba67-a151cd2e4f41): use test
      INFO  : Starting task [Stage-0:DDL] in serial mode
      INFO  : Completed executing command(queryId=hive_20170228141111_654cb0ff-6925-42a4-ba67-a151cd2e4f41); Time taken: 0.014 seconds
      INFO  : OK
      No rows affected (0.201 seconds)
      
      
      0: jdbc:hive2://localhost:10000/default> truncate table test.test;
      INFO  : Compiling command(queryId=hive_20170228141111_2441690e-7523-4525-aeb2-5105e31f51c1): truncate table test.test
      INFO  : Semantic Analysis Completed
      INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
      INFO  : Completed compiling command(queryId=hive_20170228141111_2441690e-7523-4525-aeb2-5105e31f51c1); Time taken: 0.111 seconds
      INFO  : Executing command(queryId=hive_20170228141111_2441690e-7523-4525-aeb2-5105e31f51c1): truncate table test.test
      INFO  : Starting task [Stage-0:DDL] in serial mode
      INFO  : Completed executing command(queryId=hive_20170228141111_2441690e-7523-4525-aeb2-5105e31f51c1); Time taken: 0.046 seconds
      INFO  : OK
      No rows affected (0.179 seconds)
      0: jdbc:hive2://localhost:10000/default>
      

      The workaround is to grant user permissions to the current data, then the issue will go away.

      Attachments

        1. SENTRY-1646.1.patch
          2 kB
          Yongzhi Chen
        2. SENTRY-1646.2.patch
          3 kB
          Yongzhi Chen
        3. SENTRY-1646.3.patch
          3 kB
          Yongzhi Chen

        Issue Links

          Activity

            People

              ychena Yongzhi Chen
              ericlin Eric Lin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: