You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "liuxiaocs7 (via GitHub)" <gi...@apache.org> on 2023/04/30 13:57:49 UTC

[GitHub] [iceberg] liuxiaocs7 opened a new pull request, #7482: Hive: Remove deprecated AssertHelpers

liuxiaocs7 opened a new pull request, #7482:
URL: https://github.com/apache/iceberg/pull/7482

   - SubTask of https://github.com/apache/iceberg/issues/7094
   
   Remove AssertHelpers in `iceberg-hive-metastore` module


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] liuxiaocs7 commented on a diff in pull request #7482: Hive: Remove deprecated AssertHelpers

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #7482:
URL: https://github.com/apache/iceberg/pull/7482#discussion_r1182117457


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveSchemaUtil.java:
##########
@@ -147,13 +147,12 @@ public void testSchemaConvertToIcebergSchemaForEveryPrimitiveType() {
   @Test
   public void testNotSupportedTypes() {
     for (FieldSchema notSupportedField : getNotSupportedFieldSchemas()) {
-      AssertHelpers.assertThrows(
-          "should throw exception",
-          IllegalArgumentException.class,
-          "Unsupported Hive type",
-          () -> {
-            HiveSchemaUtil.convert(Lists.newArrayList(Arrays.asList(notSupportedField)));
-          });
+      Assertions.assertThatThrownBy(
+              () -> {

Review Comment:
   make sense, thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] liuxiaocs7 commented on a diff in pull request #7482: Hive: Remove deprecated AssertHelpers

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #7482:
URL: https://github.com/apache/iceberg/pull/7482#discussion_r1182117650


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java:
##########
@@ -410,39 +403,40 @@ public void testCreateNamespaceWithOwnership() throws Exception {
         "iceberg",
         PrincipalType.GROUP);
 
-    AssertHelpers.assertThrows(
-        String.format(
-            "Create namespace setting %s without setting %s is not allowed",
-            HiveCatalog.HMS_DB_OWNER_TYPE, HiveCatalog.HMS_DB_OWNER),
-        IllegalArgumentException.class,
-        () -> {
-          try {
-            createNamespaceAndVerifyOwnership(
-                "create_with_owner_type_alone",
-                ImmutableMap.of(HiveCatalog.HMS_DB_OWNER_TYPE, PrincipalType.USER.name()),
-                "no_post_create_expectation_due_to_exception_thrown",
-                null);
-          } catch (TException e) {
-            throw new RuntimeException("Unexpected Exception", e);
-          }
-        });
-
-    AssertHelpers.assertThrows(
-        "No enum constant " + PrincipalType.class.getCanonicalName(),
-        IllegalArgumentException.class,
-        () -> {
-          try {
-            createNamespaceAndVerifyOwnership(
-                "create_with_invalid_owner_type",
-                ImmutableMap.of(
-                    HiveCatalog.HMS_DB_OWNER, "iceberg",
-                    HiveCatalog.HMS_DB_OWNER_TYPE, "invalidOwnerType"),
-                "no_post_create_expectation_due_to_exception_thrown",
-                null);
-          } catch (TException e) {
-            throw new RuntimeException("Unexpected Exception", e);
-          }
-        });
+    assertThatThrownBy(
+            () -> {
+              try {
+                createNamespaceAndVerifyOwnership(
+                    "create_with_owner_type_alone",
+                    ImmutableMap.of(HiveCatalog.HMS_DB_OWNER_TYPE, PrincipalType.USER.name()),
+                    "no_post_create_expectation_due_to_exception_thrown",
+                    null);
+              } catch (TException e) {

Review Comment:
   fixed, thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra merged pull request #7482: Hive: Remove deprecated AssertHelpers

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra merged PR #7482:
URL: https://github.com/apache/iceberg/pull/7482


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #7482: Hive: Remove deprecated AssertHelpers

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7482:
URL: https://github.com/apache/iceberg/pull/7482#discussion_r1181492855


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java:
##########
@@ -410,39 +403,40 @@ public void testCreateNamespaceWithOwnership() throws Exception {
         "iceberg",
         PrincipalType.GROUP);
 
-    AssertHelpers.assertThrows(
-        String.format(
-            "Create namespace setting %s without setting %s is not allowed",
-            HiveCatalog.HMS_DB_OWNER_TYPE, HiveCatalog.HMS_DB_OWNER),
-        IllegalArgumentException.class,
-        () -> {
-          try {
-            createNamespaceAndVerifyOwnership(
-                "create_with_owner_type_alone",
-                ImmutableMap.of(HiveCatalog.HMS_DB_OWNER_TYPE, PrincipalType.USER.name()),
-                "no_post_create_expectation_due_to_exception_thrown",
-                null);
-          } catch (TException e) {
-            throw new RuntimeException("Unexpected Exception", e);
-          }
-        });
-
-    AssertHelpers.assertThrows(
-        "No enum constant " + PrincipalType.class.getCanonicalName(),
-        IllegalArgumentException.class,
-        () -> {
-          try {
-            createNamespaceAndVerifyOwnership(
-                "create_with_invalid_owner_type",
-                ImmutableMap.of(
-                    HiveCatalog.HMS_DB_OWNER, "iceberg",
-                    HiveCatalog.HMS_DB_OWNER_TYPE, "invalidOwnerType"),
-                "no_post_create_expectation_due_to_exception_thrown",
-                null);
-          } catch (TException e) {
-            throw new RuntimeException("Unexpected Exception", e);
-          }
-        });
+    assertThatThrownBy(
+            () -> {
+              try {
+                createNamespaceAndVerifyOwnership(
+                    "create_with_owner_type_alone",
+                    ImmutableMap.of(HiveCatalog.HMS_DB_OWNER_TYPE, PrincipalType.USER.name()),
+                    "no_post_create_expectation_due_to_exception_thrown",
+                    null);
+              } catch (TException e) {

Review Comment:
   I think we should remove those try-catch blocks as they are not needed



##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveSchemaUtil.java:
##########
@@ -147,13 +147,12 @@ public void testSchemaConvertToIcebergSchemaForEveryPrimitiveType() {
   @Test
   public void testNotSupportedTypes() {
     for (FieldSchema notSupportedField : getNotSupportedFieldSchemas()) {
-      AssertHelpers.assertThrows(
-          "should throw exception",
-          IllegalArgumentException.class,
-          "Unsupported Hive type",
-          () -> {
-            HiveSchemaUtil.convert(Lists.newArrayList(Arrays.asList(notSupportedField)));
-          });
+      Assertions.assertThatThrownBy(
+              () -> {

Review Comment:
   nit: can we remove the {} wrapping here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org