1
votes

I have a really simple hive table and I'm trying to query it with a GROUP BY clause. When I run the query I get this error:

org.apache.hive.service.cli.HiveSQLException:Expected states: [FINISHED], but found ERROR:26:25

Any help is appreciated.

A simple select query works fine, but when I added the GROUP BY clause it starts failing.

This works:

SELECT city,
       count(*) 
FROM cust_sales;

This fails:

SELECT city,
       count(*) 
FROM cust_sales
GROUP BY city;

cust_sales has only 2 columns. City (varchar) and amount (int).

The full error I'm getting:

TFetchResultsResp(results=None, status=TStatus(infoMessages=['*org.apache.hive.service.cli.HiveSQLException:Expected states: [FINISHED], but found ERROR:26:25', 
'org.apache.hive.service.cli.operation.Operation:assertState:Operation.java:197', 
'org.apache.hive.service.cli.operation.SQLOperation:getNextRowSet:SQLOperation.java:441', 
'org.apache.hive.service.cli.operation.OperationManager:getOperationNextRowSet:OperationManager.java:328', 
'org.apache.hive.service.cli.session.HiveSessionImpl:fetchResults:HiveSessionImpl.java:910', 'sun.reflect.GeneratedMethodAccessor149:invoke::-1', 
'sun.reflect.DelegatingMethodAccessorImpl:invoke:DelegatingMethodAccessorImpl.java:43',
'java.lang.reflect.Method:invoke:Method.java:498', 
'org.apache.hive.service.cli.session.HiveSessionProxy:invoke:HiveSessionProxy.java:78', 
'org.apache.hive.service.cli.session.HiveSessionProxy:access$000:HiveSessionProxy.java:36', 
'org.apache.hive.service.cli.session.HiveSessionProxy$1:run:HiveSessionProxy.java:63', 
'java.security.AccessController:doPrivileged:AccessController.java:-2', 
'javax.security.auth.Subject:doAs:Subject.java:422', 
'org.apache.hadoop.security.UserGroupInformation:doAs:UserGroupInformation.java:1730', 
'org.apache.hive.service.cli.session.HiveSessionProxy:invoke:HiveSessionProxy.java:59',
'com.sun.proxy.$Proxy71:fetchResults::-1', 
'org.apache.hive.service.cli.CLIService:fetchResults:CLIService.java:564', 
'org.apache.hive.service.cli.thrift.ThriftCLIService:FetchResults:ThriftCLIService.java:786', 
'org.apache.hive.service.rpc.thrift.TCLIService$Processor$FetchResults:getResult:TCLIService.java:1837', 
'org.apache.hive.service.rpc.thrift.TCLIService$Processor$FetchResults:getResult:TCLIService.java:1822', 
'org.apache.thrift.ProcessFunction:process:ProcessFunction.java:39', 
'org.apache.thrift.TBaseProcessor:process:TBaseProcessor.java:39', 
'org.apache.hadoop.hive.metastore.security.HadoopThriftAuthBridge$Server$TUGIAssumingProcessor:process:HadoopThriftAuthBridge.java:647', 
'org.apache.thrift.server.TThreadPoolServer$WorkerProcess:run:TThreadPoolServer.java:286', 
'java.util.concurrent.ThreadPoolExecutor:runWorker:ThreadPoolExecutor.java:1149', 
'java.util.concurrent.ThreadPoolExecutor$Worker:run:ThreadPoolExecutor.java:624'
,
'java.lang.Thread:run:Thread.java:748'], 
sqlState=None, statusCode=3, 
errorCode=0, errorMessage='Expected states: [FINISHED], but found ERROR'), hasMoreRows=None)
2

2 Answers

0
votes

I had the same error. This error resolved when i restarted my TEZ service. The group by query still timed out through superset, but i was able to ssh into my vagrant vm and then complete the query via hive. Hope that helps.

0
votes

It was a problem with permissions. I had to fix the YARN permissions (it was using ranger's acls and its own, instead of just ranger's) by setting ranger.add-yarn-authorization to false. Now everything works fine.