From 9dc6f6afef151ec7753d435533345a2a29c1a030 Mon Sep 17 00:00:00 2001 From: Trent Hauck Date: Fri, 19 Jul 2024 15:59:48 -0700 Subject: [PATCH 1/3] fix: remove assert --- datafusion/common/src/scalar/mod.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/datafusion/common/src/scalar/mod.rs b/datafusion/common/src/scalar/mod.rs index 38f70e4c1466c..0651013901154 100644 --- a/datafusion/common/src/scalar/mod.rs +++ b/datafusion/common/src/scalar/mod.rs @@ -1063,7 +1063,6 @@ impl ScalarValue { /// Create an one value in the given type. pub fn new_one(datatype: &DataType) -> Result { - assert!(datatype.is_primitive()); Ok(match datatype { DataType::Int8 => ScalarValue::Int8(Some(1)), DataType::Int16 => ScalarValue::Int16(Some(1)), @@ -1086,7 +1085,6 @@ impl ScalarValue { /// Create a negative one value in the given type. pub fn new_negative_one(datatype: &DataType) -> Result { - assert!(datatype.is_primitive()); Ok(match datatype { DataType::Int8 | DataType::UInt8 => ScalarValue::Int8(Some(-1)), DataType::Int16 | DataType::UInt16 => ScalarValue::Int16(Some(-1)), @@ -1104,7 +1102,6 @@ impl ScalarValue { } pub fn new_ten(datatype: &DataType) -> Result { - assert!(datatype.is_primitive()); Ok(match datatype { DataType::Int8 => ScalarValue::Int8(Some(10)), DataType::Int16 => ScalarValue::Int16(Some(10)), From 049183fac90fac6577ff5cbdc9d09b3981c8b2a8 Mon Sep 17 00:00:00 2001 From: Trent Hauck Date: Fri, 19 Jul 2024 18:19:53 -0700 Subject: [PATCH 2/3] tests: add tests from ticket --- datafusion/sqllogictest/test_files/scalar.slt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/datafusion/sqllogictest/test_files/scalar.slt b/datafusion/sqllogictest/test_files/scalar.slt index dd19a1344139d..852e094eb4c3a 100644 --- a/datafusion/sqllogictest/test_files/scalar.slt +++ b/datafusion/sqllogictest/test_files/scalar.slt @@ -1982,3 +1982,34 @@ query I select strpos('joséésoj', arrow_cast(null, 'Utf8')); ---- NULL + +statement ok +CREATE TABLE t1 (v1 int) AS VALUES (1), (2), (3); + +query I +SELECT * FROM t1 ORDER BY ACOS(SIN(v1)); +---- +2 +1 +3 + +query I +SELECT * FROM t1 ORDER BY ACOSH(SIN(v1)); +---- +1 +2 +3 + +query I +SELECT * FROM t1 ORDER BY ASIN(SIN(v1)); +---- +3 +1 +2 + +query I +SELECT * FROM t1 ORDER BY ATANH(SIN(v1)); +---- +3 +1 +2 From de28e360c294aa162cde350af360ada0059be307 Mon Sep 17 00:00:00 2001 From: Trent Hauck Date: Fri, 19 Jul 2024 18:25:26 -0700 Subject: [PATCH 3/3] tests: clean up table --- datafusion/sqllogictest/test_files/scalar.slt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/datafusion/sqllogictest/test_files/scalar.slt b/datafusion/sqllogictest/test_files/scalar.slt index 852e094eb4c3a..48f94fc080a4f 100644 --- a/datafusion/sqllogictest/test_files/scalar.slt +++ b/datafusion/sqllogictest/test_files/scalar.slt @@ -2013,3 +2013,6 @@ SELECT * FROM t1 ORDER BY ATANH(SIN(v1)); 3 1 2 + +statement ok +drop table t1;