[ 
https://issues.apache.org/jira/browse/LENS-750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Deepak Barr updated LENS-750:
-----------------------------
    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

> Add Hive error codes for Semantic and Authorization exceptions
> --------------------------------------------------------------
>
>                 Key: LENS-750
>                 URL: https://issues.apache.org/jira/browse/LENS-750
>             Project: Apache Lens
>          Issue Type: Improvement
>          Components: api, driver-hive, server
>            Reporter: Deepak Barr
>            Assignee: Deepak Barr
>             Fix For: 2.5
>
>         Attachments: LENS-750.24.patch
>
>
> When a query fails on hive server because of a semantic exception (say table 
> or column does not exist), The submit query [/lensapi/queries] API returns 
> 500 internal server error along with a stack trace. 
> It would be good to define some hive error codes to cover hive semantic 
> exceptions and authorization exceptions. Relevant error messages will enable 
> user to fix their queries.
> Here is sample response on submitted query when table does not exist -
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <lensAPIResult>
>     <id>d482699c-f3cd-49d7-a8a5-dd8437ec4ee3</id>
>     <error>
>         <code>1001</code>
>         <message>Internal Server Error.</message>
>         <stackTrace>org.apache.lens.server.api.error.LensException: Error 
> executing query
>       at org.apache.lens.driver.hive.HiveDriver.execute(HiveDriver.java:516)
>       at org.apache.lens.driver.hive.HiveDriver.explain(HiveDriver.java:426)
>       at org.apache.lens.driver.hive.HiveDriver.estimate(HiveDriver.java:397)
>       at 
> org.apache.lens.server.api.query.AbstractQueryContext$DriverEstimateRunnable.run(AbstractQueryContext.java:243)
>       at 
> org.apache.lens.server.query.QueryExecutionServiceImpl$RewriteEstimateRunnable.run(QueryExecutionServiceImpl.java:1359)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>       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)
> Caused by: org.apache.hive.service.cli.HiveSQLException: Error while 
> compiling statement: FAILED: SemanticException Line 0:-1 Table not found 
> 'test_data2'
>       at 
> org.apache.hive.service.cli.thrift.ThriftCLIServiceClient.checkStatus(ThriftCLIServiceClient.java:52)
>       at 
> org.apache.hive.service.cli.thrift.ThriftCLIServiceClient.executeStatementInternal(ThriftCLIServiceClient.java:151)
>       at 
> org.apache.hive.service.cli.thrift.ThriftCLIServiceClient.executeStatement(ThriftCLIServiceClient.java:129)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.apache.hive.service.cli.thrift.RetryingThriftCLIServiceClient.invokeInternal(RetryingThriftCLIServiceClient.java:301)
>       at 
> org.apache.hive.service.cli.thrift.RetryingThriftCLIServiceClient.invoke(RetryingThriftCLIServiceClient.java:329)
>       at com.sun.proxy.$Proxy57.executeStatement(Unknown Source)
>       at 
> org.apache.hive.service.cli.thrift.RetryingThriftCLIServiceClient$CLIServiceClientWrapper.executeStatement(RetryingThriftCLIServiceClient.java:111)
>       at org.apache.lens.driver.hive.HiveDriver.execute(HiveDriver.java:493)
>       ... 9 more
> </stackTrace>
>     </error>
> </lensAPIResult>
> Proposed response 
> ----------------------------
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <lensAPIResult>
>     <id>d01a0633-f02b-4461-aa54-fc189b625001</id>
>     <error>
>         <code>4001</code>
>         <message>Semantic Error : Error while compiling statement: FAILED: 
> SemanticException Line 0:-1 Table not found 'test_data2'</message>
>         <stackTrace>org.apache.lens.server.api.error.LensException
>       at 
> org.apache.lens.driver.hive.HiveDriver.createLensException(HiveDriver.java:595)
>       at org.apache.lens.driver.hive.HiveDriver.execute(HiveDriver.java:589)
>       at org.apache.lens.driver.hive.HiveDriver.explain(HiveDriver.java:497)
>       at org.apache.lens.driver.hive.HiveDriver.estimate(HiveDriver.java:468)
>       at 
> org.apache.lens.server.api.query.AbstractQueryContext$DriverEstimateRunnable.run(AbstractQueryContext.java:243)
>       at 
> org.apache.lens.server.query.QueryExecutionServiceImpl$RewriteEstimateRunnable.run(QueryExecutionServiceImpl.java:1359)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>       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)
> Caused by: org.apache.hive.service.cli.HiveSQLException: Error while 
> compiling statement: FAILED: SemanticException Line 0:-1 Table not found 
> 'test_data2'
>       at 
> org.apache.hive.service.cli.thrift.ThriftCLIServiceClient.checkStatus(ThriftCLIServiceClient.java:52)
>       at 
> org.apache.hive.service.cli.thrift.ThriftCLIServiceClient.executeStatementInternal(ThriftCLIServiceClient.java:151)
>       at 
> org.apache.hive.service.cli.thrift.ThriftCLIServiceClient.executeStatement(ThriftCLIServiceClient.java:129)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.apache.hive.service.cli.thrift.RetryingThriftCLIServiceClient.invokeInternal(RetryingThriftCLIServiceClient.java:301)
>       at 
> org.apache.hive.service.cli.thrift.RetryingThriftCLIServiceClient.invoke(RetryingThriftCLIServiceClient.java:329)
>       at com.sun.proxy.$Proxy55.executeStatement(Unknown Source)
>       at 
> org.apache.hive.service.cli.thrift.RetryingThriftCLIServiceClient$CLIServiceClientWrapper.executeStatement(RetryingThriftCLIServiceClient.java:111)
>       at org.apache.lens.driver.hive.HiveDriver.execute(HiveDriver.java:566)
>       ... 9 more
> </stackTrace>
>     </error>
> </lensAPIResult>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to