You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Yongzhi Chen (JIRA)" <ji...@apache.org> on 2017/06/20 19:45:00 UTC

[jira] [Comment Edited] (HIVE-16875) Query against view with partitioned child on HoS fails with privilege exception.

    [ https://issues.apache.org/jira/browse/HIVE-16875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16056338#comment-16056338 ] 

Yongzhi Chen edited comment on HIVE-16875 at 6/20/17 7:44 PM:
--------------------------------------------------------------

AFAIK: they are sometimes are different:
Following is from hive comment in GenSparkProcContext.java: 
 // Alias to operator map, from the semantic analyzer.
  // This is necessary as sometimes semantic analyzer's mapping is different than operator's own alias.
  public final Map<String, Operator<? extends OperatorDesc>> topOps;

And it is what I saw when debugging. 

In SemanticAnalyzer.java:
private Operator genTablePlan(String alias, QB qb) throws SemanticException {

String alias_id = getAliasId(alias, qb);

.....
 // Create the root of the operator tree
      TableScanDesc tsDesc = new TableScanDesc(alias, vcList, tab);
      setupStats(tsDesc, qb.getParseInfo(), tab, alias, rwsch);


....
      top = putOpInsertMap(OperatorFactory.get(tsDesc,
          new RowSchema(rwsch.getColumnInfos())), rwsch);

...
     // Add this to the list of top operators - we always start from a table
      // scan
      topOps.put(alias_id, top);


If alias != alias_id, then the conf (TableScanDesc) is different from topOps's key



was (Author: ychena):
AFAIK: they are sometimes are different:
Following is from hive comment in GenSparkProcContext.java: 
 // Alias to operator map, from the semantic analyzer.
  // This is necessary as sometimes semantic analyzer's mapping is different than operator's own alias.
  public final Map<String, Operator<? extends OperatorDesc>> topOps;

And it is what I saw when debugging. 

> Query against view with partitioned child on HoS fails with privilege exception.
> --------------------------------------------------------------------------------
>
>                 Key: HIVE-16875
>                 URL: https://issues.apache.org/jira/browse/HIVE-16875
>             Project: Hive
>          Issue Type: Bug
>          Components: Spark
>    Affects Versions: 1.0.0
>            Reporter: Yongzhi Chen
>            Assignee: Yongzhi Chen
>         Attachments: HIVE-16875.1.patch, HIVE-16875.2.patch
>
>
> Query against view with child table that has partitions fails with privilege exception even with correct privileges.
> Reproduce:
> {noformat}
> create table jsamp1 (a string) partitioned by (b int);
> insert into table jsamp1 partition (b=1) values ("hello");
> create view jview as select * from jsamp1;
> create role viewtester;
> grant all on table jview to role viewtester;
> grant role viewtester to group testers;
> Use MR, the select will succeed:
> set hive.execution.engine=mr;
> select count(*) from jview;
> while use spark:
> set hive.execution.engine=spark;
> select count(*) from jview;
> it fails with:
> Error: Error while compiling statement: FAILED: SemanticException No valid privileges
>  User tester does not have privileges for QUERY
>  The required privileges: Server=server1->Db=default->Table=j1part->action=select; (state=42000,code=40000)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)