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

KaiXu updated HIVE-19022:
-------------------------
    Description: 
we found that user can not get exported environment variables in Hive beeline.

how to reproduce:
1. start hiveserver2 service 
2. beeline embedded mode:
[root@bdw-master hive232]# export AAA=aaa
[root@bdw-master ~]# echo $HADOOP_HOME
/opt/hive_package/hadoop273
[root@bdw-master hive232]# bin/beeline -u 'jdbc:hive2://localhost:10000' -n 
root -p 123456
0: jdbc:hive2://localhost:10000> set env:AAA;
Error: Error while processing statement: null (state=,code=1)

but we found that we can get HADOOP_HOME JAVA_HOME etc. variables:

0: jdbc:hive2://localhost:10000> set env:HADOOP_HOME;
+--------------------------------------------------+
|                       set                        |
+--------------------------------------------------+
| env:HADOOP_HOME=/opt/hive_package/hadoop273  |
+--------------------------------------------------+
1 row selected (0.097 seconds)

0: jdbc:hive2://localhost:10000> set env:JAVA_HOME;
+---------------------------------------+
|                  set                  |
+---------------------------------------+
| env:JAVA_HOME=/usr/java/jdk1.8.0_131  |
+---------------------------------------+
1 row selected (0.09 seconds)

Below is hive.log:

2018-03-22T11:12:01,708  WARN [HiveServer2-Handler-Pool: Thread-94] 
thrift.ThriftCLIService: Error executing statement:
org.apache.hive.service.cli.HiveSQLException: Error while processing statement: 
null
        at 
org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:380)
 ~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.operation.HiveCommandOperation.runInternal(HiveCommandOperation.java:118)
 ~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.operation.Operation.run(Operation.java:320) 
~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:530)
 ~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:517)
 ~[hive-service-2.3.2.jar:2.3.2]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_131]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_131]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_131]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
 ~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
 ~[hive-service-2.3.2.jar:2.3.2]

  was:
we found that user can not get exported environment variables in Hive beeline.

how to reproduce:
1. start hiveserver2 service 
2. beeline embedded mode:
[root@bdw-master hive232]# export AAA=aaa
[root@bdw-master ~]# echo $HADOOP_HOME
/opt/hive_package/hadoop273
[root@bdw-master hive232]# bin/beeline -u 'jdbc:hive2://localhost:10000' -n 
root -p 123456
0: jdbc:hive2://localhost:10000> set env:AAA;
Error: Error while processing statement: null (state=,code=1)

but we found that we can get HADOOP_HOME etc. variables:

0: jdbc:hive2://localhost:10000> set env:HADOOP_HOME;
+--------------------------------------------------+
|                       set                        |
+--------------------------------------------------+
| env:HADOOP_HOME=/opt/hive_package/hadoop273  |
+--------------------------------------------------+
1 row selected (0.097 seconds)



Below is hive.log:

2018-03-22T11:12:01,708  WARN [HiveServer2-Handler-Pool: Thread-94] 
thrift.ThriftCLIService: Error executing statement:
org.apache.hive.service.cli.HiveSQLException: Error while processing statement: 
null
        at 
org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:380)
 ~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.operation.HiveCommandOperation.runInternal(HiveCommandOperation.java:118)
 ~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.operation.Operation.run(Operation.java:320) 
~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:530)
 ~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:517)
 ~[hive-service-2.3.2.jar:2.3.2]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_131]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_131]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_131]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
 ~[hive-service-2.3.2.jar:2.3.2]
        at 
org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
 ~[hive-service-2.3.2.jar:2.3.2]


> Hive Beeline can not read user define environment variables
> -----------------------------------------------------------
>
>                 Key: HIVE-19022
>                 URL: https://issues.apache.org/jira/browse/HIVE-19022
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline, HiveServer2, JDBC
>    Affects Versions: 2.3.2
>            Reporter: KaiXu
>            Priority: Major
>
> we found that user can not get exported environment variables in Hive beeline.
> how to reproduce:
> 1. start hiveserver2 service 
> 2. beeline embedded mode:
> [root@bdw-master hive232]# export AAA=aaa
> [root@bdw-master ~]# echo $HADOOP_HOME
> /opt/hive_package/hadoop273
> [root@bdw-master hive232]# bin/beeline -u 'jdbc:hive2://localhost:10000' -n 
> root -p 123456
> 0: jdbc:hive2://localhost:10000> set env:AAA;
> Error: Error while processing statement: null (state=,code=1)
> but we found that we can get HADOOP_HOME JAVA_HOME etc. variables:
> 0: jdbc:hive2://localhost:10000> set env:HADOOP_HOME;
> +--------------------------------------------------+
> |                       set                        |
> +--------------------------------------------------+
> | env:HADOOP_HOME=/opt/hive_package/hadoop273  |
> +--------------------------------------------------+
> 1 row selected (0.097 seconds)
> 0: jdbc:hive2://localhost:10000> set env:JAVA_HOME;
> +---------------------------------------+
> |                  set                  |
> +---------------------------------------+
> | env:JAVA_HOME=/usr/java/jdk1.8.0_131  |
> +---------------------------------------+
> 1 row selected (0.09 seconds)
> Below is hive.log:
> 2018-03-22T11:12:01,708  WARN [HiveServer2-Handler-Pool: Thread-94] 
> thrift.ThriftCLIService: Error executing statement:
> org.apache.hive.service.cli.HiveSQLException: Error while processing 
> statement: null
>         at 
> org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:380)
>  ~[hive-service-2.3.2.jar:2.3.2]
>         at 
> org.apache.hive.service.cli.operation.HiveCommandOperation.runInternal(HiveCommandOperation.java:118)
>  ~[hive-service-2.3.2.jar:2.3.2]
>         at 
> org.apache.hive.service.cli.operation.Operation.run(Operation.java:320) 
> ~[hive-service-2.3.2.jar:2.3.2]
>         at 
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:530)
>  ~[hive-service-2.3.2.jar:2.3.2]
>         at 
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:517)
>  ~[hive-service-2.3.2.jar:2.3.2]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_131]
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_131]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_131]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
>         at 
> org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
>  ~[hive-service-2.3.2.jar:2.3.2]
>         at 
> org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
>  ~[hive-service-2.3.2.jar:2.3.2]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to