Skip to content

Commit 619f368

Browse files
kazantsev-maksimKazantsev Maksim
andauthored
chore: use datafusion impl of hex function (apache#2915)
* impl map_from_entries * Use datafusion impl of hex function * Revert "impl map_from_entries" This reverts commit 768b3e9. --------- Co-authored-by: Kazantsev Maksim <[email protected]>
1 parent 5ec12d4 commit 619f368

File tree

5 files changed

+6
-301
lines changed

5 files changed

+6
-301
lines changed

native/core/src/execution/jni_api.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ use datafusion_spark::function::datetime::date_sub::SparkDateSub;
4747
use datafusion_spark::function::hash::sha1::SparkSha1;
4848
use datafusion_spark::function::hash::sha2::SparkSha2;
4949
use datafusion_spark::function::math::expm1::SparkExpm1;
50+
use datafusion_spark::function::math::hex::SparkHex;
5051
use datafusion_spark::function::string::char::CharFunc;
5152
use datafusion_spark::function::string::concat::SparkConcat;
5253
use futures::poll;
@@ -337,6 +338,7 @@ fn register_datafusion_spark_function(session_ctx: &SessionContext) {
337338
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkSha1::default()));
338339
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkConcat::default()));
339340
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkBitwiseNot::default()));
341+
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkHex::default()));
340342
}
341343

342344
/// Prepares arrow arrays for output.

native/spark-expr/src/comet_scalar_funcs.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use crate::math_funcs::checked_arithmetic::{checked_add, checked_div, checked_mu
2121
use crate::math_funcs::modulo_expr::spark_modulo;
2222
use crate::{
2323
spark_array_repeat, spark_ceil, spark_decimal_div, spark_decimal_integral_div, spark_floor,
24-
spark_hex, spark_isnan, spark_lpad, spark_make_decimal, spark_read_side_padding, spark_round,
25-
spark_rpad, spark_unhex, spark_unscaled_value, EvalMode, SparkBitwiseCount, SparkDateTrunc,
24+
spark_isnan, spark_lpad, spark_make_decimal, spark_read_side_padding, spark_round, spark_rpad,
25+
spark_unhex, spark_unscaled_value, EvalMode, SparkBitwiseCount, SparkDateTrunc,
2626
SparkStringSpace,
2727
};
2828
use arrow::datatypes::DataType;
@@ -130,10 +130,6 @@ pub fn create_comet_physical_fun_with_eval_mode(
130130
"make_decimal" => {
131131
make_comet_scalar_udf!("make_decimal", spark_make_decimal, data_type)
132132
}
133-
"hex" => {
134-
let func = Arc::new(spark_hex);
135-
make_comet_scalar_udf!("hex", func, without data_type)
136-
}
137133
"unhex" => {
138134
let func = Arc::new(spark_unhex);
139135
make_comet_scalar_udf!("unhex", func, without data_type)

native/spark-expr/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ pub use hash_funcs::*;
7474
pub use json_funcs::ToJson;
7575
pub use math_funcs::{
7676
create_modulo_expr, create_negate_expr, spark_ceil, spark_decimal_div,
77-
spark_decimal_integral_div, spark_floor, spark_hex, spark_make_decimal, spark_round,
78-
spark_unhex, spark_unscaled_value, CheckOverflow, NegativeExpr, NormalizeNaNAndZero,
77+
spark_decimal_integral_div, spark_floor, spark_make_decimal, spark_round, spark_unhex,
78+
spark_unscaled_value, CheckOverflow, NegativeExpr, NormalizeNaNAndZero,
7979
};
8080
pub use string_funcs::*;
8181

native/spark-expr/src/math_funcs/hex.rs

Lines changed: 0 additions & 291 deletions
This file was deleted.

native/spark-expr/src/math_funcs/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ mod ceil;
2020
pub(crate) mod checked_arithmetic;
2121
mod div;
2222
mod floor;
23-
pub(crate) mod hex;
2423
pub mod internal;
2524
pub mod modulo_expr;
2625
mod negative;
@@ -32,7 +31,6 @@ pub use ceil::spark_ceil;
3231
pub use div::spark_decimal_div;
3332
pub use div::spark_decimal_integral_div;
3433
pub use floor::spark_floor;
35-
pub use hex::spark_hex;
3634
pub use internal::*;
3735
pub use modulo_expr::create_modulo_expr;
3836
pub use negative::{create_negate_expr, NegativeExpr};

0 commit comments

Comments
 (0)