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

Misalignment in matching db name from Hive and Webhcat

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3.6
    • Fix Version/s: None
    • Component/s: WebHCat
    • Labels:
      None

      Description

      I found a small misalignment on how Hive and WebHCat parse database name starting with numbers.

      If you execute:

      hive> create database 2020db;
      OK
      Time taken: 0.44 seconds
      hive>

      it works, but if you do the same on webhcatalog it doesn't:

      curl -i -s -X PUT -HContent-type:application/json -d '{"comment": "Test", "location": "hdfs://singlenode.localdomain:8020/apps/hive/warehouse/2020db"}' 'http://singlenode.localdomain:50111/templeton/v1/ddl/database/2020db?user.name=hdfs'
      HTTP/1.1 400 Bad Request
      Set-Cookie: hadoop.auth="u=hdfs&p=hdfs&t=simple&e=1608581595777&s=JzsCUqvyyAYHykAHdteybh1tI4jFLLVVJC5D9FaUu0A="; Path=/; HttpOnly
      Content-Type: application/json
      Transfer-Encoding: chunked
      Server: Jetty(7.6.0.v20120127)
      {"error":"Invalid DDL identifier :db"}

       

      I suggest to harmonize the behavior, maybe applying a patch like the following one:

       

      — a/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java
      +++ b/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java
      @@ -1068,7 +1068,7 @@ public void verifyParam(List<String> param, String name)
      }
      }

      - public static final Pattern DDL_ID = Pattern.compile("[a-zA-Z]\\w*");
      + public static final Pattern DDL_ID = Pattern.compile("[a-zA-Z0-9]\\w*");

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dvergari Davide Vergari
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: