Apache DataFusion SQL Query Engine
Port math.rs to sqllogictest (#6037)
Yongting You9798fbcab1e0
diff --git a/datafusion/core/tests/sql/math.rs b/datafusion/core/tests/sql/math.rsdeleted file mode 100644index 89691242d0..0000000000--- a/datafusion/core/tests/sql/math.rs+++ /dev/null@@ -1,56 +0,0 @@-// Licensed to the Apache Software Foundation (ASF) under one-// or more contributor license agreements. See the NOTICE file-// distributed with this work for additional information-// regarding copyright ownership. The ASF licenses this file-// to you under the Apache License, Version 2.0 (the-// "License"); you may not use this file except in compliance-// with the License. You may obtain a copy of the License at-//-// http://www.apache.org/licenses/LICENSE-2.0-//-// Unless required by applicable law or agreed to in writing,-// software distributed under the License is distributed on an-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY-// KIND, either express or implied. See the License for the-// specific language governing permissions and limitations-// under the License.--use super::*;-use arrow::array::Float64Array;--#[tokio::test]-async fn test_atan2() -> Result<()> {- let ctx = SessionContext::new();-- let t1_schema = Arc::new(Schema::new(vec![- Field::new("x", DataType::Float64, true),- Field::new("y", DataType::Float64, true),- ]));-- let t1_data = RecordBatch::try_new(- t1_schema.clone(),- vec![- Arc::new(Float64Array::from(vec![1.0, 1.0, -1.0, -1.0])),- Arc::new(Float64Array::from(vec![2.0, -2.0, 2.0, -2.0])),- ],- )?;- ctx.register_batch("t1", t1_data)?;-- let sql = "SELECT atan2(y, x) FROM t1";- let actual = execute_to_batches(&ctx, sql).await;-- let expected = vec![- "+---------------------+",- "| atan2(t1.y,t1.x) |",- "+---------------------+",- "| 1.1071487177940904 |",- "| -1.1071487177940904 |",- "| 2.0344439357957027 |",- "| -2.0344439357957027 |",- "+---------------------+",- ];-- assert_batches_eq!(expected, &actual);-- Ok(())-}diff --git a/datafusion/core/tests/sql/mod.rs b/datafusion/core/tests/sql/mod.rsindex 2a05c918b5..192e2f65f8 100644--- a/datafusion/core/tests/sql/mod.rs+++ b/datafusion/core/tests/sql/mod.rs@@ -91,7 +91,6 @@ pub mod group_by;pub mod joins;pub mod json;pub mod limit;-pub mod math;pub mod order;pub mod parquet;pub mod predicates;diff --git a/datafusion/core/tests/sqllogictests/test_files/math.slt b/datafusion/core/tests/sqllogictests/test_files/math.sltindex 84f0d4988d..152e8b78bd 100644--- a/datafusion/core/tests/sqllogictests/test_files/math.slt+++ b/datafusion/core/tests/sqllogictests/test_files/math.slt@@ -87,3 +87,9 @@ query RRRRRRRRSELECT round(125.2345, -3), round(125.2345, -2), round(125.2345, -1), round(125.2345), round(125.2345, 0), round(125.2345, 1), round(125.2345, 2), round(125.2345, 3)----0 100 130 125 125 125.2 125.23 125.235++# atan2+query RRRRRRR+SELECT atan2(2.0, 1.0), atan2(-2.0, 1.0), atan2(2.0, -1.0), atan2(-2.0, -1.0), atan2(NULL, 1.0), atan2(2.0, NULL), atan2(NULL, NULL);+----+1.107148717794 -1.107148717794 2.034443935796 -2.034443935796 NULL NULL NULL