peter-toth commented on code in PR #9876:
URL: https://github.com/apache/arrow-datafusion/pull/9876#discussion_r1550187618


##########
datafusion/common/src/tree_node.rs:
##########
@@ -551,22 +551,48 @@ impl<I: Iterator> TransformedIterator for I {
     ) -> Result<Transformed<Vec<Self::Item>>> {
         let mut tnr = TreeNodeRecursion::Continue;
         let mut transformed = false;
-        let data = self
-            .map(|item| match tnr {
-                TreeNodeRecursion::Continue | TreeNodeRecursion::Jump => {
-                    f(item).map(|result| {
-                        tnr = result.tnr;
-                        transformed |= result.transformed;
-                        result.data
-                    })
-                }
-                TreeNodeRecursion::Stop => Ok(item),
-            })
-            .collect::<Result<Vec<_>>>()?;
-        Ok(Transformed::new(data, transformed, tnr))
+        self.map(|item| match tnr {
+            TreeNodeRecursion::Continue | TreeNodeRecursion::Jump => {
+                f(item).map(|result| {
+                    tnr = result.tnr;
+                    transformed |= result.transformed;
+                    result.data
+                })
+            }
+            TreeNodeRecursion::Stop => Ok(item),
+        })
+        .collect::<Result<Vec<_>>>()
+        .map(|data| Transformed::new(data, transformed, tnr))
     }
 }
 
+/// Transformation helper to process sequence of tree node containing 
expressions.
+/// This macro is very similar to 
[TransformedIterator::map_until_stop_and_collect] to
+/// process nodes that are siblings, but it accepts an initial transformation 
and a
+/// sequence of pairs of an expression and its transformation.

Review Comment:
   Renamed in 
https://github.com/apache/arrow-datafusion/pull/9876/commits/a36f1aa02dd0652d9e514ba865a1f58db0d4f233
 and added rustdoc to the macro. Let me know if it needs more details.



-- 
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]

Reply via email to