use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testCreateFunctionCaseInsensitive.
@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);
}
use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testCreateFunctionAlreadyExists.
@Test(expected = AlreadyExistsException.class)
public void testCreateFunctionAlreadyExists() throws Exception {
Function function = testFunctions[0];
client.createFunction(function);
}
use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testDropFunctionCaseInsensitive.
@Test
public void testDropFunctionCaseInsensitive() throws Exception {
Function function = testFunctions[0];
// Test in upper case
client.dropFunction(function.getDbName().toUpperCase(), function.getFunctionName().toUpperCase());
// Check if the function is really removed
try {
client.getFunction(function.getDbName(), function.getFunctionName());
Assert.fail("Expected a NoSuchObjectException to be thrown");
} catch (NoSuchObjectException exception) {
// Expected exception
}
// Test in mixed case
client.createFunction(function);
client.dropFunction("DeFaUlt", "tEsT_FuncTION_tO_FinD_1");
// Check if the function is really removed
try {
client.getFunction(function.getDbName(), function.getFunctionName());
Assert.fail("Expected a NoSuchObjectException to be thrown");
} catch (NoSuchObjectException exception) {
// Expected exception
}
}
use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testCreateFunctionInvalidName.
@Test(expected = InvalidObjectException.class)
public void testCreateFunctionInvalidName() throws Exception {
Function function = testFunctions[0];
function.setFunctionName("test_function_2;");
client.createFunction(function);
}
use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.
the class TestFunctions method testCreateFunctionEmptyName.
@Test(expected = InvalidObjectException.class)
public void testCreateFunctionEmptyName() throws Exception {
Function function = testFunctions[0];
function.setFunctionName("");
client.createFunction(function);
}
Aggregations