Computes the size (total number of nodes) and maximum depth of a MirRelationExpr for debug printing purposes.
(&self)
| 1956 | /// Computes the size (total number of nodes) and maximum depth of a MirRelationExpr for |
| 1957 | /// debug printing purposes. |
| 1958 | pub fn debug_size_and_depth(&self) -> (usize, usize) { |
| 1959 | let mut size = 0; |
| 1960 | let mut max_depth = 0; |
| 1961 | let mut todo = vec![(self, 1)]; |
| 1962 | while let Some((expr, depth)) = todo.pop() { |
| 1963 | size += 1; |
| 1964 | max_depth = max(max_depth, depth); |
| 1965 | todo.extend(expr.children().map(|c| (c, depth + 1))); |
| 1966 | } |
| 1967 | (size, max_depth) |
| 1968 | } |
| 1969 | |
| 1970 | /// The MirRelationExpr is considered potentially expensive if and only if |
| 1971 | /// at least one of the following conditions is true: |