alamb commented on a change in pull request #1091:
URL: https://github.com/apache/arrow-datafusion/pull/1091#discussion_r725639149
##########
File path: datafusion/src/scalar.rs
##########
@@ -1171,6 +1277,20 @@ impl FromStr for ScalarValue {
}
}
+impl From<Vec<(&str, ScalarValue)>> for ScalarValue {
+ fn from(value: Vec<(&str, ScalarValue)>) -> Self {
+ let mut fields: Vec<Field> = Vec::new();
+ let mut scalars: Vec<ScalarValue> = Vec::new();
+
+ value.iter().for_each(|(name, scalar)| {
+ fields.push(Field::new(name, scalar.get_datatype(), false));
+ scalars.push(scalar.clone());
+ });
Review comment:
to be clear I don't think this is needed, I just wanted to point it out
-- it took me quite a while to get comfortable with the functional parts of
rust -- at first I thought it was just style preference, but then the longer I
work in rust I realize it is one of the key mechanisms rust uses to eliminate
bounds checks during iteration
--
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]