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

Inputs/Outputs are not propagated to SA hooks for explain commands.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: HiveServer2
    • Labels:
      None

      Description

      With Sentry enabled, commands like explain drop table foo fail with

      explain drop table foo;
      Error: Error while compiling statement: FAILED: SemanticException No valid privileges
       Required privilege( Table) not available in input privileges
       The required privileges: (state=42000,code=40000)
      

      Sentry fails to authorize because the ExplainSemanticAnalyzer uses an instance of DDLSemanticAnalyzer to analyze the explain query.

      BaseSemanticAnalyzer sem = SemanticAnalyzerFactory.get(conf, input);
      sem.analyze(input, ctx);
      sem.validate()
      

      The inputs/outputs entities for this query are set in the above code. However, these are never set on the instance of ExplainSemanticAnalyzer itself and thus is not propagated into the HookContext in the calling Driver code.

      sem.analyze(tree, ctx); --> this results in calling the above code that uses DDLSA
      hookCtx.update(sem); --> sem is an instance of ExplainSemanticAnalyzer, this code attempts to update the HookContext with the input/output info from ESA which is never set.
      

        Attachments

        1. HIVE-18829.patch
          0.7 kB
          Naveen Gangam

          Issue Links

            Activity

              People

              • Assignee:
                ngangam Naveen Gangam
                Reporter:
                ngangam Naveen Gangam
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: