From c280c7f529e2766dd7dd45270bde340c28b9d74b Mon Sep 17 00:00:00 2001 From: Yuming Wang Date: Sat, 15 Aug 2020 12:31:32 -0700 Subject: [PATCH] [SPARK-32625][SQL] Log error message when falling back to interpreter mode ### What changes were proposed in this pull request? This pr log the error message when falling back to interpreter mode. ### Why are the changes needed? Not all error messages are in `CodeGenerator`, such as: ``` 21:48:44.612 WARN org.apache.spark.sql.catalyst.expressions.Predicate: Expr codegen error and falling back to interpreter mode java.lang.IllegalArgumentException: Can not interpolate org.apache.spark.sql.types.Decimal into code block. at org.apache.spark.sql.catalyst.expressions.codegen.Block$BlockHelper$.$anonfun$code$1(javaCode.scala:240) at org.apache.spark.sql.catalyst.expressions.codegen.Block$BlockHelper$.$anonfun$code$1$adapted(javaCode.scala:236) at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36) at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33) ``` ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Manual test. Closes #29440 from wangyum/SPARK-32625. Authored-by: Yuming Wang Signed-off-by: Dongjoon Hyun --- .../expressions/CodeGeneratorWithInterpretedFallback.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/CodeGeneratorWithInterpretedFallback.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/CodeGeneratorWithInterpretedFallback.scala index 07fa813a98922..3b7219477bd69 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/CodeGeneratorWithInterpretedFallback.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/CodeGeneratorWithInterpretedFallback.scala @@ -51,9 +51,8 @@ abstract class CodeGeneratorWithInterpretedFallback[IN, OUT] extends Logging { try { createCodeGeneratedObject(in) } catch { - case NonFatal(_) => - // We should have already seen the error message in `CodeGenerator` - logWarning("Expr codegen error and falling back to interpreter mode") + case NonFatal(e) => + logWarning("Expr codegen error and falling back to interpreter mode", e) createInterpretedObject(in) } }