datafusion_spark/function/bitwise/
mod.rs1pub mod bit_count;
19pub mod bit_get;
20pub mod bit_shift;
21pub mod bitwise_not;
22
23use datafusion_expr::ScalarUDF;
24use datafusion_functions::make_udf_function;
25use std::sync::Arc;
26
27make_udf_function!(bit_shift::SparkShiftLeft, shiftleft);
28make_udf_function!(bit_shift::SparkShiftRight, shiftright);
29make_udf_function!(bit_shift::SparkShiftRightUnsigned, shiftrightunsigned);
30make_udf_function!(bit_get::SparkBitGet, bit_get);
31make_udf_function!(bit_count::SparkBitCount, bit_count);
32make_udf_function!(bitwise_not::SparkBitwiseNot, bitwise_not);
33
34pub mod expr_fn {
35 use datafusion_functions::export_functions;
36
37 export_functions!((bit_get, "Returns the value of the bit (0 or 1) at the specified position.", col pos));
38 export_functions!((
39 bit_count,
40 "Returns the number of bits set in the binary representation of the argument.",
41 col
42 ));
43 export_functions!((
44 bitwise_not,
45 "Returns the result of a bitwise negation operation on the argument, where each bit in the binary representation is flipped, following two's complement arithmetic for signed integers.",
46 col
47 ));
48 export_functions!((
49 shiftleft,
50 "Shifts the bits of the first argument left by the number of positions specified by the second argument. If the shift amount is negative or greater than or equal to the bit width, it is normalized to the bit width (i.e., pmod(shift, bit_width)).",
51 value shift
52 ));
53 export_functions!((
54 shiftright,
55 "Shifts the bits of the first argument right by the number of positions specified by the second argument (arithmetic/signed shift). If the shift amount is negative or greater than or equal to the bit width, it is normalized to the bit width (i.e., pmod(shift, bit_width)).",
56 value shift
57 ));
58 export_functions!((
59 shiftrightunsigned,
60 "Shifts the bits of the first argument right by the number of positions specified by the second argument (logical/unsigned shift). If the shift amount is negative or greater than or equal to the bit width, it is normalized to the bit width (i.e., pmod(shift, bit_width)).",
61 value shift
62 ));
63}
64
65pub fn functions() -> Vec<Arc<ScalarUDF>> {
66 vec![
67 bit_get(),
68 bit_count(),
69 bitwise_not(),
70 shiftleft(),
71 shiftright(),
72 shiftrightunsigned(),
73 ]
74}