From 261df94df0da83c1581baaf854b2a2ff1d0b8131 Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Tue, 8 Aug 2023 12:02:34 +0800 Subject: [PATCH] fix: typo in substrait Signed-off-by: Ruihang Xia --- datafusion/substrait/src/logical_plan/producer.rs | 2 +- .../tests/cases/roundtrip_logical_plan.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/datafusion/substrait/src/logical_plan/producer.rs b/datafusion/substrait/src/logical_plan/producer.rs index 07da2dc0bee1..d3337e736d35 100644 --- a/datafusion/substrait/src/logical_plan/producer.rs +++ b/datafusion/substrait/src/logical_plan/producer.rs @@ -471,7 +471,7 @@ pub fn operator_to_name(op: Operator) -> &'static str { Operator::Gt => "gt", Operator::GtEq => "gte", Operator::Plus => "add", - Operator::Minus => "substract", + Operator::Minus => "subtract", Operator::Multiply => "multiply", Operator::Divide => "divide", Operator::Modulo => "mod", diff --git a/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs b/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs index f297264c3dd5..90c3d199b740 100644 --- a/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs +++ b/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs @@ -410,6 +410,21 @@ async fn roundtrip_outer_join() -> Result<()> { roundtrip("SELECT data.a FROM data FULL OUTER JOIN data2 ON data.a = data2.a").await } +#[tokio::test] +async fn roundtrip_arithmetic_ops() -> Result<()> { + roundtrip("SELECT a - a FROM data").await?; + roundtrip("SELECT a + a FROM data").await?; + roundtrip("SELECT a * a FROM data").await?; + roundtrip("SELECT a / a FROM data").await?; + roundtrip("SELECT a = a FROM data").await?; + roundtrip("SELECT a != a FROM data").await?; + roundtrip("SELECT a > a FROM data").await?; + roundtrip("SELECT a >= a FROM data").await?; + roundtrip("SELECT a < a FROM data").await?; + roundtrip("SELECT a <= a FROM data").await?; + Ok(()) +} + #[tokio::test] async fn roundtrip_like() -> Result<()> { roundtrip("SELECT f FROM data WHERE f LIKE 'a%b'").await