Skip to content

Commit

Permalink
make test conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
buraksenn committed Dec 15, 2024
1 parent 9508f4f commit c352f8a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 47 deletions.
4 changes: 2 additions & 2 deletions datafusion-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 46 additions & 45 deletions datafusion/common/src/tree_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub trait TreeNode: Sized {
/// TreeNodeVisitor::f_up(ParentNode)
/// ```
#[cfg_attr(feature = "recursive-protection", recursive::recursive)]
fn visit<'n, V: TreeNodeVisitor<'n, Node = Self>>(
fn visit<'n, V: TreeNodeVisitor<'n, Node=Self>>(
&'n self,
visitor: &mut V,
) -> Result<TreeNodeRecursion> {
Expand Down Expand Up @@ -175,7 +175,7 @@ pub trait TreeNode: Sized {
/// TreeNodeRewriter::f_up(ParentNode)
/// ```
#[cfg_attr(feature = "recursive-protection", recursive::recursive)]
fn rewrite<R: TreeNodeRewriter<Node = Self>>(
fn rewrite<R: TreeNodeRewriter<Node=Self>>(
self,
rewriter: &mut R,
) -> Result<Transformed<Self>> {
Expand Down Expand Up @@ -404,7 +404,7 @@ pub trait TreeNode: Sized {
TreeNodeRecursion::Continue
})
})
.map(|_| found)
.map(|_| found)
}

/// Low-level API used to implement other APIs.
Expand Down Expand Up @@ -884,7 +884,7 @@ impl<'a, T: 'a, C: TreeNodeContainer<'a, T>> TreeNodeContainer<'a, T> for Vec<C>
}

impl<'a, T: 'a, K: Eq + Hash, C: TreeNodeContainer<'a, T>> TreeNodeContainer<'a, T>
for HashMap<K, C>
for HashMap<K, C>
{
fn apply_elements<F: FnMut(&'a T) -> Result<TreeNodeRecursion>>(
&'a self,
Expand Down Expand Up @@ -924,7 +924,7 @@ impl<'a, T: 'a, K: Eq + Hash, C: TreeNodeContainer<'a, T>> TreeNodeContainer<'a,
}

impl<'a, T: 'a, C0: TreeNodeContainer<'a, T>, C1: TreeNodeContainer<'a, T>>
TreeNodeContainer<'a, T> for (C0, C1)
TreeNodeContainer<'a, T> for (C0, C1)
{
fn apply_elements<F: FnMut(&'a T) -> Result<TreeNodeRecursion>>(
&'a self,
Expand All @@ -950,12 +950,12 @@ impl<'a, T: 'a, C0: TreeNodeContainer<'a, T>, C1: TreeNodeContainer<'a, T>>
}

impl<
'a,
T: 'a,
C0: TreeNodeContainer<'a, T>,
C1: TreeNodeContainer<'a, T>,
C2: TreeNodeContainer<'a, T>,
> TreeNodeContainer<'a, T> for (C0, C1, C2)
'a,
T: 'a,
C0: TreeNodeContainer<'a, T>,
C1: TreeNodeContainer<'a, T>,
C2: TreeNodeContainer<'a, T>,
> TreeNodeContainer<'a, T> for (C0, C1, C2)
{
fn apply_elements<F: FnMut(&'a T) -> Result<TreeNodeRecursion>>(
&'a self,
Expand Down Expand Up @@ -1029,7 +1029,7 @@ impl<'a, T: 'a, C: TreeNodeContainer<'a, T>> TreeNodeRefContainer<'a, T> for Vec
}

impl<'a, T: 'a, C0: TreeNodeContainer<'a, T>, C1: TreeNodeContainer<'a, T>>
TreeNodeRefContainer<'a, T> for (&'a C0, &'a C1)
TreeNodeRefContainer<'a, T> for (&'a C0, &'a C1)
{
fn apply_ref_elements<F: FnMut(&'a T) -> Result<TreeNodeRecursion>>(
&self,
Expand All @@ -1042,12 +1042,12 @@ impl<'a, T: 'a, C0: TreeNodeContainer<'a, T>, C1: TreeNodeContainer<'a, T>>
}

impl<
'a,
T: 'a,
C0: TreeNodeContainer<'a, T>,
C1: TreeNodeContainer<'a, T>,
C2: TreeNodeContainer<'a, T>,
> TreeNodeRefContainer<'a, T> for (&'a C0, &'a C1, &'a C2)
'a,
T: 'a,
C0: TreeNodeContainer<'a, T>,
C1: TreeNodeContainer<'a, T>,
C2: TreeNodeContainer<'a, T>,
> TreeNodeRefContainer<'a, T> for (&'a C0, &'a C1, &'a C2)
{
fn apply_ref_elements<F: FnMut(&'a T) -> Result<TreeNodeRecursion>>(
&self,
Expand Down Expand Up @@ -1129,8 +1129,8 @@ impl<I: Iterator> TreeNodeIterator for I {
}
TreeNodeRecursion::Stop => Ok(item),
})
.collect::<Result<Vec<_>>>()
.map(|data| Transformed::new(data, transformed, tnr))
.collect::<Result<Vec<_>>>()
.map(|data| Transformed::new(data, transformed, tnr))
}
}

Expand Down Expand Up @@ -1385,9 +1385,9 @@ pub(crate) mod tests {
"f_up(i)",
"f_up(j)",
]
.into_iter()
.map(|s| s.to_string())
.collect()
.into_iter()
.map(|s| s.to_string())
.collect()
}

