[ 
https://issues.apache.org/jira/browse/DRILL-6272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16463185#comment-16463185
 ] 

ASF GitHub Bot commented on DRILL-6272:
---------------------------------------

vrozov commented on a change in pull request #1225: DRILL-6272: Refactor 
dynamic UDFs and function initializer tests to g…
URL: https://github.com/apache/drill/pull/1225#discussion_r185938976
 
 

 ##########
 File path: 
exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestCTTAS.java
 ##########
 @@ -164,121 +161,92 @@ public void 
testResolveTemporaryTableWithPartialSchema() throws Exception {
   @Test
   public void testPartitionByWithTemporaryTables() throws Exception {
     String temporaryTableName = "temporary_table_with_partitions";
-    mockRandomUUID(UUID.nameUUIDFromBytes(temporaryTableName.getBytes()));
     test("create TEMPORARY table %s partition by (c1) as select * from (" +
         "select 'A' as c1 from (values(1)) union all select 'B' as c1 from 
(values(1))) t", temporaryTableName);
     checkPermission(temporaryTableName);
   }
 
-  @Test(expected = UserRemoteException.class)
+  @Test
   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].", 
DFS_TMP_SCHEMA)));
-      throw e;
-    }
+    String temporaryTableName = "temporary_table_outside_of_default_workspace";
+
+    expectUserRemoteExceptionWithMessage(String.format(
+      "VALIDATION ERROR: Temporary tables are not allowed to be created / 
dropped " +
+        "outside of default temporary workspace [%s].", DFS_TMP_SCHEMA));
+
+    test("create TEMPORARY table %s.%s as select 'A' as c1 from (values(1))", 
temp2_schema, temporaryTableName);
   }
 
-  @Test(expected = UserRemoteException.class)
+  @Test
   public void testCreateWhenTemporaryTableExistsWithoutSchema() 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);
-    } 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, 
DFS_TMP_SCHEMA)));
-      throw e;
-    }
+    test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", 
temporaryTableName);
+
+    expectUserRemoteExceptionWithTableExistsMessage(temporaryTableName, 
DFS_TMP_SCHEMA);
+
+    test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", 
temporaryTableName);
   }
 
-  @Test(expected = UserRemoteException.class)
+  @Test
   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(), DFS_TMP_SCHEMA)));
-      throw e;
-    }
+    String temporaryTableName = "temporary_table_exists_case_insensitive";
+    test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", 
temporaryTableName);
+
+    
expectUserRemoteExceptionWithTableExistsMessage(temporaryTableName.toUpperCase(),
 DFS_TMP_SCHEMA);
+
+    test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", 
temporaryTableName.toUpperCase());
   }
 
-  @Test(expected = UserRemoteException.class)
+  @Test
   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))", DFS_TMP_SCHEMA, temporaryTableName);
-      test("create TEMPORARY table %s.%s as select 'A' as c1 from 
(values(1))", DFS_TMP_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, 
DFS_TMP_SCHEMA)));
-      throw e;
-    }
+    test("create TEMPORARY table %s.%s as select 'A' as c1 from (values(1))", 
DFS_TMP_SCHEMA, temporaryTableName);
+
+    expectUserRemoteExceptionWithTableExistsMessage(temporaryTableName, 
DFS_TMP_SCHEMA);
+
+    test("create TEMPORARY table %s.%s as select 'A' as c1 from (values(1))", 
DFS_TMP_SCHEMA, temporaryTableName);
   }
 
-  @Test(expected = UserRemoteException.class)
+  @Test
   public void testCreateWhenPersistentTableExists() throws Exception {
     String persistentTableName = "persistent_table_exists";
-    try {
-      test("create table %s.%s as select 'A' as c1 from (values(1))", 
DFS_TMP_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, 
DFS_TMP_SCHEMA)));
-      throw e;
-    }
+    test("create table %s.%s as select 'A' as c1 from (values(1))", 
DFS_TMP_SCHEMA, persistentTableName);
+
+    expectUserRemoteExceptionWithTableExistsMessage(persistentTableName, 
DFS_TMP_SCHEMA);
+
+    test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", 
persistentTableName);
   }
 
-  @Test(expected = UserRemoteException.class)
+  @Test
   public void testCreateWhenViewExists() throws Exception {
     String viewName = "view_exists";
-    try {
-      test("create view %s.%s as select 'A' as c1 from (values(1))", 
DFS_TMP_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, DFS_TMP_SCHEMA)));
-      throw e;
-    }
+    test("create view %s.%s as select 'A' as c1 from (values(1))", 
DFS_TMP_SCHEMA, viewName);
+
+    expectUserRemoteExceptionWithTableExistsMessage(viewName, DFS_TMP_SCHEMA);
+
+    test("create TEMPORARY table %s as select 'A' as c1 from (values(1))", 
viewName);
   }
 
-  @Test(expected = UserRemoteException.class)
+  @Test
   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))", 
DFS_TMP_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, 
DFS_TMP_SCHEMA)));
-      throw e;
-    }
+
+    expectUserRemoteExceptionWithTableExistsMessage(temporaryTableName, 
DFS_TMP_SCHEMA);
 
 Review comment:
   Please move this one too.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Remove binary jars files from source distribution
> -------------------------------------------------
>
>                 Key: DRILL-6272
>                 URL: https://issues.apache.org/jira/browse/DRILL-6272
>             Project: Apache Drill
>          Issue Type: Task
>            Reporter: Vlad Rozov
>            Assignee: Arina Ielchiieva
>            Priority: Critical
>             Fix For: 1.14.0
>
>
> Per [~vrozov] the source distribution contains binary jar files under 
> exec/java-exec/src/test/resources/jars



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to