hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1617189 - in /hive/trunk: cli/src/java/org/apache/hadoop/hive/cli/ common/src/java/org/apache/hadoop/hive/conf/ ql/src/java/org/apache/hadoop/hive/ql/processors/
Date Mon, 11 Aug 2014 01:16:30 GMT
Author: navis
Date: Mon Aug 11 01:16:30 2014
New Revision: 1617189

URL: http://svn.apache.org/r1617189
Log:
HIVE-7592 : List Jars or Files are not supported by Beeline (Navis reviewed by Szehon Ho)

Added:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ListResourceProcessor.java
Modified:
    hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
    hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessor.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/HiveCommand.java

Modified: hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
URL: http://svn.apache.org/viewvc/hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java?rev=1617189&r1=1617188&r2=1617189&view=diff
==============================================================================
--- hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java (original)
+++ hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java Mon Aug 11 01:16:30
2014
@@ -32,7 +32,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import jline.ArgumentCompletor;
 import jline.ArgumentCompletor.AbstractArgumentDelimiter;
@@ -150,24 +149,6 @@ public class CliDriver {
             stringifyException(e));
         ret = 1;
       }
-    } else if (tokens[0].toLowerCase().equals("list")) {
-
-      SessionState.ResourceType t;
-      if (tokens.length < 2 || (t = SessionState.find_resource_type(tokens[1])) == null)
{
-        console.printError("Usage: list ["
-            + StringUtils.join(SessionState.ResourceType.values(), "|") + "] [<value>
[<value>]*]");
-        ret = 1;
-      } else {
-        List<String> filter = null;
-        if (tokens.length >= 3) {
-          System.arraycopy(tokens, 2, tokens, 0, tokens.length - 2);
-          filter = Arrays.asList(tokens);
-        }
-        Set<String> s = ss.list_resource(t, filter);
-        if (s != null && !s.isEmpty()) {
-          ss.out.println(StringUtils.join(s, "\n"));
-        }
-      }
     } else if (ss.isRemoteMode()) { // remote mode -- connecting to remote hive server
       HiveClient client = ss.getClient();
       PrintStream out = ss.out;

Modified: hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java?rev=1617189&r1=1617188&r2=1617189&view=diff
==============================================================================
--- hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (original)
+++ hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java Mon Aug 11 01:16:30
2014
@@ -1551,7 +1551,7 @@ public class HiveConf extends Configurat
     HIVE_SERVER2_SSL_KEYSTORE_PATH("hive.server2.keystore.path", "", ""),
     HIVE_SERVER2_SSL_KEYSTORE_PASSWORD("hive.server2.keystore.password", "", ""),
 
-    HIVE_SECURITY_COMMAND_WHITELIST("hive.security.command.whitelist", "set,reset,dfs,add,delete,compile",
+    HIVE_SECURITY_COMMAND_WHITELIST("hive.security.command.whitelist", "set,reset,dfs,add,list,delete,compile",
         "Comma separated list of non-SQL Hive commands users are authorized to execute"),
 
     HIVE_CONF_RESTRICTED_LIST("hive.conf.restricted.list",

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessor.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessor.java?rev=1617189&r1=1617188&r2=1617189&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessor.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessor.java Mon
Aug 11 01:16:30 2014
@@ -21,7 +21,8 @@ package org.apache.hadoop.hive.ql.proces
 import org.apache.hadoop.hive.ql.CommandNeedRetryException;
 
 public interface CommandProcessor {
-  public void init();
 
-  public CommandProcessorResponse run(String command) throws CommandNeedRetryException;
+  void init();
+
+  CommandProcessorResponse run(String command) throws CommandNeedRetryException;
 }

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=1617189&r1=1617188&r2=1617189&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
Mon Aug 11 01:16:30 2014
@@ -74,6 +74,8 @@ public final class CommandProcessorFacto
         return new DfsProcessor(ss.getConf());
       case ADD:
         return new AddResourceProcessor();
+      case LIST:
+        return new ListResourceProcessor();
       case DELETE:
         return new DeleteResourceProcessor();
       case COMPILE:

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/HiveCommand.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/HiveCommand.java?rev=1617189&r1=1617188&r2=1617189&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/HiveCommand.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/HiveCommand.java Mon Aug 11
01:16:30 2014
@@ -30,6 +30,7 @@ public enum HiveCommand {
   RESET(),
   DFS(),
   ADD(),
+  LIST(),
   DELETE(),
   COMPILE();
   private static final Set<String> COMMANDS = new HashSet<String>();

Added: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ListResourceProcessor.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ListResourceProcessor.java?rev=1617189&view=auto
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ListResourceProcessor.java
(added)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/ListResourceProcessor.java
Mon Aug 11 01:16:30 2014
@@ -0,0 +1,70 @@
+/**
+ * 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.commons.lang.StringUtils;
+import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.Schema;
+import org.apache.hadoop.hive.ql.CommandNeedRetryException;
+import org.apache.hadoop.hive.ql.session.SessionState;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import static org.apache.hadoop.hive.serde.serdeConstants.SERIALIZATION_NULL_FORMAT;
+import static org.apache.hadoop.hive.serde.serdeConstants.STRING_TYPE_NAME;
+import static org.apache.hadoop.hive.serde2.MetadataTypedColumnsetSerDe.defaultNullString;
+
+public class ListResourceProcessor implements CommandProcessor {
+
+  private static final String LIST_COLUMN_NAME = "resource";
+  private static final Schema SCHEMA;
+
+  static {
+    SCHEMA = new Schema();
+    SCHEMA.addToFieldSchemas(new FieldSchema(LIST_COLUMN_NAME, STRING_TYPE_NAME, null));
+    SCHEMA.putToProperties(SERIALIZATION_NULL_FORMAT, defaultNullString);
+  }
+
+  @Override
+  public void init() {
+  }
+
+  @Override
+  public CommandProcessorResponse run(String command) throws CommandNeedRetryException {
+    SessionState ss = SessionState.get();
+    String[] tokens = command.split("\\s+");
+    SessionState.ResourceType t;
+    if (tokens.length < 1 || (t = SessionState.find_resource_type(tokens[0])) == null)
{
+      String message = "Usage: list ["
+          + StringUtils.join(SessionState.ResourceType.values(), "|") + "] [<value>
[<value>]*]";
+      return new CommandProcessorResponse(1, message, null);
+    }
+    List<String> filter = null;
+    if (tokens.length > 1) {
+      filter = Arrays.asList(Arrays.copyOfRange(tokens, 1, tokens.length));
+    }
+    Set<String> s = ss.list_resource(t, filter);
+    if (s != null && !s.isEmpty()) {
+      ss.out.println(StringUtils.join(s, "\n"));
+    }
+    return new CommandProcessorResponse(0, null, null, SCHEMA);
+  }
+}



Mime
View raw message