You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pv...@apache.org on 2020/04/29 18:53:08 UTC

[hive] branch master updated: HIVE-23306: RESET command does not work if there is a config set by System.getProperty (Peter Vary reviewed by Marta Kuczora)

This is an automated email from the ASF dual-hosted git repository.

pvary pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new dc5ea5a  HIVE-23306: RESET command does not work if there is a config set by System.getProperty (Peter Vary reviewed by Marta Kuczora)
dc5ea5a is described below

commit dc5ea5a43b1fb46c22da3c827575745ce13ac2ad
Author: Peter Vary <pv...@cloudera.com>
AuthorDate: Wed Apr 29 20:52:22 2020 +0200

    HIVE-23306: RESET command does not work if there is a config set by System.getProperty (Peter Vary reviewed by Marta Kuczora)
---
 data/conf/llap/hive-site.xml                        |  6 ++++++
 data/conf/llap/hivemetastore-site.xml               | 21 +++++++++++++++++++++
 .../java/org/apache/hadoop/hive/ql/QTestUtil.java   |  3 +++
 .../apache/hadoop/hive/ql/session/SessionState.java |  1 -
 ql/src/test/queries/clientpositive/reset_conf.q     |  8 ++++++++
 .../results/clientpositive/llap/reset_conf.q.out    |  3 +++
 6 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/data/conf/llap/hive-site.xml b/data/conf/llap/hive-site.xml
index d37c1b5..6b28fef 100644
--- a/data/conf/llap/hive-site.xml
+++ b/data/conf/llap/hive-site.xml
@@ -378,4 +378,10 @@
   <value>hive_admin_user</value>
 </property>
 
+<property>
+  <name>hive.conf.restricted.list</name>
+  <value>hive.query.max.length</value>
+  <description>Using property defined in HiveConf.ConfVars to test System property overriding</description>
+</property>
+
 </configuration>
diff --git a/data/conf/llap/hivemetastore-site.xml b/data/conf/llap/hivemetastore-site.xml
new file mode 100644
index 0000000..f033caa
--- /dev/null
+++ b/data/conf/llap/hivemetastore-site.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<configuration>
+</configuration>
diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
index 034d7f8..8d3856b 100644
--- a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
+++ b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
@@ -204,6 +204,9 @@ public class QTestUtil {
       System.out.println("Setting hive-site: " + HiveConf.getHiveSiteLocation());
     }
 
+    // For testing configurations set by System.setProperties
+    System.setProperty("hive.query.max.length", "100Mb");
+
     conf = new HiveConf(IDriver.class);
     setMetaStoreProperties();
 
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
index 6c6138e..55bd27e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
@@ -416,7 +416,6 @@ public class SessionState implements ISessionAuthState{
     resourceMaps = new ResourceMaps();
     // Must be deterministic order map for consistent q-test output across Java versions
     overriddenConfigurations = new LinkedHashMap<String, String>();
-    overriddenConfigurations.putAll(HiveConf.getConfSystemProperties());
     // if there isn't already a session name, go ahead and create it.
     if (StringUtils.isEmpty(conf.getVar(HiveConf.ConfVars.HIVESESSIONID))) {
       conf.setVar(HiveConf.ConfVars.HIVESESSIONID, makeSessionId());
diff --git a/ql/src/test/queries/clientpositive/reset_conf.q b/ql/src/test/queries/clientpositive/reset_conf.q
index 8420d02..c841ff0 100644
--- a/ql/src/test/queries/clientpositive/reset_conf.q
+++ b/ql/src/test/queries/clientpositive/reset_conf.q
@@ -4,11 +4,14 @@ set hive.skewjoin.key=300000;
 set hive.skewjoin.mapjoin.min.split=256000000;
 set hive.skewjoin.key;
 set hive.skewjoin.mapjoin.min.split;
+set hive.query.max.length;
 
 reset;
 
 set hive.skewjoin.key;
 set hive.skewjoin.mapjoin.min.split;
+-- Should not be set back to 10Mb, should keep 100Mb
+set hive.query.max.length;
 
 set hive.skewjoin.key=300000;
 set hive.skewjoin.mapjoin.min.split=256000000;
@@ -27,3 +30,8 @@ select 'After resetting both to default';
 set hive.skewjoin.key;
 set hive.skewjoin.mapjoin.min.split;
 
+-- Double reset to check if the System.property setting is not reverted
+reset;
+
+-- Should not be set back to 10Mb, should keep 100Mb
+set hive.query.max.length;
diff --git a/ql/src/test/results/clientpositive/llap/reset_conf.q.out b/ql/src/test/results/clientpositive/llap/reset_conf.q.out
index 12f2555..7d11095 100644
--- a/ql/src/test/results/clientpositive/llap/reset_conf.q.out
+++ b/ql/src/test/results/clientpositive/llap/reset_conf.q.out
@@ -2,8 +2,10 @@ hive.skewjoin.key=100000
 hive.skewjoin.mapjoin.min.split=33554432
 hive.skewjoin.key=300000
 hive.skewjoin.mapjoin.min.split=256000000
+hive.query.max.length=100Mb
 hive.skewjoin.key=100000
 hive.skewjoin.mapjoin.min.split=33554432
+hive.query.max.length=100Mb
 PREHOOK: query: select 'After setting hive.skewjoin.key and hive.skewjoin.mapjoin.min.split'
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
@@ -36,3 +38,4 @@ POSTHOOK: Input: _dummy_database@_dummy_table
 After resetting both to default
 hive.skewjoin.key=100000
 hive.skewjoin.mapjoin.min.split=33554432
+hive.query.max.length=100Mb