Skip to content

Commit b49b178

Browse files
committed
support_cast_int_to_binary
1 parent af88fd9 commit b49b178

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,10 +1205,10 @@ fn cast_date_to_timestamp(
12051205

12061206
fn cast_boolean_to_decimal(array: &ArrayRef, precision: u8, scale: i8) -> SparkResult<ArrayRef> {
12071207
let bool_array = array.as_boolean();
1208-
let scale_factor = 10_i128.pow(scale as u32);
1208+
let scaled_val = 10_i128.pow(scale as u32);
12091209
let result: Decimal128Array = bool_array
12101210
.iter()
1211-
.map(|v| v.map(|b| if b { scale_factor } else { 0 }))
1211+
.map(|v| v.map(|b| if b { scaled_val } else { 0 }))
12121212
.collect();
12131213
Ok(Arc::new(result.with_precision_and_scale(precision, scale)?))
12141214
}

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

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

14491449
if (testTry) {
14501450
data.createOrReplaceTempView("t")
1451-
// try_cast() should always return null for invalid inputs
1451+
// try_cast() should always return null for invalid inputs
14521452
// not using spark DSL since it `try_cast` is only available from Spark 4x
14531453
val df2 =
14541454
spark.sql(s"select a, try_cast(a as ${toType.sql}) from t order by a")

0 commit comments

Comments
 (0)