You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by li...@apache.org on 2019/07/31 07:23:24 UTC
[hive] branch master updated: HIVE-22053: Function name is not
normalized when creating function (Rui reviewed by Xuefu)
This is an automated email from the ASF dual-hosted git repository.
lirui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new dd190d9 HIVE-22053: Function name is not normalized when creating function (Rui reviewed by Xuefu)
dd190d9 is described below
commit dd190d96fd99388a90160108b140cdc084f34b33
Author: Rui Li <li...@apache.org>
AuthorDate: Wed Jul 31 15:23:06 2019 +0800
HIVE-22053: Function name is not normalized when creating function (Rui reviewed by Xuefu)
---
.../java/org/apache/hadoop/hive/metastore/ObjectStore.java | 2 +-
.../apache/hadoop/hive/metastore/client/TestFunctions.java | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 509fcb2..def32c7 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -9685,7 +9685,7 @@ public class ObjectStore implements RawStore, Configurable {
throw new InvalidObjectException("Database " + func.getDbName() + " doesn't exist.");
}
- MFunction mfunc = new MFunction(func.getFunctionName(),
+ MFunction mfunc = new MFunction(normalizeIdentifier(func.getFunctionName()),
mdb,
func.getClassName(),
func.getOwnerName(),
diff --git a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestFunctions.java b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestFunctions.java
index db6b599..58f7363 100644
--- a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestFunctions.java
+++ b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestFunctions.java
@@ -762,4 +762,16 @@ public class TestFunctions extends MetaStoreClientTest {
Assert.assertEquals(0, functionNames.size());
}
+ @Test
+ public void testCreateFunctionCaseInsensitive() throws Exception {
+ Function function = testFunctions[0];
+
+ function.setFunctionName("Test_Upper_Case_Func_Name");
+ client.createFunction(function);
+
+ String storedName = client.getFunction(function.getDbName(),
+ function.getFunctionName()).getFunctionName();
+ Assert.assertEquals(function.getFunctionName().toLowerCase(), storedName);
+ }
+
}