Skip to content
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

Enable config to check for casting decimals to strings #4163

Merged
merged 2 commits into from
Nov 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,16 @@ final class CastExprMeta[INPUT <: CastBase](
case (FloatType | DoubleType, ByteType | ShortType | IntegerType | LongType) if
doFloatToIntCheck && !conf.isCastFloatToIntegralTypesEnabled =>
willNotWorkOnGpu(buildTagMessage(RapidsConf.ENABLE_CAST_FLOAT_TO_INTEGRAL_TYPES))
case (dt: DecimalType, _: StringType) if dt.precision > DType.DECIMAL64_MAX_PRECISION =>
willNotWorkOnGpu(s"decimal to string with a " +
s"precision > ${DType.DECIMAL64_MAX_PRECISION} is not supported yet")
case (dt: DecimalType, _: StringType) =>
if (!conf.isCastDecimalToStringEnabled) {
willNotWorkOnGpu("the GPU does not produce the exact same string as Spark produces, " +
s"set ${RapidsConf.ENABLE_CAST_DECIMAL_TO_STRING} to true if semantically " +
s"equivalent decimal strings are sufficient for your application.")
}
if (dt.precision > DType.DECIMAL64_MAX_PRECISION) {
willNotWorkOnGpu(s"decimal to string with a " +
s"precision > ${DType.DECIMAL64_MAX_PRECISION} is not supported yet")
}
case ( _: DecimalType, _: FloatType | _: DoubleType) if !conf.isCastDecimalToFloatEnabled =>
willNotWorkOnGpu("the GPU will use a different strategy from Java's BigDecimal " +
"to convert decimal data types to floating point and this can produce results that " +
Expand Down