Search in sources :

Example 16 with Function

use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.

the class TestFunctions method testCreateFunctionNullOwnerType.

@Test
public void testCreateFunctionNullOwnerType() throws Exception {
    Function function = testFunctions[0];
    function.setFunctionName("test_function_2");
    function.setOwnerType(null);
    try {
        client.createFunction(function);
        // TODO: Should have a check on the server side. Embedded metastore throws
        // NullPointerException, remote throws TTransportException
        Assert.fail("Expected an NullPointerException or TTransportException to be thrown");
    } catch (NullPointerException exception) {
    // Expected exception - Embedded MetaStore
    } catch (TTransportException exception) {
    // Expected exception - Remote MetaStore
    }
}
Also used : Function(org.apache.hadoop.hive.metastore.api.Function) TTransportException(org.apache.thrift.transport.TTransportException) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 17 with Function

use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.

the class TestFunctions method testAlterFunctionNullDatabaseNameInNew.

@Test
public void testAlterFunctionNullDatabaseNameInNew() throws Exception {
    Function newFunction = getNewFunction();
    newFunction.setDbName(null);
    try {
        client.alterFunction(DEFAULT_DATABASE, "test_function_to_find_2", newFunction);
        // TODO: Should have a check on the server side. Embedded metastore throws
        // NullPointerException, remote throws TTransportException
        Assert.fail("Expected an NullPointerException or TTransportException to be thrown");
    } catch (NullPointerException exception) {
    // Expected exception - Embedded MetaStore
    } catch (TTransportException exception) {
    // Expected exception - Remote MetaStore
    }
}
Also used : Function(org.apache.hadoop.hive.metastore.api.Function) TTransportException(org.apache.thrift.transport.TTransportException) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 18 with Function

use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.

the class TestFunctions method testCreateFunctionNullClass.

@Test(expected = InvalidObjectException.class)
public void testCreateFunctionNullClass() throws Exception {
    Function function = testFunctions[0];
    function.setClassName(null);
    client.createFunction(function);
}
Also used : Function(org.apache.hadoop.hive.metastore.api.Function) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 19 with Function

use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.

the class TestFunctions method testAlterFunctionNullFunctionName.

@Test
public void testAlterFunctionNullFunctionName() throws Exception {
    Function newFunction = getNewFunction();
    try {
        client.alterFunction(DEFAULT_DATABASE, null, newFunction);
        // TODO: Should have a check on the server side. Embedded metastore throws
        // NullPointerException, remote throws TTransportException
        Assert.fail("Expected an NullPointerException or TTransportException to be thrown");
    } catch (NullPointerException exception) {
    // Expected exception - Embedded MetaStore
    } catch (TTransportException exception) {
    // Expected exception - Remote MetaStore
    }
}
Also used : Function(org.apache.hadoop.hive.metastore.api.Function) TTransportException(org.apache.thrift.transport.TTransportException) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 20 with Function

use of org.apache.hadoop.hive.metastore.api.Function in project hive by apache.

the class TestFunctions method testGetFunctionNoSuchDatabase.

@Test(expected = NoSuchObjectException.class)
public void testGetFunctionNoSuchDatabase() throws Exception {
    // Choosing the 2nd function, since the 1st one is duplicated in the dummy database
    Function function = testFunctions[1];
    client.getFunction("no_such_database", function.getFunctionName());
}
Also used : Function(org.apache.hadoop.hive.metastore.api.Function) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Aggregations

Function (org.apache.hadoop.hive.metastore.api.Function)69 Test (org.junit.Test)47 MetastoreCheckinTest (org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)38 ResourceUri (org.apache.hadoop.hive.metastore.api.ResourceUri)17 TTransportException (org.apache.thrift.transport.TTransportException)11 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)9 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)8 ArrayList (java.util.ArrayList)7 IOException (java.io.IOException)6 InvalidObjectException (org.apache.hadoop.hive.metastore.api.InvalidObjectException)6 FunctionBuilder (org.apache.hadoop.hive.metastore.client.builder.FunctionBuilder)6 Database (org.apache.hadoop.hive.metastore.api.Database)4 NotificationEvent (org.apache.hadoop.hive.metastore.api.NotificationEvent)4 TApplicationException (org.apache.thrift.TApplicationException)4 TException (org.apache.thrift.TException)4 HashSet (java.util.HashSet)3 Path (org.apache.hadoop.fs.Path)3 InvalidOperationException (org.apache.hadoop.hive.metastore.api.InvalidOperationException)3 Partition (org.apache.hadoop.hive.metastore.api.Partition)3 SQLException (java.sql.SQLException)2