Skip to content

Commit 955f739

Browse files
committed
mark compactable
1 parent 9a5eb69 commit 955f739

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

docs/source/user-guide/compatibility.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,15 @@ The following cast operations are generally compatible with Spark except for the
174174
| float | integer | |
175175
| float | long | |
176176
| float | double | |
177+
| float | decimal | |
177178
| float | string | There can be differences in precision. For example, the input "1.4E-45" will produce 1.0E-45 instead of 1.4E-45 |
178179
| double | boolean | |
179180
| double | byte | |
180181
| double | short | |
181182
| double | integer | |
182183
| double | long | |
183184
| double | float | |
185+
| double | decimal | |
184186
| double | string | There can be differences in precision. For example, the input "1.4E-45" will produce 1.0E-45 instead of 1.4E-45 |
185187
| decimal | byte | |
186188
| decimal | short | |
@@ -210,8 +212,6 @@ The following cast operations are not compatible with Spark for all inputs and a
210212
|-|-|-|
211213
| integer | decimal | No overflow check |
212214
| long | decimal | No overflow check |
213-
| float | decimal | There can be rounding differences |
214-
| double | decimal | There can be rounding differences |
215215
| string | float | Does not support inputs ending with 'd' or 'f'. Does not support 'inf'. Does not support ANSI mode. |
216216
| string | double | Does not support inputs ending with 'd' or 'f'. Does not support 'inf'. Does not support ANSI mode. |
217217
| string | decimal | Does not support inputs ending with 'd' or 'f'. Does not support 'inf'. Does not support ANSI mode. Returns 0.0 instead of null if input contains no digits |

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,19 +262,15 @@ object CometCast {
262262
case DataTypes.BooleanType | DataTypes.DoubleType | DataTypes.ByteType | DataTypes.ShortType |
263263
DataTypes.IntegerType | DataTypes.LongType =>
264264
Compatible()
265-
case _: DecimalType =>
266-
// https://github.com/apache/datafusion-comet/issues/1371
267-
Incompatible(Some("There can be rounding differences"))
265+
case _: DecimalType => Compatible()
268266
case _ => Unsupported
269267
}
270268

271269
private def canCastFromDouble(toType: DataType): SupportLevel = toType match {
272270
case DataTypes.BooleanType | DataTypes.FloatType | DataTypes.ByteType | DataTypes.ShortType |
273271
DataTypes.IntegerType | DataTypes.LongType =>
274272
Compatible()
275-
case _: DecimalType =>
276-
// https://github.com/apache/datafusion-comet/issues/1371
277-
Incompatible(Some("There can be rounding differences"))
273+
case _: DecimalType => Compatible()
278274
case _ => Unsupported
279275
}
280276

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -411,17 +411,10 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
411411
castTest(generateFloats(), DataTypes.DoubleType)
412412
}
413413

414-
ignore("cast FloatType to DecimalType(10,2)") {
415-
// // https://github.com/apache/datafusion-comet/issues/1371
414+
test("cast FloatType to DecimalType(10,2)") {
416415
castTest(generateFloats(), DataTypes.createDecimalType(10, 2))
417416
}
418417

419-
test("cast FloatType to DecimalType(10,2) - allow incompat") {
420-
withSQLConf(CometConf.COMET_CAST_ALLOW_INCOMPATIBLE.key -> "true") {
421-
castTest(generateFloats(), DataTypes.createDecimalType(10, 2))
422-
}
423-
}
424-
425418
test("cast FloatType to StringType") {
426419
// https://github.com/apache/datafusion-comet/issues/312
427420
val r = new Random(0)
@@ -471,17 +464,10 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
471464
castTest(generateDoubles(), DataTypes.FloatType)
472465
}
473466

474-
ignore("cast DoubleType to DecimalType(10,2)") {
475-
// https://github.com/apache/datafusion-comet/issues/1371
467+
test("cast DoubleType to DecimalType(10,2)") {
476468
castTest(generateDoubles(), DataTypes.createDecimalType(10, 2))
477469
}
478470

479-
test("cast DoubleType to DecimalType(10,2) - allow incompat") {
480-
withSQLConf(CometConf.COMET_CAST_ALLOW_INCOMPATIBLE.key -> "true") {
481-
castTest(generateDoubles(), DataTypes.createDecimalType(10, 2))
482-
}
483-
}
484-
485471
test("cast DoubleType to StringType") {
486472
// https://github.com/apache/datafusion-comet/issues/312
487473
val r = new Random(0)

0 commit comments

Comments
 (0)