Skip to content

Commit

Permalink
Catch UDF compiler exceptions and fallback to CPU (#3454)
Browse files Browse the repository at this point in the history
* Catch UDF compiler exceptions and fallback to CPU

Signed-off-by: Jason Lowe <[email protected]>

* Use NonFatal
  • Loading branch information
jlowe authored Sep 16, 2021
1 parent 259bc7a commit ccf2f43
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.nvidia.spark.udf

import scala.util.control.NonFatal

import com.nvidia.spark.rapids.shims.v2.ShimExpression

import org.apache.spark.SparkException
Expand Down Expand Up @@ -50,11 +52,16 @@ case class GpuScalaUDFLogical(udf: ScalaUDF) extends ShimExpression with Logging
}
} catch {
case e: SparkException =>
logDebug("UDF compilation failure: " + e)
val udfName = udf.udfName.getOrElse("<unknown>")
logDebug(s"UDF $udfName compilation failure: $e")
if (isTestEnabled) {
throw e
}
udf
case NonFatal(e) =>
val udfName = udf.udfName.getOrElse("<unknown>")
logWarning(s"Unable to translate UDF $udfName: $e")
udf
}
}
}

0 comments on commit ccf2f43

Please sign in to comment.