Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.3.6
-
None
-
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*");