Davide  Vergari created HIVE-24557:
--------------------------------------

             Summary: Misalignment in matching db name from Hive and Webhcat
                 Key: HIVE-24557
                 URL: https://issues.apache.org/jira/browse/HIVE-24557
             Project: Hive
          Issue Type: Bug
          Components: WebHCat
    Affects Versions: 2.3.6
            Reporter: Davide  Vergari


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

If you execute:
{quote}hive> create database 2020db;
OK
Time taken: 0.44 seconds
hive>
{quote}
it works, but if you do the same on webhcatalog it doesn't:
{quote}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"}
{quote}
 

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

 
{quote}--- 
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*");
 public static final Pattern PROPERTY_ID =
 Pattern.compile("[a-zA-Z0-9][\\w\\.\\-]*(?<!\\-)(?<!\\.)(?<!\\_)$");
{quote}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to