Skip to content

Commit 22037f4

Browse files
author
Bhargava Vadlamani
committed
integral_types_decimal_cast_native_support
1 parent 95e4df0 commit 22037f4

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

docs/source/user-guide/latest/compatibility.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ The following cast operations are generally compatible with Spark except for the
173173
| integer | long | |
174174
| integer | float | |
175175
| integer | double | |
176+
| integer | decimal | |
176177
| integer | string | |
177178
| long | boolean | |
178179
| long | byte | |
@@ -227,7 +228,6 @@ The following cast operations are not compatible with Spark for all inputs and a
227228
<!--BEGIN:INCOMPAT_CAST_TABLE-->
228229
| From Type | To Type | Notes |
229230
|-|-|-|
230-
| integer | decimal | No overflow check |
231231
| float | decimal | There can be rounding differences |
232232
| double | decimal | There can be rounding differences |
233233
| string | float | Does not support inputs ending with 'd' or 'f'. Does not support 'inf'. Does not support ANSI mode. |

spark/src/main/scala/org/apache/comet/expressions/CometCast.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ object CometCast extends CometExpressionSerde[Cast] with CometExprShim {
284284
case DataTypes.FloatType | DataTypes.DoubleType =>
285285
Compatible()
286286
case _: DecimalType =>
287-
Incompatible(Some("No overflow check"))
287+
Compatible()
288288
case _ =>
289289
unsupported(DataTypes.IntegerType, toType)
290290
}

spark/src/test/scala/org/apache/comet/CometCastSuite.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
322322
castTest(generateInts(), DataTypes.DoubleType)
323323
}
324324

325-
ignore("cast IntegerType to DecimalType(10,2)") {
326-
// Comet should have failed with [NUMERIC_VALUE_OUT_OF_RANGE] -1117686336 cannot be represented as Decimal(10, 2)
325+
test("cast IntegerType to DecimalType(10,2)") {
327326
castTest(generateInts(), DataTypes.createDecimalType(10, 2))
328327
}
329328

0 commit comments

Comments
 (0)