Thomas Rebele created HIVE-29662:
------------------------------------

             Summary: Cannot execute a script with Beeline's -f <script>
                 Key: HIVE-29662
                 URL: https://issues.apache.org/jira/browse/HIVE-29662
             Project: Hive
          Issue Type: Bug
    Affects Versions: 4.3.0
            Reporter: Thomas Rebele


I think the `-f script.sql` arg is broken as well. Trying Beeline with the most 
recent commit (cce3edbe3038ed134865f1cbe0e1d8ed88cebbd8):

Executing a script that sleeps 20s is executed in 4 seconds:
{code:java}
$ date; ./beeline -u jdbc:hive2://localhost:10000 -n trebele -f 
/home/trebele/dev/hive/h5/test.sql; date
Sat Jun 13 12:27:07 AM CEST 2026
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in 
[jar:file:/home/trebele/dev/hive/h5/packaging/target/apache-hive-4.3.0-SNAPSHOT-bin/apache-hive-4.3.0-SNAPSHOT-bin/lib/log4j-slf4j-impl-2.25.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in 
[jar:file:/home/trebele/software/hadoop/hadoop-3.4.2.7.3.2.10000-98/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to jdbc:hive2://localhost:10000
Connected to: Apache Hive (version 4.3.0-SNAPSHOT)
Driver: Hive JDBC (version 4.3.0-SNAPSHOT)
Transaction isolation: TRANSACTION_REPEATABLE_READ

select 1;

select reflect("java.lang.Thread", "sleep", bigint(20000));
>....Closing: 0: jdbc:hive2://localhost:10000
Sat Jun 13 12:27:11 AM CEST 2026
{code}
Executing Beeline interactively (and copy-pasting the script as fast as 
possible) works as expected:
{code:java}
$ date; ./beeline -u jdbc:hive2://localhost:10000 -n trebele; date
Sat Jun 13 12:31:07 AM CEST 2026
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in 
[jar:file:/home/trebele/dev/hive/h5/packaging/target/apache-hive-4.3.0-SNAPSHOT-bin/apache-hive-4.3.0-SNAPSHOT-bin/lib/log4j-slf4j-impl-2.25.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in 
[jar:file:/home/trebele/software/hadoop/hadoop-3.4.2.7.3.2.10000-98/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to jdbc:hive2://localhost:10000
Connected to: Apache Hive (version 4.3.0-SNAPSHOT)
Driver: Hive JDBC (version 4.3.0-SNAPSHOT)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 4.3.0-SNAPSHOT by Apache Hive
0: jdbc:hive2://localhost:10000> select 1; select reflect("java.lang.Thread", 
"sleep", bigint(20000));
+------+
| _c0  |
+------+
| 1    |
+------+
1 row selected (0.272 seconds)
+-------+
|  _c0  |
+-------+
| null  |
+-------+
1 row selected (20.137 seconds)
0: jdbc:hive2://localhost:10000> 
Closing: 0: jdbc:hive2://localhost:10000
Sat Jun 13 12:31:31 AM CEST 2026 {code}
In the debugger I saw that the variable "line" in 
org.apache.hive.beeline.BeeLine#execute is null, so I think it is a problem 
with jline.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to