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/09/11 13:44:43 UTC
[GitHub] [spark] maropu commented on a change in pull request #29721: [SPARK-32851][SQL][TEST] Tests should fail if errors happen when generating projection code
maropu commented on a change in pull request #29721:
URL: https://github.com/apache/spark/pull/29721#discussion_r487054526
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
##########
@@ -2555,6 +2555,24 @@ class DataFrameSuite extends QueryTest
val df = Seq(0.0 -> -0.0).toDF("pos", "neg")
checkAnswer(df.select($"pos" > $"neg"), Row(false))
}
+
+ test("SPARK-32851: should fail if errors happen when generating expr code") {
+ val errMsg = intercept[SparkException] {
+ withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "false") {
+ val df = spark.range(1)
+ df.select(Column(FailedCodegenExpr(df("id").expr)) :: Nil: _*).show()
+ }
+ }.getCause.getMessage
+ assert(errMsg.contains("failed to compile:"))
+ }
}
case class GroupByKey(a: Int, b: Int)
+
+case class FailedCodegenExpr(child: Expression) extends UnaryExpression with CodegenFallback {
+ private lazy val proj = FailedCodegenProjection.createObject(child :: Nil)
+ override def dataType: DataType = LongType
+ override def eval(input: InternalRow): Any = {
+ proj(input).getLong(0)
Review comment:
okay ~
----------------------------------------------------------------
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