Determines if the set of `Expr`'s are a valid projection on the input `Expr::Column`'s.
(
columns: &[Expr],
exprs: &[Expr],
purpose: CheckColumnsSatisfyExprsPurpose,
)
| 133 | /// Determines if the set of `Expr`'s are a valid projection on the input |
| 134 | /// `Expr::Column`'s. |
| 135 | pub(crate) fn check_columns_satisfy_exprs( |
| 136 | columns: &[Expr], |
| 137 | exprs: &[Expr], |
| 138 | purpose: CheckColumnsSatisfyExprsPurpose, |
| 139 | ) -> Result<()> { |
| 140 | columns.iter().try_for_each(|c| match c { |
| 141 | Expr::Column(_) => Ok(()), |
| 142 | _ => internal_err!("Expr::Column are required"), |
| 143 | })?; |
| 144 | let column_exprs = find_column_exprs(exprs); |
| 145 | for e in &column_exprs { |
| 146 | match e { |
| 147 | Expr::GroupingSet(GroupingSet::Rollup(exprs)) => { |
| 148 | for e in exprs { |
| 149 | check_column_satisfies_expr(columns, e, purpose)?; |
| 150 | } |
| 151 | } |
| 152 | Expr::GroupingSet(GroupingSet::Cube(exprs)) => { |
| 153 | for e in exprs { |
| 154 | check_column_satisfies_expr(columns, e, purpose)?; |
| 155 | } |
| 156 | } |
| 157 | Expr::GroupingSet(GroupingSet::GroupingSets(lists_of_exprs)) => { |
| 158 | for exprs in lists_of_exprs { |
| 159 | for e in exprs { |
| 160 | check_column_satisfies_expr(columns, e, purpose)?; |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | _ => check_column_satisfies_expr(columns, e, purpose)?, |
| 165 | } |
| 166 | } |
| 167 | Ok(()) |
| 168 | } |
| 169 | |
| 170 | fn check_column_satisfies_expr( |
| 171 | columns: &[Expr], |
no test coverage detected
searching dependent graphs…