David Engel created HIVE-6971: --------------------------------- Summary: Off by one errors in AddResourceProcessor.run() Key: HIVE-6971 URL: https://issues.apache.org/jira/browse/HIVE-6971 Project: Hive Issue Type: Bug Components: Thrift API Affects Versions: 0.13.0 Reporter: David Engel
Using the pyhs2 python client to access Hive versions 0.12.0 and 0.13.0, I could not add jars. I traced the problem to a couple of off by one errors in AddResourceProcessor.run(). This patch fixes them. diff -urN apache-hive-0.13.0-src/ql/src/java/org/apache/hadoop/hive/ql/processors/AddResourceProcessor.java apache-hive-0.13.0-src-intz/ql/src/java/org/apache/hadoop/hive/ql/processors/AddResourceProcessor.java --- apache-hive-0.13.0-src/ql/src/java/org/apache/hadoop/hive/ql/processors/AddResourceProcessor.java 2014-03-04 19:20:08.000000000 -0600 +++ apache-hive-0.13.0-src-intz/ql/src/java/org/apache/hadoop/hive/ql/processors/AddResourceProcessor.java 2014-04-24 11:59:13.548454559 -0500 @@ -44,13 +44,13 @@ String[] tokens = command.split("\\s+"); SessionState.ResourceType t; if (tokens.length < 2 - || (t = SessionState.find_resource_type(tokens[0])) == null) { + || (t = SessionState.find_resource_type(tokens[1])) == null) { console.printError("Usage: add [" + StringUtils.join(SessionState.ResourceType.values(), "|") + "] <value> [<value>]*"); return new CommandProcessorResponse(1); } - for (int i = 1; i < tokens.length; i++) { + for (int i = 2; i < tokens.length; i++) { String resourceFile = ss.add_resource(t, tokens[i]); if(resourceFile == null){ String errMsg = tokens[i]+" does not exist."; -- This message was sent by Atlassian JIRA (v6.2#6252)