Search in sources :

Example 21 with UserRemoteException

use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.

the class TestCTTAS method testCreateWhenTemporaryTableExistsCaseInsensitive.

@Test(expected = UserRemoteException.class)
public void testCreateWhenTemporaryTableExistsCaseInsensitive() throws Exception {
    String temporaryTableName = "temporary_table_exists_without_schema";
    try {
        test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", temporaryTableName);
        test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", temporaryTableName.toUpperCase());
    } catch (UserRemoteException e) {
        assertThat(e.getMessage(), containsString(String.format("VALIDATION ERROR: A table or view with given name [%s]" + " already exists in schema [%s]", temporaryTableName.toUpperCase(), TEMP_SCHEMA)));
        throw e;
    }
}
Also used : UserRemoteException(org.apache.drill.common.exceptions.UserRemoteException) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 22 with UserRemoteException

use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.

the class TestCTTAS method testCreateViewWhenTemporaryTableExists.

@Test(expected = UserRemoteException.class)
public void testCreateViewWhenTemporaryTableExists() throws Exception {
    String temporaryTableName = "temporary_table_exists_before_view";
    try {
        test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", temporaryTableName);
        test("create view %s.%s as select 'A' as c1 from (values(1))", TEMP_SCHEMA, temporaryTableName);
    } catch (UserRemoteException e) {
        assertThat(e.getMessage(), containsString(String.format("VALIDATION ERROR: A non-view table with given name [%s] already exists in schema [%s]", temporaryTableName, TEMP_SCHEMA)));
        throw e;
    }
}
Also used : UserRemoteException(org.apache.drill.common.exceptions.UserRemoteException) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 23 with UserRemoteException

use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.

the class TestImpersonationQueries method testMultiLevelImpersonationExceedsMaxUserHops.

@Test
public void testMultiLevelImpersonationExceedsMaxUserHops() throws Exception {
    UserRemoteException ex = null;
    try {
        updateClient(org1Users[5]);
        test(String.format("SELECT * from %s.u4_lineitem LIMIT 1;", getWSSchema(org1Users[4])));
    } catch (UserRemoteException e) {
        ex = e;
    }
    assertNotNull("UserRemoteException is expected", ex);
    assertThat(ex.getMessage(), containsString("Cannot issue token for view expansion as issuing the token exceeds the maximum allowed number " + "of user hops (3) in chained impersonation"));
}
Also used : UserRemoteException(org.apache.drill.common.exceptions.UserRemoteException) Test(org.junit.Test)

Example 24 with UserRemoteException

use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.

the class RequestIdMap method recordRemoteFailure.

public void recordRemoteFailure(int coordinationId, DrillPBError failure) {
    // logger.debug("Updating failed future.");
    try {
        RpcOutcome<?> rpc = removeFromMap(coordinationId);
        rpc.setException(new UserRemoteException(failure));
    } catch (Exception ex) {
        logger.warn("Failed to remove from map.  Not a problem since we were updating on failed future.", ex);
    }
}
Also used : UserRemoteException(org.apache.drill.common.exceptions.UserRemoteException) UserRemoteException(org.apache.drill.common.exceptions.UserRemoteException)

Example 25 with UserRemoteException

use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.

the class TestImpersonationMetadata method testShowFilesInWSWithNoPermissionsForQueryUser.

@Test
public void testShowFilesInWSWithNoPermissionsForQueryUser() throws Exception {
    UserRemoteException ex = null;
    updateClient(user2);
    try {
        // Try show tables in schema "drillTestGrp1_700" which is owned by "user1"
        test(String.format("SHOW FILES IN %s.drillTestGrp1_700", MINIDFS_STORAGE_PLUGIN_NAME));
    } catch (UserRemoteException e) {
        ex = e;
    }
    assertNotNull("UserRemoteException is expected", ex);
    assertThat(ex.getMessage(), containsString("Permission denied: user=drillTestUser2, " + "access=READ_EXECUTE, inode=\"/drillTestGrp1_700\":drillTestUser1:drillTestGrp1:drwx------"));
}
Also used : UserRemoteException(org.apache.drill.common.exceptions.UserRemoteException) Test(org.junit.Test)

Aggregations

UserRemoteException (org.apache.drill.common.exceptions.UserRemoteException)25 Test (org.junit.Test)22 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)15 File (java.io.File)2 QueryId (org.apache.drill.exec.proto.UserBitShared.QueryId)2 QueryState (org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState)2 Path (org.apache.hadoop.fs.Path)2 Matchers.anyString (org.mockito.Matchers.anyString)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Map (java.util.Map)1 UserException (org.apache.drill.common.exceptions.UserException)1 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)1 LocalFunctionRegistry (org.apache.drill.exec.expr.fn.registry.LocalFunctionRegistry)1 RemoteFunctionRegistry (org.apache.drill.exec.expr.fn.registry.RemoteFunctionRegistry)1 QueryResult (org.apache.drill.exec.proto.UserBitShared.QueryResult)1 RpcException (org.apache.drill.exec.rpc.RpcException)1 DataChangeVersion (org.apache.drill.exec.store.sys.store.DataChangeVersion)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1 Mockito.doAnswer (org.mockito.Mockito.doAnswer)1