From 7b86d4ffe7d133ad9972e369f6ab8a83984e8ad7 Mon Sep 17 00:00:00 2001 From: Haoyang Li Date: Fri, 5 Jan 2024 12:18:27 +0800 Subject: [PATCH 1/2] Update string to float compatibility doc[skip ci] Signed-off-by: Haoyang Li --- docs/compatibility.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/compatibility.md b/docs/compatibility.md index 2a950f9069e..0cdbac8fd47 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -722,14 +722,11 @@ This configuration is enabled by default. To disable this operation on the GPU s ### String to Float -Casting from string to floating-point types on the GPU returns incorrect results when the string -represents any number in the following ranges. In both cases the GPU returns `Double.MaxValue`. The -default behavior in Apache Spark is to return `+Infinity` and `-Infinity`, respectively. +Casting from string to double on the GPU could sometimes return incorrect results if the string +contains high precision values. In Apache Spark, the values are rounded to the nearest double, +whereas the Rapids accelerator truncates the values directly. -- `1.7976931348623158E308 <= x < 1.7976931348623159E308` -- `-1.7976931348623159E308 < x <= -1.7976931348623158E308` - -Also, the GPU does not support casting from strings containing hex values. +Also, the GPU does not support casting from strings containing hex values to floating-point types. This configuration is enabled by default. To disable this operation on the GPU set [`spark.rapids.sql.castStringToFloat.enabled`](additional-functionality/advanced_configs.md#sql.castStringToFloat.enabled) to `false`. From d89935dcc11b0df8f2f973551708dd77ad98abe9 Mon Sep 17 00:00:00 2001 From: Haoyang Li Date: Tue, 9 Jan 2024 10:19:40 +0800 Subject: [PATCH 2/2] Address comment Signed-off-by: Haoyang Li --- docs/compatibility.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/compatibility.md b/docs/compatibility.md index 0cdbac8fd47..ad7146bf5ff 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -722,9 +722,16 @@ This configuration is enabled by default. To disable this operation on the GPU s ### String to Float -Casting from string to double on the GPU could sometimes return incorrect results if the string -contains high precision values. In Apache Spark, the values are rounded to the nearest double, -whereas the Rapids accelerator truncates the values directly. +Casting from string to double on the GPU returns incorrect results when the string represents any +number in the following ranges. In both cases the GPU returns `Double.MaxValue`. The default behavior +in Apache Spark is to return `+Infinity` and `-Infinity`, respectively. + +- `1.7976931348623158E308 <= x < 1.7976931348623159E308` +- `-1.7976931348623159E308 < x <= -1.7976931348623158E308` + +Casting from string to double on the GPU could also sometimes return incorrect results if the string +contains high precision values. Apache Spark rounds the values to the nearest double, while the GPU +truncates the values directly. Also, the GPU does not support casting from strings containing hex values to floating-point types.