// Expected transformed tree after a combined traversal
Expand Down Expand Up @@ -1458,9 +1458,9 @@ pub(crate) mod tests {
"f_up(i)",
"f_up(j)",
]
.into_iter()
.map(|s| s.to_string())
.collect()
.into_iter()
.map(|s| s.to_string())
.collect()
}

fn f_down_jump_on_a_transformed_down_tree() -> TestTreeNode<String> {
Expand Down Expand Up @@ -1492,9 +1492,9 @@ pub(crate) mod tests {
"f_up(i)",
"f_up(j)",
]
.into_iter()
.map(|s| s.to_string())
.collect()
.into_iter()
.map(|s| s.to_string())
.collect()
}

fn f_down_jump_on_e_transformed_tree() -> TestTreeNode<String> {
Expand Down Expand Up @@ -1545,9 +1545,9 @@ pub(crate) mod tests {
"f_up(i)",
"f_up(j)",
]
.into_iter()
.map(|s| s.to_string())
.collect()
.into_iter()
.map(|s| s.to_string())
.collect()
}

fn f_up_jump_on_a_transformed_tree() -> TestTreeNode<String> {
Expand Down Expand Up @@ -1601,9 +1601,9 @@ pub(crate) mod tests {
"f_up(i)",
"f_up(j)",
]
.into_iter()
.map(|s| s.to_string())
.collect()
.into_iter()
.map(|s| s.to_string())
.collect()
}

fn f_up_jump_on_e_transformed_tree() -> TestTreeNode<String> {
Expand All @@ -1628,9 +1628,9 @@ pub(crate) mod tests {
"f_down(d)",
"f_down(a)",
]
.into_iter()
.map(|s| s.to_string())
.collect()
.into_iter()
.map(|s| s.to_string())
.collect()
}

fn f_down_stop_on_a_transformed_tree() -> TestTreeNode<String> {
Expand Down Expand Up @@ -1707,9 +1707,9 @@ pub(crate) mod tests {
"f_down(a)",
"f_up(a)",
]
.into_iter()
.map(|s| s.to_string())
.collect()
.into_iter()
.map(|s| s.to_string())
.collect()
}

fn f_up_stop_on_a_transformed_tree() -> TestTreeNode<String> {
Expand Down Expand Up @@ -1755,9 +1755,9 @@ pub(crate) mod tests {
"f_up(c)",
"f_up(e)",
]
.into_iter()
.map(|s| s.to_string())
.collect()
.into_iter()
.map(|s| s.to_string())
.collect()
}

fn f_up_stop_on_e_transformed_tree() -> TestTreeNode<String> {
Expand Down Expand Up @@ -1876,7 +1876,7 @@ pub(crate) mod tests {
}

type TestRewriterF<T> =
Box<dyn FnMut(TestTreeNode<T>) -> Result<Transformed<TestTreeNode<T>>>>;
Box<dyn FnMut(TestTreeNode<T>) -> Result<Transformed<TestTreeNode<T>>>>;

struct TestRewriter<T> {
f_down: TestRewriterF<T>,
Expand Down Expand Up @@ -2349,6 +2349,7 @@ pub(crate) mod tests {
Ok(())
}

#[cfg(feature = "recursive-protection")]
#[test]
fn test_large_tree() {
let mut item = TestTreeNode::new_leaf("initial".to_string());
Expand Down

0 comments on commit c352f8a

Please sign in to comment.