Thanks! It should not throw NPE anyway, I will create a ticket for
Exception in thread "main" java.lang.NullPointerException
at org.apache.hive.hplsql.Select.getIntoCount(Select.java:405)
Thanks,
Dmitry
On Sun, Oct 1, 2017 at 1:43 AM, Srinivas Alavala <[email protected]
> wrote:
>
> I forgot to add the END LOOP statement. It is working fine.
>
> Thanks,
> Srini Alavala
>
> -----Srinivas Alavala/RCGIT wrote: -----
> To: [email protected]
> From: Srinivas Alavala/RCGIT
> Date: 09/30/2017 05:37PM
> Cc: [email protected]
> Subject: Hplsql Cursor Loop Java Error
>
> Hi Guys,
>
> I am very excited about hplsql. I have started writing code in Cloudera
> CDH 5.12.X environment with Kerberos security. I am getting jave error
> while I am trying to execute Cursor loop statement as shown below. How do I
> troubleshoot this error? Trace didn't show much info.
>
> I want to find out if this is production ready. Please guide us.
>
>
> CREATE PROCEDURE getPromoteList(IN position STRING, OUT status STRING)
> BEGIN
>
> FOR cur IN
> (SELECT customer_cid, customer_first_name FROM Table_Name where
> prowess_period_id=201601 and customer_pay_title = 'Value')
> LOOP
> DBMS_OUTPUT.PUT_LINE(cur.customer_cid);
> END;
>
> DECLARE status STRING;
> CALL getPromoteList(201601,status);
> PRINT status;
>
>
> Ln:1 CREATE FUNCTION hello
> Ln:1 CREATE PROCEDURE getPromoteList
> Ln:10 DECLARE status STRING
> Ln:11 EXEC PROCEDURE getPromoteList
> Ln:11 SET PARAM position = 201601
> Ln:11 SET PARAM status = null
> Ln:5 SELECT
> Ln:5 ************************************************************
> ****************
> [main] INFO org.apache.hive.jdbc.Utils - Supplied authorities:
> *****************
> [main] INFO org.apache.hive.jdbc.Utils - Resolved authority:
> ************************
> [main] WARN org.apache.hadoop.util.NativeCodeLoader - Unable to load
> native-hadoop library for your platform... using builtin-java classes where
> applicable
> Open connection: j*****************************
> ************************************
> Starting query
> Query executed successfully (38.97 sec)
> Ln:5 SELECT completed successfully
> Exception in thread "main" java.lang.NullPointerException
> at org.apache.hive.hplsql.Select.getIntoCount(Select.java:405)
> at org.apache.hive.hplsql.Select.select(Select.java:88)
> at org.apache.hive.hplsql.Exec.visitSelect_stmt(Exec.java:1021)
> at org.apache.hive.hplsql.Exec.visitSelect_stmt(Exec.java:52)
> at org.apache.hive.hplsql.HplsqlParser$Select_stmtContext.accept(
> HplsqlParser.java:15050)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.
> visitChildren(AbstractParseTreeVisitor.java:70)
> at org.apache.hive.hplsql.Exec.visitStmt(Exec.java:1013)
> at org.apache.hive.hplsql.Exec.visitStmt(Exec.java:52)
> at org.apache.hive.hplsql.HplsqlParser$StmtContext.
> accept(HplsqlParser.java:1023)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.
> visitChildren(AbstractParseTreeVisitor.java:70)
> at org.apache.hive.hplsql.HplsqlBaseVisitor.visitBlock(
> HplsqlBaseVisitor.java:28)
> at org.apache.hive.hplsql.HplsqlParser$BlockContext.
> accept(HplsqlParser.java:454)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.
> visitChildren(AbstractParseTreeVisitor.java:70)
> at org.apache.hive.hplsql.Exec.visitBegin_end_block(Exec.java:930)
> at org.apache.hive.hplsql.Exec.visitBegin_end_block(Exec.java:52)
> at org.apache.hive.hplsql.HplsqlParser$Begin_end_
> blockContext.accept(HplsqlParser.java:549)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.
> visitChildren(AbstractParseTreeVisitor.java:70)
> at org.apache.hive.hplsql.HplsqlBaseVisitor.visitProc_
> block(HplsqlBaseVisitor.java:56)
> at org.apache.hive.hplsql.HplsqlParser$Proc_blockContext.accept(
> HplsqlParser.java:756)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(
> AbstractParseTreeVisitor.java:42)
> at org.apache.hive.hplsql.functions.Function.visit(
> Function.java:754)
> at org.apache.hive.hplsql.functions.Function.execProc(
> Function.java:244)
> at org.apache.hive.hplsql.Exec.visitCall_stmt(Exec.java:1797)
> at org.apache.hive.hplsql.Exec.visitCall_stmt(Exec.java:52)
> at org.apache.hive.hplsql.HplsqlParser$Call_stmtContext.
> accept(HplsqlParser.java:3191)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.
> visitChildren(AbstractParseTreeVisitor.java:70)
> at org.apache.hive.hplsql.Exec.visitStmt(Exec.java:1013)
> at org.apache.hive.hplsql.Exec.visitStmt(Exec.java:52)
> at org.apache.hive.hplsql.HplsqlParser$StmtContext.
> accept(HplsqlParser.java:1023)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.
> visitChildren(AbstractParseTreeVisitor.java:70)
> at org.apache.hive.hplsql.HplsqlBaseVisitor.visitBlock(
> HplsqlBaseVisitor.java:28)
> at org.apache.hive.hplsql.HplsqlParser$BlockContext.
> accept(HplsqlParser.java:454)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.
> visitChildren(AbstractParseTreeVisitor.java:70)
> at org.apache.hive.hplsql.Exec.visitProgram(Exec.java:920)
> at org.apache.hive.hplsql.Exec.visitProgram(Exec.java:52)
> at org.apache.hive.hplsql.HplsqlParser$ProgramContext.
> accept(HplsqlParser.java:395)
> at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(
> AbstractParseTreeVisitor.java:42)
> at org.apache.hive.hplsql.Exec.run(Exec.java:775)
> at org.apache.hive.hplsql.Exec.run(Exec.java:751)
> at org.apache.hive.hplsql.Hplsql.main(Hplsql.java:23)
>
>