-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix divide-by-zero in GpuAverage with ansi mode #2130
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,7 +269,10 @@ object GpuDivModLike { | |
} | ||
|
||
trait GpuDivModLike extends CudfBinaryArithmetic { | ||
lazy val failOnError: Boolean = ShimLoader.getSparkShims.shouldFailDivByZero() | ||
val failOnErrorOverride: Option[Boolean] = None | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let us try without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can override a lazy val
But I am fine with keeping this as is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I just meant you can't use lazy as a parameter. |
||
lazy val failOnError: Boolean = | ||
failOnErrorOverride.getOrElse(ShimLoader.getSparkShims.shouldFailDivByZero()) | ||
|
||
override def nullable: Boolean = true | ||
|
||
|
@@ -330,7 +333,8 @@ object GpuDivideUtil { | |
} | ||
|
||
// This is for doubles and floats... | ||
case class GpuDivide(left: Expression, right: Expression) extends GpuDivModLike { | ||
case class GpuDivide(left: Expression, right: Expression, | ||
override val failOnErrorOverride: Option[Boolean] = None) extends GpuDivModLike { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change looks good but I was curious why we are using a different pattern to Spark which just has a plain boolean argument with a default value, rather than using an option. Was this necessary because of the way we're using the shim layer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I tried other ways but couldn't think of something cleaner. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need a 3-value logic of Option[Boolean]. I think we can do it almost like Spark. let us undo the change to DivModLike just make failOnError non- case class GpuDivide(
left: Expression, right: Expression,
override val failOnError: Boolean = ShimLoader.getSparkShims.shouldFailDivByZero()
) extends GpuDivModLike { |
||
override def inputType: AbstractDataType = TypeCollection(DoubleType, DecimalType) | ||
|
||
override def symbol: String = "/" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: best practice
Option(false)
but I think we can get away with a simple Boolean