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

Wang Hao updated HIVE-9171:
---------------------------
    Description: 
when I use init file in beeline ,it has some exception:
./beeline -i init.sql -f /tmp/test.sql  --verbose

0: jdbc:hive2://hadoop015.dx.momo.com:10000> SELECT
console reader is null
end with fenhao false
is allow multi line true
Error: Error while compiling statement: FAILED: ParseException line 1:6 cannot 
recognize input near '<EOF>' '<EOF>' '<EOF>' in select clause 
(state=42000,code=40000)
org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: 
FAILED: ParseException line 1:6 cannot recognize input near '<EOF>' '<EOF>' 
'<EOF>' in select clause
        at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:231)
        at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:217)
        at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:254)
        at org.apache.hive.beeline.Commands.execute(Commands.java:784)
        at org.apache.hive.beeline.Commands.sql(Commands.java:665)
        at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:933)
        at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:796)
        at org.apache.hive.beeline.BeeLine.executeFile(BeeLine.java:781)
        at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:726)
        at 
org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:465)
        at org.apache.hive.beeline.BeeLine.main(BeeLine.java:451)
        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.hadoop.util.RunJar.main(RunJar.java:212)
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling 
statement: FAILED: ParseException line 1:6 cannot recognize input near '<EOF>' 
'<EOF>' '<EOF>' in select clause
        at 
org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:314)
        at 
org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:102)
        at 
org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:171)
        at 
org.apache.hive.service.cli.operation.Operation.run(Operation.java:256)
        at 
org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:376)
        at 
org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:363)
        at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:79)
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:37)
        at 
org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:64)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1614)
        at 
org.apache.hadoop.hive.shims.HadoopShimsSecure.doAs(HadoopShimsSecure.java:536)
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:60)
        at com.sun.proxy.$Proxy14.executeStatementAsync(Unknown Source)
        at 
org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:247)
        at 
org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:401)
        at 
org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313)
        at 
org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)
        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
        at 
org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
        at 
org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:206)
        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: java.lang.RuntimeException: 
org.apache.hadoop.hive.ql.parse.ParseException:line 1:6 cannot recognize input 
near '<EOF>' '<EOF>' '<EOF>' in select clause
        at 
org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
        at 
org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:389)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:303)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1067)
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1061)
        at 
org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:100)
        ... 27 more



In BeeLine.java,I found the consoleReader will be setter "null" in function 
runInit. And I modify this function ,
int runInit() {
        String initFile = getOpts().getInitFile();
        ConsoleReader csr = consoleReader;
        if (initFile != null) {
            info("Running init script " + initFile);
            try {
                return executeFile(initFile);
            } finally {
                exit = false;
                consoleReader=csr;
            }
        }
        return ERRNO_OK;
    }

Try again,my command  is work.

  was:
when I use init file in beeline ,it has some exception:
./beeline -i init.sql -f /tmp/test.sql  --verbose

Error: Error while compiling statement: FAILED: ParseException line 1:5 cannot 
recognize input near 'show' 'tb' '<EOF>' in ddl statement 
(state=42000,code=40000)
org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: 
FAILED: ParseException line 1:5 cannot recognize input near 'show' 'tb' '<EOF>' 
in ddl statement
        at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:231)
        at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:217)
        at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:254)
        at org.apache.hive.beeline.Commands.execute(Commands.java:781)
        at org.apache.hive.beeline.Commands.sql(Commands.java:665)
        at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:915)
        at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:777)
        at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:738)
        at 
org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:469)
        at org.apache.hive.beeline.BeeLine.main(BeeLine.java:452)
        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.hadoop.util.RunJar.main(RunJar.java:212)

In BeeLine.java,I found the consoleReader will be setter "null" in function 
runInit. And I modify this function ,
int runInit() {
        String initFile = getOpts().getInitFile();
        ConsoleReader csr = consoleReader;
        if (initFile != null) {
            info("Running init script " + initFile);
            try {
                return executeFile(initFile);
            } finally {
                exit = false;
                consoleReader=csr;
            }
        }
        return ERRNO_OK;
    }

Try again,my command  is work.


> After use init file in beeline,the consoleReader is setted null.
> ----------------------------------------------------------------
>
>                 Key: HIVE-9171
>                 URL: https://issues.apache.org/jira/browse/HIVE-9171
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline
>    Affects Versions: 0.14.0
>            Reporter: Wang Hao
>
> when I use init file in beeline ,it has some exception:
> ./beeline -i init.sql -f /tmp/test.sql  --verbose
> 0: jdbc:hive2://hadoop015.dx.momo.com:10000> SELECT
> console reader is null
> end with fenhao false
> is allow multi line true
> Error: Error while compiling statement: FAILED: ParseException line 1:6 
> cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in select clause 
> (state=42000,code=40000)
> org.apache.hive.service.cli.HiveSQLException: Error while compiling 
> statement: FAILED: ParseException line 1:6 cannot recognize input near 
> '<EOF>' '<EOF>' '<EOF>' in select clause
>       at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:231)
>       at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:217)
>       at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:254)
>       at org.apache.hive.beeline.Commands.execute(Commands.java:784)
>       at org.apache.hive.beeline.Commands.sql(Commands.java:665)
>       at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:933)
>       at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:796)
>       at org.apache.hive.beeline.BeeLine.executeFile(BeeLine.java:781)
>       at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:726)
>       at 
> org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:465)
>       at org.apache.hive.beeline.BeeLine.main(BeeLine.java:451)
>       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.hadoop.util.RunJar.main(RunJar.java:212)
> Caused by: org.apache.hive.service.cli.HiveSQLException: Error while 
> compiling statement: FAILED: ParseException line 1:6 cannot recognize input 
> near '<EOF>' '<EOF>' '<EOF>' in select clause
>       at 
> org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:314)
>       at 
> org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:102)
>       at 
> org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:171)
>       at 
> org.apache.hive.service.cli.operation.Operation.run(Operation.java:256)
>       at 
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:376)
>       at 
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:363)
>       at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:79)
>       at 
> org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:37)
>       at 
> org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:64)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at javax.security.auth.Subject.doAs(Subject.java:415)
>       at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1614)
>       at 
> org.apache.hadoop.hive.shims.HadoopShimsSecure.doAs(HadoopShimsSecure.java:536)
>       at 
> org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:60)
>       at com.sun.proxy.$Proxy14.executeStatementAsync(Unknown Source)
>       at 
> org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:247)
>       at 
> org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:401)
>       at 
> org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313)
>       at 
> org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)
>       at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
>       at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
>       at 
> org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
>       at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:206)
>       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: java.lang.RuntimeException: 
> org.apache.hadoop.hive.ql.parse.ParseException:line 1:6 cannot recognize 
> input near '<EOF>' '<EOF>' '<EOF>' in select clause
>       at 
> org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
>       at 
> org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
>       at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:389)
>       at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:303)
>       at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1067)
>       at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1061)
>       at 
> org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:100)
>       ... 27 more
> In BeeLine.java,I found the consoleReader will be setter "null" in function 
> runInit. And I modify this function ,
> int runInit() {
>         String initFile = getOpts().getInitFile();
>         ConsoleReader csr = consoleReader;
>         if (initFile != null) {
>             info("Running init script " + initFile);
>             try {
>                 return executeFile(initFile);
>             } finally {
>                 exit = false;
>                 consoleReader=csr;
>             }
>         }
>         return ERRNO_OK;
>     }
> Try again,my command  is work.



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

Reply via email to