This is an automated email from the ASF dual-hosted git repository. agrove pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push: new 1ec67da50 add accessor methods to DateTimeIntervalExpr (#3440) 1ec67da50 is described below commit 1ec67da508ce4080764f8d9da589e0be9f145f12 Author: Andy Grove <andygrov...@gmail.com> AuthorDate: Sat Sep 10 23:46:02 2022 -0600 add accessor methods to DateTimeIntervalExpr (#3440) --- .../physical-expr/src/expressions/datetime.rs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/datafusion/physical-expr/src/expressions/datetime.rs b/datafusion/physical-expr/src/expressions/datetime.rs index 9f2beae00..fa021f61a 100644 --- a/datafusion/physical-expr/src/expressions/datetime.rs +++ b/datafusion/physical-expr/src/expressions/datetime.rs @@ -74,6 +74,21 @@ impl DateTimeIntervalExpr { ))), } } + + /// Get the left-hand side expression + pub fn lhs(&self) -> &Arc<dyn PhysicalExpr> { + &self.lhs + } + + /// Get the operator + pub fn op(&self) -> &Operator { + &self.op + } + + /// Get the right-hand side expression + pub fn rhs(&self) -> &Arc<dyn PhysicalExpr> { + &self.rhs + } } impl Display for DateTimeIntervalExpr { @@ -727,7 +742,15 @@ mod tests { let lhs = create_physical_expr(dt, &dfs, &schema, &props)?; let rhs = create_physical_expr(interval, &dfs, &schema, &props)?; + let lhs_str = format!("{}", lhs); + let rhs_str = format!("{}", rhs); + let cut = DateTimeIntervalExpr::try_new(lhs, op, rhs, &schema)?; + + assert_eq!(lhs_str, format!("{}", cut.lhs())); + assert_eq!(op, cut.op().clone()); + assert_eq!(rhs_str, format!("{}", cut.rhs())); + let res = cut.evaluate(&batch)?; Ok(res) }