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 2020/10/07 01:35:47 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #29947: [SPARK-32793][SQL] Add raise_error function, adds error message parameter to assert_true

HyukjinKwon commented on a change in pull request #29947:
URL: https://github.com/apache/spark/pull/29947#discussion_r500686612



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
##########
@@ -2318,6 +2318,56 @@ object functions {
     new XxHash64(cols.map(_.expr))
   }
 
+  /**
+   * Returns null if the condition is true, and throws an exception otherwise.
+   *
+   * @group misc_funcs
+   * @since 3.1.0
+   */
+  def assert_true(c: Column): Column = withExpr {
+    new AssertTrue(c.expr)
+  }
+
+  /**
+   * Returns null if the condition is true; throws an exception with the error message otherwise.
+   *
+   * @group misc_funcs
+   * @since 3.1.0
+   */
+  def assert_true(c: Column, e: Column): Column = withExpr {
+    new AssertTrue(c.expr, e.expr)
+  }
+
+  /**
+   * Returns null if the condition is true; throws an exception with the error message otherwise.
+   *
+   * @group misc_funcs
+   * @since 3.1.0
+   */
+  def assert_true(c: Column, e: String): Column = withExpr {

Review comment:
       I would avoid exposing `String` overridden ones. See also https://github.com/apache/spark/blob/1b60ff5afea0637f74c5f064642225b35b13b069/sql/core/src/main/scala/org/apache/spark/sql/functions.scala#L58-L60




----------------------------------------------------------------
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.

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