[ https://issues.apache.org/jira/browse/HIVE-16660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yongzhi Chen updated HIVE-16660: -------------------------------- Attachment: HIVE-16660.1.patch The error is because hive fail to compile internal query generated for the alter operation: SELECT * FROM `default.test_view` WHERE (`p` = '2'); caused NPE when sentry enabled: {noformat} HiveServer2-Handler-Pool: Thread-68]: FAILED: NullPointerException null java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187) at com.google.common.cache.LocalCache.get(LocalCache.java:3964) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3969) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4829) at org.apache.hadoop.security.Groups.getGroups(Groups.java:215) at org.apache.sentry.provider.common.HadoopGroupMappingService.getGroups(HadoopGroupMappingService.java:60) at org.apache.sentry.binding.hive.authz.HiveAuthzBinding.getGroups(HiveAuthzBinding.java:372) at org.apache.sentry.binding.hive.HiveAuthzBindingHook.postAnalyze(HiveAuthzBindingHook.java:395) at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:449) at org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeAlterTableAddParts(DDLSemanticAnalyzer.java:2819) at org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeInternal(DDLSemanticAnalyzer.java:385) at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:223) at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:446) at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:312) at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1201) at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1188) at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:134) at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:206) at org.apache.hive.service.cli.operation.Operation.run(Operation.java:327) at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:424) at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:401) at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:258) at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:500) at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313) at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298) at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge$Server$TUGIAssumingProcessor.process(HadoopThriftAuthBridge.java:746) at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {noformat} The NPE is because of null userName for the newly created Driver object for the query. The patch fix the issue by adding username information. Also fix the NPE when some user applicate call get partition path information from a view. The NPE like: {noformat} Caused by: java.lang.NullPointerException at org.apache.hadoop.hive.ql.metadata.Partition.getDataLocation(Partition.java:241) at org.apache.hadoop.hive.ql.metadata.Partition.getPartitionPath(Partition.java:236) .... at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1648) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1318) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1127) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1120) at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:178) ... 11 more {noformat} > Not able to add partition for views in hive when sentry is enabled > ------------------------------------------------------------------ > > Key: HIVE-16660 > URL: https://issues.apache.org/jira/browse/HIVE-16660 > Project: Hive > Issue Type: Bug > Components: Parser > Reporter: Yongzhi Chen > Assignee: Yongzhi Chen > Attachments: HIVE-16660.1.patch > > > Repro: > create table tesnit (a int) partitioned by (p int); > insert into table tesnit partition (p = 1) values (1); > insert into table tesnit partition (p = 2) values (1); > create view test_view partitioned on (p) as select * from tesnit where p =1; > alter view test_view add partition (p = 2); > Error: Error while compiling statement: FAILED: SemanticException [Error > 10056]: The query does not reference any valid partition. To run this query, > set hive.mapred.mode=nonstrict (state=42000,code=10056) -- This message was sent by Atlassian JIRA (v6.3.15#6346)