Skip to content

Commit de1618a

Browse files
committed
fix_issue
1 parent 61987e1 commit de1618a

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

native/spark-expr/src/conversion_funcs/cast.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,11 +2354,6 @@ fn parse_string_to_decimal(s: &str, precision: u8, scale: i8) -> SparkResult<Opt
23542354
&format!("DECIMAL({},{})", precision, scale),
23552355
)?;
23562356

2357-
// return early when mantissa is 0
2358-
if mantissa == 0 {
2359-
return Ok(Some(0));
2360-
}
2361-
23622357
// scale adjustment
23632358
let target_scale = scale as i32;
23642359
let scale_adjustment = target_scale - exponent;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
737737

738738
test("cast StringType to DecimalType(38,10) high precision - check 0 mantissa") {
739739
withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) -> "true") {
740-
val values = Seq("0e31").toDF("a")
740+
val values = Seq("0e31", "000e3375", "0e5887677", "0e40").toDF("a")
741741
Seq(true, false).foreach(ansiEnabled =>
742742
castTest(values, DataTypes.createDecimalType(38, 10), testAnsi = ansiEnabled))
743743
}

0 commit comments

Comments
 (0)