rspears74 commented on code in PR #8562:
URL: https://github.com/apache/arrow-datafusion/pull/8562#discussion_r1430356860
##########
datafusion/proto/src/logical_plan/to_proto.rs:
##########
@@ -1159,13 +1160,105 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
}
// ScalarValue::List and ScalarValue::FixedSizeList are serialized
using
// Arrow IPC messages as a single column RecordBatch
- ScalarValue::List(arr)
- | ScalarValue::LargeList(arr)
- | ScalarValue::FixedSizeList(arr) => {
+ ScalarValue::List(arr) => {
// Wrap in a "field_name" column
let batch = RecordBatch::try_from_iter(vec![(
"field_name",
- arr.to_owned(),
+ arr.to_owned() as ArrayRef,
+ )])
+ .map_err(|e| {
+ Error::General( format!("Error creating temporary batch
while encoding ScalarValue::List: {e}"))
+ })?;
+
+ let gen = IpcDataGenerator {};
+ let mut dict_tracker = DictionaryTracker::new(false);
+ let (_, encoded_message) = gen
+ .encoded_batch(&batch, &mut dict_tracker,
&Default::default())
+ .map_err(|e| {
+ Error::General(format!(
+ "Error encoding ScalarValue::List as IPC: {e}"
+ ))
+ })?;
+
+ let schema: protobuf::Schema = batch.schema().try_into()?;
+
+ let scalar_list_value = protobuf::ScalarListValue {
+ ipc_message: encoded_message.ipc_message,
+ arrow_data: encoded_message.arrow_data,
+ schema: Some(schema),
+ };
+
+ match val {
+ ScalarValue::List(_) => Ok(protobuf::ScalarValue {
Review Comment:
Ah good catch on these!
--
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]