-
Notifications
You must be signed in to change notification settings - Fork 232
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
Cast from numeric types to decimal type #1438
Conversation
Signed-off-by: sperlingxx <lovedreamf@gmail.com>
build |
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
build |
build |
@@ -372,6 +386,59 @@ case class GpuCast( | |||
case (ShortType | IntegerType | LongType | ByteType | StringType, BinaryType) => | |||
input.getBase.asByteList(true) | |||
|
|||
case (IntegerType | LongType, dt: DecimalType) => |
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.
What about byte and short which are also listed as supported for ANSI cast in the docs?
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.
Sorry this is still missing byte. Is that expected?
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/TypeChecks.scala
Outdated
Show resolved
Hide resolved
build |
build |
build |
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.
Just a few nits. Overall it looks really good
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCast.scala
Outdated
Show resolved
Hide resolved
build |
import TypeSig._ | ||
// nullChecks are the same | ||
|
||
override val booleanChecks: TypeSig = integral + fp + BOOLEAN + STRING | ||
override val sparkBooleanSig: TypeSig = numeric + BOOLEAN + STRING | ||
|
||
override val integralChecks: TypeSig = integral + fp + BOOLEAN + STRING | ||
override val integralChecks: TypeSig = numeric + BOOLEAN + TIMESTAMP + STRING + BINARY |
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.
Sorry this is a really minor nit. Spark does not support TIMESTAMP or BINARY (as you can see on the line below), so us claiming to support it is technically wrong. This should not impact the generated docs or the correctness of the code in any way.
It is also an issue for fpChecks with TIMESTAMP.
The only reason to fix it is to avoid confusion.
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.
It's been fixed. My bad :)
import TypeSig._ | ||
// nullChecks are the same | ||
|
||
override val booleanChecks: TypeSig = integral + fp + BOOLEAN + STRING | ||
override val sparkBooleanSig: TypeSig = numeric + BOOLEAN + STRING | ||
|
||
override val integralChecks: TypeSig = integral + fp + BOOLEAN + STRING | ||
override val integralChecks: TypeSig = numeric + STRING + 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.
BOOLEAN + STRING
not STRING + 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.
Fixed.
build |
3 similar comments
build |
build |
build |
Signed-off-by: sperlingxx <lovedreamf@gmail.com>
Signed-off-by: sperlingxx <lovedreamf@gmail.com>
[auto-merge] bot-auto-merge-branch-23.10 to branch-23.12 [skip ci] [bot]
This pull request is to support casting from numeric types to decimal type under GPU runtime, which is one of important feature of TPC-DS decimal support plan.
Here are limits of current implementation: