0

I tried to run "dbms_output.put_line('This is HPL/Sql');" from Hive cli it has given below exception.

NoViableAltException(26@[])
    at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1140)
    at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:204)
    at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:404)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:329)
    at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1158)
    at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1253)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1084)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1072)
    at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:232)
    at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:183)
    at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:399)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:776)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:714)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

FAILED: ParseException line 1:0 cannot recognize input near 'dbms_output' '.' 'put_line'

I am using Hive 2.1.0. as per HPL/sql documentation HPL/SQL is included to Apache Hive since version 2.0.

Is there any additional configuration changes is required to enable hpl/sql support in hive.

Deepak Kumar
  • 433
  • 4
  • 12

2 Answers2

1

We can't run HPL/SQL query directly from Hive Cli. we should use either 1. hplsql -e 'query' or 2. hplsql -e sql/hql file.

For Example-

hplsql -e 'dbms_output.put_line(`this is hplsql`)'; 
or  
hplsql -e 'PRINT `this is hplsql`';
Deepak Kumar
  • 433
  • 4
  • 12
0

Write function in HPL/SQL, register it in hive and Use it.

Jarvis
  • 1
  • 3