use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestDirectoryExplorerUDFs method testConstantFoldingOff.
@Test
public void testConstantFoldingOff() throws Exception {
try {
test("set `planner.enable_constant_folding` = false;");
String query = "select * from dfs.`" + path + "/*/*.csv` where dir0 = %s('dfs.root','" + path + "')";
for (ConstantFoldingTestConfig config : tests) {
try {
test(String.format(query, config.funcName));
} catch (UserRemoteException e) {
assertThat(e.getMessage(), containsString("Directory explorers [MAXDIR, IMAXDIR, MINDIR, IMINDIR] functions can not be used " + "when planner.enable_constant_folding option is set to false"));
}
}
} finally {
test("set `planner.enable_constant_folding` = true;");
}
}
use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestCTTAS method testCreatePersistentTableWhenTemporaryTableExists.
@Test(expected = UserRemoteException.class)
public void testCreatePersistentTableWhenTemporaryTableExists() throws Exception {
String temporaryTableName = "temporary_table_exists_before_persistent";
try {
test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", temporaryTableName);
test("create table %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 table or view with given name [%s]" + " already exists 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 testCreateWhenViewExists.
@Test(expected = UserRemoteException.class)
public void testCreateWhenViewExists() throws Exception {
String viewName = "view_exists";
try {
test("create view %s.%s as select 'A' as c1 from (values(1))", TEMP_SCHEMA, viewName);
test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", viewName);
} catch (UserRemoteException e) {
assertThat(e.getMessage(), containsString(String.format("VALIDATION ERROR: A table or view with given name [%s]" + " already exists in schema [%s]", viewName, TEMP_SCHEMA)));
throw e;
}
}
use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestCTTAS method testCreationOutsideOfDefaultTemporaryWorkspace.
@Test(expected = UserRemoteException.class)
public void testCreationOutsideOfDefaultTemporaryWorkspace() throws Exception {
try {
String temporaryTableName = "temporary_table_outside_of_default_workspace";
test("create TEMPORARY table %s.%s as select 'A' as c1 from (values(1))", temp2_schema, temporaryTableName);
} catch (UserRemoteException e) {
assertThat(e.getMessage(), containsString(String.format("VALIDATION ERROR: Temporary tables are not allowed to be created / dropped " + "outside of default temporary workspace [%s].", TEMP_SCHEMA)));
throw e;
}
}
use of org.apache.drill.common.exceptions.UserRemoteException in project drill by apache.
the class TestCTTAS method testCreateWhenTemporaryTableExistsWithSchema.
@Test(expected = UserRemoteException.class)
public void testCreateWhenTemporaryTableExistsWithSchema() throws Exception {
String temporaryTableName = "temporary_table_exists_with_schema";
try {
test("create TEMPORARY table %s.%s as select 'A' as c1 from (values(1))", TEMP_SCHEMA, temporaryTableName);
test("create TEMPORARY table %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 table or view with given name [%s]" + " already exists in schema [%s]", temporaryTableName, TEMP_SCHEMA)));
throw e;
}
}
Aggregations