alamb commented on code in PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#discussion_r923371084
##########
datafusion/proto/src/to_proto.rs:
##########
@@ -835,109 +835,127 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
Value::LargeUtf8Value(s.to_owned())
})
}
- scalar::ScalarValue::List(value, datatype) => {
- println!("Current datatype of list: {:?}", datatype);
+ scalar::ScalarValue::List(value, boxed_field) => {
+ println!("Current field of list: {:?}", boxed_field);
match value {
Some(values) => {
if values.is_empty() {
protobuf::ScalarValue {
value:
Some(protobuf::scalar_value::Value::ListValue(
protobuf::ScalarListValue {
- datatype:
Some(datatype.as_ref().try_into()?),
+ field:
Some(boxed_field.as_ref().into()),
values: Vec::new(),
},
)),
}
} else {
- let scalar_type = match datatype.as_ref() {
+ let scalar_type = match boxed_field.data_type() {
DataType::List(field) =>
field.as_ref().data_type(),
- _ => todo!("Proper error handling"),
+ unsupported => {
+ todo!("Proper error handling {}",
unsupported)
+ }
};
println!("Current scalar type for list: {:?}",
scalar_type);
+
let type_checked_values:
Vec<protobuf::ScalarValue> = values
.iter()
- .map(|scalar| match (scalar, scalar_type) {
- (
- scalar::ScalarValue::List(_,
list_type),
- DataType::List(field),
- ) => {
- if let DataType::List(list_field) =
- list_type.as_ref()
- {
- let scalar_datatype =
field.data_type();
- let list_datatype =
list_field.data_type();
- if
std::mem::discriminant(list_datatype)
- !=
std::mem::discriminant(scalar_datatype)
+ .map(|scalar| {
+ dbg!(scalar);
Review Comment:
```suggestion
```
##########
datafusion/proto/src/to_proto.rs:
##########
@@ -835,109 +835,127 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
Value::LargeUtf8Value(s.to_owned())
})
}
- scalar::ScalarValue::List(value, datatype) => {
- println!("Current datatype of list: {:?}", datatype);
+ scalar::ScalarValue::List(value, boxed_field) => {
+ println!("Current field of list: {:?}", boxed_field);
match value {
Some(values) => {
if values.is_empty() {
protobuf::ScalarValue {
value:
Some(protobuf::scalar_value::Value::ListValue(
protobuf::ScalarListValue {
- datatype:
Some(datatype.as_ref().try_into()?),
+ field:
Some(boxed_field.as_ref().into()),
values: Vec::new(),
},
)),
}
} else {
- let scalar_type = match datatype.as_ref() {
+ let scalar_type = match boxed_field.data_type() {
DataType::List(field) =>
field.as_ref().data_type(),
- _ => todo!("Proper error handling"),
+ unsupported => {
+ todo!("Proper error handling {}",
unsupported)
+ }
};
println!("Current scalar type for list: {:?}",
scalar_type);
+
let type_checked_values:
Vec<protobuf::ScalarValue> = values
.iter()
- .map(|scalar| match (scalar, scalar_type) {
- (
- scalar::ScalarValue::List(_,
list_type),
- DataType::List(field),
- ) => {
- if let DataType::List(list_field) =
- list_type.as_ref()
- {
- let scalar_datatype =
field.data_type();
- let list_datatype =
list_field.data_type();
- if
std::mem::discriminant(list_datatype)
- !=
std::mem::discriminant(scalar_datatype)
+ .map(|scalar| {
+ dbg!(scalar);
+ match (scalar, scalar_type) {
+ (
+ scalar::ScalarValue::List(_,
list_type),
+ DataType::List(field),
+ ) => {
+ dbg!(list_type);
Review Comment:
```suggestion
```
--
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]