Skip to content

Commit 8b20f93

Browse files
committed
optimize hex
1 parent db49fff commit 8b20f93

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • datafusion/spark/src/function/math

datafusion/spark/src/function/math/hex.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ where
146146
T: AsRef<[u8]> + 'a,
147147
{
148148
let mut builder = StringBuilder::with_capacity(len, len * 64);
149-
let mut buffer = Vec::with_capacity(16);
149+
let mut buffer = Vec::with_capacity(64);
150150
let hex_chars = if lowercase {
151151
HEX_CHARS_LOWER
152152
} else {
@@ -177,7 +177,7 @@ fn hex_encode_int64<I>(iter: I, len: usize) -> Result<ColumnarValue, DataFusionE
177177
where
178178
I: Iterator<Item = Option<i64>>,
179179
{
180-
let mut builder = StringBuilder::with_capacity(len, len * 64);
180+
let mut builder = StringBuilder::with_capacity(len, len * 16);
181181
let mut buffer = Vec::with_capacity(16);
182182

183183
for v in iter {
@@ -248,7 +248,6 @@ pub fn compute_hex(
248248
let dict = as_dictionary_array::<Int32Type>(&array);
249249
let keys = dict.keys();
250250
let values = dict.values();
251-
// let mut buffer = Vec::with_capacity(16);
252251

253252
match **value_type {
254253
DataType::Int64 => {

0 commit comments

Comments
 (0)