You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ec...@apache.org on 2012/07/17 02:58:28 UTC

svn commit: r1362329 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/processors/ test/queries/clientpositive/ test/results/clientpositive/

Author: ecapriolo
Date: Tue Jul 17 00:58:28 2012
New Revision: 1362329

URL: http://svn.apache.org/viewvc?rev=1362329&view=rev
Log:
HIVE-3202 Add reset command for resetting configuration. Navis Ryu (via egc)

Added:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ResetProcessor.java
    hive/trunk/ql/src/test/queries/clientpositive/reset_conf.q
    hive/trunk/ql/src/test/results/clientpositive/reset_conf.q.out
Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java?rev=1362329&r1=1362328&r2=1362329&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java Tue Jul 17 00:58:28 2012
@@ -46,6 +46,8 @@ public final class CommandProcessorFacto
 
     if ("set".equals(cmdl)) {
       return new SetProcessor();
+    } else if ("reset".equals(cmdl)) {
+      return new ResetProcessor();
     } else if ("dfs".equals(cmdl)) {
       SessionState ss = SessionState.get();
       return new DfsProcessor(ss.getConf());

Added: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ResetProcessor.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ResetProcessor.java?rev=1362329&view=auto
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ResetProcessor.java (added)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ResetProcessor.java Tue Jul 17 00:58:28 2012
@@ -0,0 +1,45 @@
+/**
+ * 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.
+ */
+
+package org.apache.hadoop.hive.ql.processors;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.ql.CommandNeedRetryException;
+import org.apache.hadoop.hive.ql.session.SessionState;
+
+public class ResetProcessor implements CommandProcessor {
+
+  public void init() {
+  }
+
+  public CommandProcessorResponse run(String command) throws CommandNeedRetryException {
+    SessionState ss = SessionState.get();
+    if (ss.getOverriddenConfigurations().isEmpty()) {
+      return new CommandProcessorResponse(0);
+    }
+    HiveConf conf = new HiveConf();
+    for (String key : ss.getOverriddenConfigurations().keySet()) {
+      String value = conf.get(key);
+      if (value != null) {
+        ss.getConf().set(key, value);
+      }
+    }
+    ss.getOverriddenConfigurations().clear();
+    return new CommandProcessorResponse(0);
+  }
+}

Added: hive/trunk/ql/src/test/queries/clientpositive/reset_conf.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/reset_conf.q?rev=1362329&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/reset_conf.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/reset_conf.q Tue Jul 17 00:58:28 2012
@@ -0,0 +1,11 @@
+set hive.skewjoin.key;
+set hive.skewjoin.mapjoin.min.split;
+set hive.skewjoin.key=300000;
+set hive.skewjoin.mapjoin.min.split=256000000;
+set hive.skewjoin.key;
+set hive.skewjoin.mapjoin.min.split;
+
+reset;
+
+set hive.skewjoin.key;
+set hive.skewjoin.mapjoin.min.split;

Added: hive/trunk/ql/src/test/results/clientpositive/reset_conf.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/reset_conf.q.out?rev=1362329&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/reset_conf.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/reset_conf.q.out Tue Jul 17 00:58:28 2012
@@ -0,0 +1,6 @@
+hive.skewjoin.key=100000
+hive.skewjoin.mapjoin.min.split=33554432
+hive.skewjoin.key=300000
+hive.skewjoin.mapjoin.min.split=256000000
+hive.skewjoin.key=100000
+hive.skewjoin.mapjoin.min.split=33554432