You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/10/31 14:36:44 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #38438: [SPARK-40748][SQL] Migrate type check failures of conditions onto error classes

MaxGekk commented on code in PR #38438:
URL: https://github.com/apache/spark/pull/38438#discussion_r1009486429


##########
sql/core/src/test/java/test/org/apache/spark/sql/JavaColumnExpressionSuite.java:
##########
@@ -81,10 +81,13 @@ public void isInCollectionCheckExceptionMessage() {
     Dataset<Row> df = spark.createDataFrame(rows, schema);
     Exception e = Assert.assertThrows(Exception.class,
       () -> df.filter(df.col("a").isInCollection(Arrays.asList(new Column("b")))));
-    Arrays.asList("cannot resolve",
-      "due to data type mismatch: Arguments must be same type but were")
-        .forEach(s ->
-          Assert.assertTrue(e.getMessage().toLowerCase(Locale.ROOT)
-            .contains(s.toLowerCase(Locale.ROOT))));
+    System.out.println(e.getMessage().toLowerCase(Locale.ROOT));

Review Comment:
   Is it needed?



##########
sql/core/src/test/java/test/org/apache/spark/sql/JavaColumnExpressionSuite.java:
##########
@@ -81,10 +81,13 @@ public void isInCollectionCheckExceptionMessage() {
     Dataset<Row> df = spark.createDataFrame(rows, schema);
     Exception e = Assert.assertThrows(Exception.class,
       () -> df.filter(df.col("a").isInCollection(Arrays.asList(new Column("b")))));
-    Arrays.asList("cannot resolve",
-      "due to data type mismatch: Arguments must be same type but were")
-        .forEach(s ->
-          Assert.assertTrue(e.getMessage().toLowerCase(Locale.ROOT)
-            .contains(s.toLowerCase(Locale.ROOT))));
+    System.out.println(e.getMessage().toLowerCase(Locale.ROOT));
+    Arrays.asList(
+      "datatype_mismatch.data_diff_types",
+      "cannot resolve \"(a in (b))\"",
+      "due to data type mismatch: input to `in` should all be the same type, " +
+        "but it's [\"int\", \"array<int>\"].").forEach(s ->
+      Assert.assertTrue(e.getMessage().toLowerCase(Locale.ROOT)
+        .contains(s.toLowerCase(Locale.ROOT))));

Review Comment:
   Let's don't compare error messages. If you cannot call `checkError()` easily, just check error classes (maybe more if you can).



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org