(&self, column_types: &[ReprColumnType])
| 1081 | } |
| 1082 | |
| 1083 | pub fn typ(&self, column_types: &[ReprColumnType]) -> ReprColumnType { |
| 1084 | match self { |
| 1085 | MirScalarExpr::Column(i, _name) => column_types[*i].clone(), |
| 1086 | MirScalarExpr::Literal(_, typ) => typ.clone(), |
| 1087 | MirScalarExpr::CallUnmaterializable(func) => func.output_type(), |
| 1088 | MirScalarExpr::CallUnary { expr, func } => func.output_type(expr.typ(column_types)), |
| 1089 | MirScalarExpr::CallBinary { expr1, expr2, func } => { |
| 1090 | func.output_type(&[expr1.typ(column_types), expr2.typ(column_types)]) |
| 1091 | } |
| 1092 | MirScalarExpr::CallVariadic { exprs, func } => { |
| 1093 | func.output_type(exprs.iter().map(|e| e.typ(column_types)).collect()) |
| 1094 | } |
| 1095 | MirScalarExpr::If { cond: _, then, els } => { |
| 1096 | let then_type = then.typ(column_types); |
| 1097 | let else_type = els.typ(column_types); |
| 1098 | then_type.union(&else_type).unwrap() |
| 1099 | } |
| 1100 | } |
| 1101 | } |
| 1102 | |
| 1103 | /// True iff the expression contains |
| 1104 | /// `UnmaterializableFunc::MzNow`. |
no test coverage detected