Github user jaceklaskowski commented on a diff in the pull request:
https://github.com/apache/spark/pull/22154#discussion_r234177079
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CodeGeneratorWithInterpretedFallbackSuite.scala
---
@@ -17,17 +17,33 @@
package org.apache.spark.sql.catalyst.expressions
+import java.util.concurrent.ExecutionException
+
import org.apache.spark.SparkFunSuite
+import org.apache.spark.sql.catalyst.expressions.codegen.{CodeAndComment,
CodeGenerator}
import org.apache.spark.sql.catalyst.plans.PlanTestBase
import org.apache.spark.sql.internal.SQLConf
-import org.apache.spark.sql.types.{IntegerType, LongType}
+import org.apache.spark.sql.types.IntegerType
class CodeGeneratorWithInterpretedFallbackSuite extends SparkFunSuite with
PlanTestBase {
- test("UnsafeProjection with codegen factory mode") {
- val input = Seq(LongType, IntegerType)
- .zipWithIndex.map(x => BoundReference(x._2, x._1, true))
+ object FailedCodegenProjection
+ extends CodeGeneratorWithInterpretedFallback[Seq[Expression],
UnsafeProjection] {
+
+ override protected def createCodeGeneratedObject(in: Seq[Expression]):
UnsafeProjection = {
+ val invalidCode = new CodeAndComment("invalid code", Map.empty)
+ // We assume this compilation throws an exception
--- End diff --
I'd use this comment as part of an exception (say `IllegalStateException`
or similar) that should be thrown rather than returning `null`. I think that
would make the comment part of the code itself and can be checked in tests (by
catching the exception).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]