Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-6971

Off by one errors in AddResourceProcessor.run()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.13.0
    • None
    • Thrift API
    • None

    Description

      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.";
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            dlengel David Engel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: