Sercan Tekin created HIVE-30022:
-----------------------------------
Summary: Hive CLI fails with NullPointerException when
USE_BEELINE_FOR_HIVE_CLI=false
Key: HIVE-30022
URL: https://issues.apache.org/jira/browse/HIVE-30022
Project: Hive
Issue Type: Bug
Components: CLI
Affects Versions: 4.2.0
Reporter: Sercan Tekin
When {{USE_BEELINE_FOR_HIVE_CLI=false}} the Hive CLI fails with a
{{NullPointerException}} in interactive mode:
{code:java}
hive> show tables;
Exception in thread "main" java.lang.NullPointerException: Cannot invoke
"org.jline.reader.LineReader.getTerminal()" because "this.reader" is null
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:379)
at
org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:860)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:791)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:705)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.apache.hadoop.util.RunJar.run(RunJar.java:333)
at org.apache.hadoop.util.RunJar.main(RunJar.java:254)
{code}
{{executeDriver()}} creates a new {{CliDriver}} instance and uses it for
operations such as:
{code:java}
CliDriver cli = newCliDriver();
cli.setHiveVariables(oproc.getHiveVariables());
// use the specified database if specified
cli.processSelectDatabase(ss);
// Execute -i init files (always in silent mode)
cli.processInitFiles(ss);
{code}
However, the {{LineReader}} is initialized on the outer {{CliDriver}} instance:
{code:java}
setupLineReader();
{code}
As a result, {{cli.reader}} remains null when {{cli.processLine()}} is called.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)