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

Extend ReadEntity to add accessed columns from query

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.14.0
    • None
    • None

    Description

      Now what we get from HiveSemanticAnalyzerHookContextImpl is limited. If we have hook of HiveSemanticAnalyzerHook, we may want to get more things from hookContext. (e.g. the needed colums from query).
      So we should get instance of HiveSemanticAnalyzerHookContext from configuration, extends HiveSemanticAnalyzerHookContext with a new implementation, overide the HiveSemanticAnalyzerHookContext.update() and put what you want to the class.
      Hive should store accessed columns to ReadEntity when we set HIVE_STATS_COLLECT_SCANCOLS(or we can add a confVar) is true.
      Then external authorization model can get accessed columns when do authorization in compile before execute. Maybe we will remove columnAccessInfo from BaseSemanticAnalyzer, old authorization and AuthorizationModeV2 can get accessed columns from ReadEntity too.
      Here is the quick implement in SemanticAnalyzer.analyzeInternal() below:

         boolean isColumnInfoNeedForAuth = SessionState.get().isAuthorizationModeV2()
              && HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED);
          if (isColumnInfoNeedForAuth
              || HiveConf.getBoolVar(this.conf, HiveConf.ConfVars.HIVE_STATS_COLLECT_SCANCOLS) == true) {
            ColumnAccessAnalyzer columnAccessAnalyzer = new ColumnAccessAnalyzer(pCtx);
            setColumnAccessInfo(columnAccessAnalyzer.analyzeColumnAccess()); 
          }
          compiler.compile(pCtx, rootTasks, inputs, outputs);
          // TODO: 
          // after compile, we can put accessed column list to ReadEntity getting from columnAccessInfo if HIVE_AUTHORIZATION_ENABLED is set true
      

      Attachments

        1. HIVE-7730.001.patch
          4 kB
          Xiaomeng Huang
        2. HIVE-7730.002.patch
          3 kB
          Xiaomeng Huang
        3. HIVE-7730.003.patch
          3 kB
          Xiaomeng Huang
        4. HIVE-7730.004.patch
          3 kB
          Xiaomeng Huang

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Huang Xiaomeng Xiaomeng Huang Assign to me
            Huang Xiaomeng Xiaomeng Huang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment