in src/expr.rs [549:588]
fn _types(expr: &Expr) -> PyResult<DataTypeMap> {
match expr {
Expr::BinaryExpr(BinaryExpr {
left: _,
op,
right: _,
}) => match op {
Operator::Eq
| Operator::NotEq
| Operator::Lt
| Operator::LtEq
| Operator::Gt
| Operator::GtEq
| Operator::And
| Operator::Or
| Operator::IsDistinctFrom
| Operator::IsNotDistinctFrom
| Operator::RegexMatch
| Operator::RegexIMatch
| Operator::RegexNotMatch
| Operator::RegexNotIMatch => DataTypeMap::map_from_arrow_type(&DataType::Boolean),
Operator::Plus | Operator::Minus | Operator::Multiply | Operator::Modulo => {
DataTypeMap::map_from_arrow_type(&DataType::Int64)
}
Operator::Divide => DataTypeMap::map_from_arrow_type(&DataType::Float64),
Operator::StringConcat => DataTypeMap::map_from_arrow_type(&DataType::Utf8),
Operator::BitwiseShiftLeft
| Operator::BitwiseShiftRight
| Operator::BitwiseXor
| Operator::BitwiseAnd
| Operator::BitwiseOr => DataTypeMap::map_from_arrow_type(&DataType::Binary),
},
Expr::Cast(Cast { expr: _, data_type }) => DataTypeMap::map_from_arrow_type(data_type),
Expr::Literal(scalar_value) => DataTypeMap::map_from_scalar_value(scalar_value),
_ => Err(py_type_err(format!(
"Non Expr::Literal encountered in types: {:?}",
expr
))),
}
}