diff --git a/ballista/rust/core/src/serde/mod.rs b/ballista/rust/core/src/serde/mod.rs index b5c3c3c36468..f5442c40e660 100644 --- a/ballista/rust/core/src/serde/mod.rs +++ b/ballista/rust/core/src/serde/mod.rs @@ -97,6 +97,7 @@ pub(crate) fn from_proto_binary_op(op: &str) -> Result "Minus" => Ok(Operator::Minus), "Multiply" => Ok(Operator::Multiply), "Divide" => Ok(Operator::Divide), + "Modulo" => Ok(Operator::Modulo), "Like" => Ok(Operator::Like), "NotLike" => Ok(Operator::NotLike), other => Err(proto_error(format!( diff --git a/datafusion/src/logical_plan/operators.rs b/datafusion/src/logical_plan/operators.rs index 50bd682ae3f0..634439940307 100644 --- a/datafusion/src/logical_plan/operators.rs +++ b/datafusion/src/logical_plan/operators.rs @@ -127,6 +127,14 @@ impl ops::Div for Expr { } } +impl ops::Rem for Expr { + type Output = Self; + + fn rem(self, rhs: Self) -> Self { + binary_expr(self, Operator::Modulo, rhs) + } +} + #[cfg(test)] mod tests { use crate::prelude::lit; @@ -149,5 +157,9 @@ mod tests { format!("{:?}", lit(1u32) / lit(2u32)), "UInt32(1) / UInt32(2)" ); + assert_eq!( + format!("{:?}", lit(1u32) % lit(2u32)), + "UInt32(1) % UInt32(2)" + ); } }