use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestImpersonationQueries method testMultiLevelImpersonationJoinOneSideExceedsMaxUserHops.
@Test
public void testMultiLevelImpersonationJoinOneSideExceedsMaxUserHops() throws Exception {
UserRemoteException ex = null;
try {
updateClient(org1Users[4]);
test(String.format("SELECT * from %s.u4_lineitem l JOIN %s.u4_orders o ON l.l_orderkey = o.o_orderkey LIMIT 1;", getWSSchema(org1Users[4]), getWSSchema(org2Users[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"));
}
use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestCTTAS method testTemporaryTablesInViewDefinitions.
@Test(expected = UserRemoteException.class)
public void testTemporaryTablesInViewDefinitions() throws Exception {
String temporaryTableName = "temporary_table_for_view_definition";
test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", temporaryTableName);
try {
test("create view %s.view_with_temp_table as select * from %s", TEMP_SCHEMA, temporaryTableName);
} catch (UserRemoteException e) {
assertThat(e.getMessage(), containsString(String.format("VALIDATION ERROR: Temporary tables usage is disallowed. Used temporary table name: [%s]", temporaryTableName)));
throw e;
}
}
use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestCTTAS method testDropTemporaryTableAsViewWithException.
@Test(expected = UserRemoteException.class)
public void testDropTemporaryTableAsViewWithException() throws Exception {
String temporaryTableName = "temporary_table_to_drop_like_view_with_exception";
test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", temporaryTableName);
try {
test("drop view %s.%s", TEMP_SCHEMA, temporaryTableName);
} catch (UserRemoteException e) {
assertThat(e.getMessage(), containsString(String.format("VALIDATION ERROR: Unknown view [%s] in schema [%s]", temporaryTableName, TEMP_SCHEMA)));
throw e;
}
}
use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestCTTAS method testCreateWhenPersistentTableExists.
@Test(expected = UserRemoteException.class)
public void testCreateWhenPersistentTableExists() throws Exception {
String persistentTableName = "persistent_table_exists";
try {
test("create table %s.%s as select 'A' as c1 from (values(1))", TEMP_SCHEMA, persistentTableName);
test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", persistentTableName);
} catch (UserRemoteException e) {
assertThat(e.getMessage(), containsString(String.format("VALIDATION ERROR: A table or view with given name [%s]" + " already exists in schema [%s]", persistentTableName, TEMP_SCHEMA)));
throw e;
}
}
use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestCTTAS method testTemporaryTablesInViewExpansionLogic.
@Test(expected = UserRemoteException.class)
public void testTemporaryTablesInViewExpansionLogic() throws Exception {
String tableName = "table_for_expansion_logic_test";
String viewName = "view_for_expansion_logic_test";
test("use %s", TEMP_SCHEMA);
test("create table %s as select 'TABLE' as c1 from (values(1))", tableName);
test("create view %s as select * from %s", viewName, tableName);
testBuilder().sqlQuery("select * from %s", viewName).unOrdered().baselineColumns("c1").baselineValues("TABLE").go();
test("drop table %s", tableName);
test("create temporary table %s as select 'TEMP' as c1 from (values(1))", tableName);
try {
test("select * from %s", viewName);
} catch (UserRemoteException e) {
assertThat(e.getMessage(), containsString(String.format("VALIDATION ERROR: Temporary tables usage is disallowed. Used temporary table name: [%s]", tableName)));
throw e;
}
}
Aggregations