[
https://issues.apache.org/jira/browse/HIVE-29555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dayakar M resolved HIVE-29555.
------------------------------
Fix Version/s: 4.3.0
Resolution: Fixed
Thanks [~thomasrebele] and [~kkasa] for the review.
> [HPLSQL]Errorcode handling is not proper in HPLSQL.
> ---------------------------------------------------
>
> Key: HIVE-29555
> URL: https://issues.apache.org/jira/browse/HIVE-29555
> Project: Hive
> Issue Type: Bug
> Components: hpl/sql
> Reporter: Dayakar M
> Assignee: Dayakar M
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.3.0
>
>
> When _seterror_ is configured for _hplsql.onerror_ then for the failed
> statement the errorcode is coming as -1 which is proper but after that
> executing proper statement giving results but still the errorcode is coming
> as -1. This is happening only the statements are executed using EXECUTE or
> EXECUTE IMMEDIATE.
> Please below example:
> {code:java}
> 0: jdbc:hive2://localhost> SET hplsql.onerror='seterror';
> . . . . . . . . . . . . .> EXECUTE 'select * from unknown';
> . . . . . . . . . . . . .> PRINT 'Unknon Table Errorcode: ' || errorcode;
> . . . . . . . . . . . . .> EXECUTE 'select * from known';
> . . . . . . . . . . . . .> PRINT 'Known Table Errorcode: ' || errorcode;
> . . . . . . . . . . . . .> /
> INFO : Compiling
> command(queryId=hive_20260409144854_ae55f178-ab87-4c6c-ae49-a618e7c80be8):
> select * from unknown
> ERROR : FAILED: SemanticException [Error 10001]: Line 1:14 Table not found
> 'unknown'
> org.apache.hadoop.hive.ql.parse.SemanticException: Line 1:14 Table not found
> 'unknown'
> at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getMetaData(SemanticAnalyzer.java:2479)
> at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getMetaData(SemanticAnalyzer.java:2393)
> at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genResolvedParseTree(SemanticAnalyzer.java:13404)
> at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:13514)
> at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:487)
> at
> org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:324)
> at org.apache.hadoop.hive.ql.Compiler.analyze(Compiler.java:227)
> at org.apache.hadoop.hive.ql.Compiler.compile(Compiler.java:108)
> at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:203)
> at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:659)
> at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:604)
> at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:598)
> at
> org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:126)
> at
> org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:210)
> at
> org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:274)
> at org.apache.hive.service.cli.operation.Operation.run(Operation.java:288)
> at
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:574)
> at
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatement(HiveSessionImpl.java:543)
> at
> org.apache.hive.service.cli.operation.hplsql.HplSqlQueryExecutor.executeQuery(HplSqlQueryExecutor.java:68)
> at org.apache.hive.hplsql.Stmt.exec(Stmt.java:1059)
> at org.apache.hive.hplsql.Exec.visitExec_stmt(Exec.java:2064)
> at org.apache.hive.hplsql.Exec.visitExec_stmt(Exec.java:96)
> at
> org.apache.hive.hplsql.HplsqlParser$Exec_stmtContext.accept(HplsqlParser.java:10369)
> at
> org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
> at org.apache.hive.hplsql.Exec.visitStmt(Exec.java:1103)
> at org.apache.hive.hplsql.Exec.visitStmt(Exec.java:96)
> at
> org.apache.hive.hplsql.HplsqlParser$StmtContext.accept(HplsqlParser.java:1054)
> at
> org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
> at
> org.apache.hive.hplsql.HplsqlBaseVisitor.visitBlock(HplsqlBaseVisitor.java:27)
> at
> org.apache.hive.hplsql.HplsqlParser$BlockContext.accept(HplsqlParser.java:473)
> at
> org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
> at org.apache.hive.hplsql.Exec.visitProgram(Exec.java:999)
> at org.apache.hive.hplsql.Exec.visitProgram(Exec.java:96)
> at
> org.apache.hive.hplsql.HplsqlParser$ProgramContext.accept(HplsqlParser.java:414)
> at
> org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
> at org.apache.hive.hplsql.Exec.evaluate(Exec.java:817)
> at org.apache.hive.hplsql.Exec.parseAndEval(Exec.java:796)
> at
> org.apache.hive.service.cli.operation.hplsql.HplSqlOperation.interpret(HplSqlOperation.java:98)
> at
> org.apache.hive.service.cli.operation.hplsql.HplSqlOperation.access$400(HplSqlOperation.java:54)
> at
> org.apache.hive.service.cli.operation.hplsql.HplSqlOperation$BackgroundWork.lambda$run$0(HplSqlOperation.java:207)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:422)
> at
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1910)
> at
> org.apache.hive.service.cli.operation.hplsql.HplSqlOperation$BackgroundWork.run(HplSqlOperation.java:219)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)INFO : Completed compiling
> command(queryId=hive_20260409144854_ae55f178-ab87-4c6c-ae49-a618e7c80be8);
> Time taken: 2.918 seconds
> INFO : Unknon Table Errorcode: -1
> INFO : Compiling
> command(queryId=hive_20260409144854_ae55f178-ab87-4c6c-ae49-a618e7c80be8):
> select * from known
> INFO : Semantic Analysis Completed (retrial = false)
> INFO : Created Hive schema: Schema(fieldSchemas:[FieldSchema(name:known.id,
> type:int, comment:null), FieldSchema(name:known.name, type:string,
> comment:null)], properties:null)
> INFO : Completed compiling
> command(queryId=hive_20260409144854_ae55f178-ab87-4c6c-ae49-a618e7c80be8);
> Time taken: 2.978 seconds
> INFO : Executing
> command(queryId=hive_20260409144854_ae55f178-ab87-4c6c-ae49-a618e7c80be8):
> select * from known
> INFO : Completed executing
> command(queryId=hive_20260409144854_ae55f178-ab87-4c6c-ae49-a618e7c80be8);
> Time taken: 0.092 seconds
> INFO : OK
> INFO : 100
> INFO : ABC
> INFO :
> INFO : 200
> INFO : XYZ
> INFO :
> INFO : Known Table Errorcode: -1
> ERROR : Unhandled exception in HPL/SQL
> No rows affected (7.612 seconds){code}
> Here for for _Unknown_ table selection the errorcode is coming as -1 as the
> Unlnwon table is not there
> {noformat}
> INFO : Unknon Table Errorcode: -1
> {noformat}
> but for the _Known_ table selection also the error code is coming as -1, here
> the table exists and the contents also getting displayed
> {noformat}
> INFO : OK
> INFO : 100
> INFO : ABC
> INFO :
> INFO : 200
> INFO : XYZ
> INFO :
> INFO : Known Table Errorcode: -1
> {noformat}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)