[ 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 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. Summary: After use init file in beeline,the consoleReader is setted null. (was: When use init file in beeline,the consol) > 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 > 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. -- This message was sent by Atlassian JIRA (v6.3.4#6332)