comphead commented on code in PR #2436:
URL: https://github.com/apache/datafusion-comet/pull/2436#discussion_r2376621301


##########
native/spark-expr/src/static_invoke/char_varchar_utils/read_side_padding.rs:
##########
@@ -60,12 +62,57 @@ fn spark_read_side_padding2(
                             dict.values(),
                             truncate,
                             
ColumnarValue::Scalar(ScalarValue::Int32(Some(*length))),
+                            " ",
                         )?
                     } else {
                         spark_read_side_padding_internal::<i64>(
                             dict.values(),
                             truncate,
                             
ColumnarValue::Scalar(ScalarValue::Int32(Some(*length))),
+                            " ",
+                        )?
+                    };
+                    // col consists of an array, so arg of to_array() is not 
used. Can be anything
+                    let values = col.to_array(0)?;
+                    let result = DictionaryArray::try_new(dict.keys().clone(), 
values)?;
+                    Ok(ColumnarValue::Array(make_array(result.into())))
+                }
+                other => Err(DataFusionError::Internal(format!(
+                    "Unsupported data type {other:?} for function 
rpad/read_side_padding",
+                ))),
+            }
+        }
+        [ColumnarValue::Array(array), 
ColumnarValue::Scalar(ScalarValue::Int32(Some(length))), 
ColumnarValue::Scalar(ScalarValue::Utf8(Some(string)))] =>
+        {
+            match array.data_type() {
+                DataType::Utf8 => spark_read_side_padding_internal::<i32>(
+                    array,
+                    truncate,
+                    ColumnarValue::Scalar(ScalarValue::Int32(Some(*length))),
+                    string,
+                ),
+                DataType::LargeUtf8 => spark_read_side_padding_internal::<i64>(
+                    array,
+                    truncate,
+                    ColumnarValue::Scalar(ScalarValue::Int32(Some(*length))),
+                    string,
+                ),
+                // Dictionary support required for SPARK-48498
+                DataType::Dictionary(_, value_type) => {
+                    let dict = as_dictionary_array::<Int32Type>(array);
+                    let col = if value_type.as_ref() == &DataType::Utf8 {
+                        spark_read_side_padding_internal::<i32>(
+                            dict.values(),
+                            truncate,
+                            
ColumnarValue::Scalar(ScalarValue::Int32(Some(*length))),
+                            " ",

Review Comment:
   please have it as the constant



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to