[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15399830#comment-15399830 ] Eugene Koifman commented on HIVE-13991: --- back ported to branch-1 https://github.com/apache/hive/commit/123f088a3a029c4b01db3e7cc0769a5836e1f6c6 > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Fix For: 1.3.0, 2.2.0, 2.1.1 > > Attachments: HIVE-13991.1.patch, HIVE-13991.2.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15348284#comment-15348284 ] Aihua Xu commented on HIVE-13991: - Thanks for the explanation. I can't think of a better way. Maybe add a little comments when you commit on that line to set mergeIsDirect. +1. > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Attachments: HIVE-13991.1.patch, HIVE-13991.2.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15348278#comment-15348278 ] Yongzhi Chen commented on HIVE-13991: - init(true); combined with genResolvedParseTree() do the step one work, so assign mergeIsDirect in init(boolean) is fine. You can think it is the same reason as clear pruned partitions or not. There are only two places in our code that calls genResolvedParseTree() , list it may help you understand the code: {noformat} if (reAnalyzeAST) { init(true); prunedPartitions.clear(); // Assumption: At this point Parse Tree gen & resolution will always // be true (since we started out that way). super.genResolvedParseTree(ast, new PlannerContext()); {noformat} > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Attachments: HIVE-13991.1.patch, HIVE-13991.2.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15346618#comment-15346618 ] Aihua Xu commented on HIVE-13991: - OK. That makes more sense. So will you change the code to differentiate the calls based on them, like from genResolvedParseTree() you will do merge, or you keep the same code just with a better explanation? Maybe find a more reasonable way to set mergeIsDirect? > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Attachments: HIVE-13991.1.patch, HIVE-13991.2.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15346513#comment-15346513 ] Yongzhi Chen commented on HIVE-13991: - [~aihuaxu], how about the review? Thanks > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Attachments: HIVE-13991.1.patch, HIVE-13991.2.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15327375#comment-15327375 ] Yongzhi Chen commented on HIVE-13991: - The failures are not related. > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Attachments: HIVE-13991.1.patch, HIVE-13991.2.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15326763#comment-15326763 ] Hive QA commented on HIVE-13991: Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12809736/HIVE-13991.2.patch {color:green}SUCCESS:{color} +1 due to 1 test(s) being added or modified. {color:red}ERROR:{color} -1 due to 7 failed/errored test(s), 10224 tests executed *Failed tests:* {noformat} org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_acid_globallimit org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_list_bucket_dml_12 org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_list_bucket_dml_13 org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_stats_list_bucket org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_subquery_multiinsert org.apache.hadoop.hive.cli.TestMiniSparkOnYarnCliDriver.testCliDriver_index_bitmap3 org.apache.hadoop.hive.ql.TestTxnCommands.testSimpleAcidInsert {noformat} Test results: https://builds.apache.org/job/PreCommit-HIVE-MASTER-Build/103/testReport Console output: https://builds.apache.org/job/PreCommit-HIVE-MASTER-Build/103/console Test logs: http://ec2-50-18-27-0.us-west-1.compute.amazonaws.com/logs/PreCommit-HIVE-MASTER-Build-103/ Messages: {noformat} Executing org.apache.hive.ptest.execution.TestCheckPhase Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 7 tests failed {noformat} This message is automatically generated. ATTACHMENT ID: 12809736 - PreCommit-HIVE-MASTER-Build > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Attachments: HIVE-13991.1.patch, HIVE-13991.2.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15326716#comment-15326716 ] Yongzhi Chen commented on HIVE-13991: - Second patch working on the case select * from view union all select * from table > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Attachments: HIVE-13991.1.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15325746#comment-15325746 ] Hive QA commented on HIVE-13991: Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12809349/HIVE-13991.1.patch {color:green}SUCCESS:{color} +1 due to 1 test(s) being added or modified. {color:red}ERROR:{color} -1 due to 8 failed/errored test(s), 10223 tests executed *Failed tests:* {noformat} org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_acid_globallimit org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_list_bucket_dml_13 org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_stats_list_bucket org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_subquery_multiinsert org.apache.hadoop.hive.cli.TestMiniSparkOnYarnCliDriver.testCliDriver_constprog_partitioner org.apache.hadoop.hive.cli.TestMiniSparkOnYarnCliDriver.testCliDriver_index_bitmap3 org.apache.hadoop.hive.cli.TestMinimrCliDriver.testCliDriver_schemeAuthority org.apache.hadoop.hive.ql.plan.TestReadEntityDirect.testSelectEntityViewDirectUnion {noformat} Test results: https://builds.apache.org/job/PreCommit-HIVE-MASTER-Build/82/testReport Console output: https://builds.apache.org/job/PreCommit-HIVE-MASTER-Build/82/console Test logs: http://ec2-50-18-27-0.us-west-1.compute.amazonaws.com/logs/PreCommit-HIVE-MASTER-Build-82/ Messages: {noformat} Executing org.apache.hive.ptest.execution.TestCheckPhase Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 8 tests failed {noformat} This message is automatically generated. ATTACHMENT ID: 12809349 - PreCommit-HIVE-MASTER-Build > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > Attachments: HIVE-13991.1.patch > > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HIVE-13991) Union All on view fail with no valid permission on underneath table
[ https://issues.apache.org/jira/browse/HIVE-13991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15323765#comment-15323765 ] Yongzhi Chen commented on HIVE-13991: - There are inconsistent key values between put and get operations for map viewAliasToInput In private void getMetaData(QB qb, ReadEntity parentInput) method: {noformat} // This is the last time we'll see the Table objects for views, so add it to the inputs // now. isInsideView will tell if this view is embedded in another view. ReadEntity viewInput = new ReadEntity(tab, parentInput, !qb.isInsideView()); viewInput = PlanUtils.addInput(inputs, viewInput); aliasToViewInfo.put(alias, new ObjectPair(fullViewName, viewInput)); viewAliasToInput.put(getAliasId(alias, qb), viewInput); {noformat} The key is getAliasId(alias, qb), the key is non-processed alias ID, for the union all case, it looks like null-subquery1:_u1-subquery1:viewsrc But in method getParentViewInfo, alias ID is processed before get from the map. The alias ID replace subquery1 to empty, the key looks like following: null:_u1:viewsrc {noformat} public static ReadEntity getParentViewInfo(String alias_id, Map viewAliasToInput) { String[] aliases = alias_id.split(":"); String currentAlias = null; ReadEntity currentInput = null; // Find the immediate parent possible. // For eg: for a query like 'select * from V3', where V3 -> V2, V2 -> V1, V1 -> T // -> implies depends on. // T's parent would be V1 for (int pos = 0; pos < aliases.length; pos++) { currentAlias = currentAlias == null ? aliases[pos] : currentAlias + ":" + aliases[pos]; currentAlias = currentAlias.replace(SemanticAnalyzer.SUBQUERY_TAG_1, "") .replace(SemanticAnalyzer.SUBQUERY_TAG_2, ""); ReadEntity input = viewAliasToInput.get(currentAlias); {noformat} This inconsistence causes getParentViewInfo return null. Attach the patch to fix the issue. > Union All on view fail with no valid permission on underneath table > --- > > Key: HIVE-13991 > URL: https://issues.apache.org/jira/browse/HIVE-13991 > Project: Hive > Issue Type: Bug > Components: Query Planning >Reporter: Yongzhi Chen >Assignee: Yongzhi Chen > > When sentry is enabled. > create view V as select * from T; > When the user has read permission on view V, but does not have read > permission on table T, > select * from V union all select * from V > failed with: > {noformat} > 0: jdbc:hive2://> select * from s07view union all select * from > s07view limit 1; > Error: Error while compiling statement: FAILED: SemanticException No valid > privileges > Required privileges for this query: > Server=server1->Db=default->Table=sample_07->action=select; > (state=42000,code=4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)