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 509fcb25ad..def32c7edb 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 @@ private MFunction convertToMFunction(Function func) throws InvalidObjectExceptio 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 db6b599ae7..58f73635c5 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 void getFunctionsNoSuchCatalog() throws TException { 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); + } + }