diff --git a/common/functions/Cargo.toml b/common/functions/Cargo.toml index 7e20b4b085d17..842682a31d3e2 100644 --- a/common/functions/Cargo.toml +++ b/common/functions/Cargo.toml @@ -6,6 +6,10 @@ license = "Apache-2.0" publish = false edition = "2021" +[lib] +doctest = false +test = false + [dependencies] # In alphabetical order # Workspace dependencies common-arrow = {path = "../arrow"} diff --git a/common/functions/src/aggregates/mod.rs b/common/functions/src/aggregates/mod.rs index 1d41a46682715..ba8eeea5b1f32 100644 --- a/common/functions/src/aggregates/mod.rs +++ b/common/functions/src/aggregates/mod.rs @@ -12,11 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod aggregate_combinator_test; -#[cfg(test)] -mod aggregate_function_test; - mod aggregate_arg_min_max; mod aggregate_avg; mod aggregate_combinator_distinct; diff --git a/common/functions/src/scalars/arithmetics/mod.rs b/common/functions/src/scalars/arithmetics/mod.rs index 4a3996c8c071a..414ea976d0de5 100644 --- a/common/functions/src/scalars/arithmetics/mod.rs +++ b/common/functions/src/scalars/arithmetics/mod.rs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod arithmetic_test; - mod arithmetic; mod arithmetic_div; mod arithmetic_minus; diff --git a/common/functions/src/scalars/comparisons/mod.rs b/common/functions/src/scalars/comparisons/mod.rs index 0f424484d4432..ef93b44493cb2 100644 --- a/common/functions/src/scalars/comparisons/mod.rs +++ b/common/functions/src/scalars/comparisons/mod.rs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod comparison_test; - mod comparison; mod comparison_eq; mod comparison_gt; diff --git a/common/functions/src/scalars/conditionals/mod.rs b/common/functions/src/scalars/conditionals/mod.rs index 3f9aa7dbb11f3..0eda1b71e34cf 100644 --- a/common/functions/src/scalars/conditionals/mod.rs +++ b/common/functions/src/scalars/conditionals/mod.rs @@ -14,8 +14,6 @@ mod conditional; mod r#if; -#[cfg(test)] -mod if_test; pub use conditional::ConditionalFunction; pub use r#if::IfFunction; diff --git a/common/functions/src/scalars/dates/mod.rs b/common/functions/src/scalars/dates/mod.rs index 0cb0ab80217f9..3019f7a963c37 100644 --- a/common/functions/src/scalars/dates/mod.rs +++ b/common/functions/src/scalars/dates/mod.rs @@ -13,14 +13,6 @@ // limitations under the License. mod date; -#[cfg(test)] -mod date_function_test; -#[cfg(test)] -mod date_test; - -#[cfg(test)] -mod interval_function_test; - mod interval_function; mod now; mod number_function; @@ -38,6 +30,7 @@ pub use number_function::ToDayOfWeekFunction; pub use number_function::ToDayOfYearFunction; pub use number_function::ToHourFunction; pub use number_function::ToMinuteFunction; +pub use number_function::ToMondayFunction; pub use number_function::ToMonthFunction; pub use number_function::ToSecondFunction; pub use number_function::ToStartOfISOYearFunction; diff --git a/common/functions/src/scalars/expressions/mod.rs b/common/functions/src/scalars/expressions/mod.rs index c695136c3f131..8478c5ce8a9e3 100644 --- a/common/functions/src/scalars/expressions/mod.rs +++ b/common/functions/src/scalars/expressions/mod.rs @@ -12,11 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod cast_test; -mod expression; - mod cast; +mod expression; pub use cast::CastFunction; pub use expression::ToCastFunction; diff --git a/common/functions/src/scalars/hashes/mod.rs b/common/functions/src/scalars/hashes/mod.rs index 86834ffb015f8..7522d0653e5d5 100644 --- a/common/functions/src/scalars/hashes/mod.rs +++ b/common/functions/src/scalars/hashes/mod.rs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod siphash_test; - mod hash; mod siphash; diff --git a/common/functions/src/scalars/logics/mod.rs b/common/functions/src/scalars/logics/mod.rs index 60c81cf652fb7..663bd8c92bafb 100644 --- a/common/functions/src/scalars/logics/mod.rs +++ b/common/functions/src/scalars/logics/mod.rs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod logic_test; - mod logic; mod logic_and; mod logic_not; diff --git a/common/functions/src/scalars/maths/mod.rs b/common/functions/src/scalars/maths/mod.rs index b8a3b452b2b9c..ccf55018c54e8 100644 --- a/common/functions/src/scalars/maths/mod.rs +++ b/common/functions/src/scalars/maths/mod.rs @@ -12,15 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod abs_test; -#[cfg(test)] -mod crc32_test; -#[cfg(test)] -mod pi_test; -#[cfg(test)] -mod trigonometric_test; - mod abs; mod crc32; mod math; diff --git a/common/functions/src/scalars/mod.rs b/common/functions/src/scalars/mod.rs index 70dd0c4fd1892..91d0960b98025 100644 --- a/common/functions/src/scalars/mod.rs +++ b/common/functions/src/scalars/mod.rs @@ -20,8 +20,6 @@ mod expressions; mod function; mod function_alias; mod function_column; -#[cfg(test)] -mod function_column_test; mod function_factory; mod function_literal; mod hashes; diff --git a/common/functions/src/scalars/nullables/mod.rs b/common/functions/src/scalars/nullables/mod.rs index edbf28a818374..68a16ce0272b3 100644 --- a/common/functions/src/scalars/nullables/mod.rs +++ b/common/functions/src/scalars/nullables/mod.rs @@ -15,8 +15,6 @@ mod is_not_null; mod is_null; mod nullable; -#[cfg(test)] -mod nullable_test; pub use is_not_null::IsNotNullFunction; pub use is_null::IsNullFunction; diff --git a/common/functions/src/scalars/others/mod.rs b/common/functions/src/scalars/others/mod.rs index 3124ae1d142c1..9eaca1136107a 100644 --- a/common/functions/src/scalars/others/mod.rs +++ b/common/functions/src/scalars/others/mod.rs @@ -11,10 +11,9 @@ // 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. -#[cfg(test)] -mod running_difference_function_test; mod other; mod running_difference_function; + pub use other::OtherFunction; pub use running_difference_function::RunningDifferenceFunction; diff --git a/common/functions/src/scalars/strings/mod.rs b/common/functions/src/scalars/strings/mod.rs index ec56e0a59a6a9..7b8127bbfc820 100644 --- a/common/functions/src/scalars/strings/mod.rs +++ b/common/functions/src/scalars/strings/mod.rs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod substring_test; - mod string; mod substring; diff --git a/common/functions/src/scalars/udfs/mod.rs b/common/functions/src/scalars/udfs/mod.rs index be7386dc9d2b7..1cc353c96ad22 100644 --- a/common/functions/src/scalars/udfs/mod.rs +++ b/common/functions/src/scalars/udfs/mod.rs @@ -12,15 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(test)] -mod database_test; -#[cfg(test)] -mod to_type_name_test; -#[cfg(test)] -mod udf_example_test; -#[cfg(test)] -mod version_test; - mod crash_me; mod database; mod exists; diff --git a/common/functions/src/aggregates/aggregate_combinator_test.rs b/common/functions/tests/it/aggregates/aggregate_combinator.rs similarity index 99% rename from common/functions/src/aggregates/aggregate_combinator_test.rs rename to common/functions/tests/it/aggregates/aggregate_combinator.rs index 5bc502118c36d..9a6af974f0cc8 100644 --- a/common/functions/src/aggregates/aggregate_combinator_test.rs +++ b/common/functions/tests/it/aggregates/aggregate_combinator.rs @@ -15,10 +15,9 @@ use bumpalo::Bump; use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::aggregates::AggregateFunctionFactory; use pretty_assertions::assert_eq; -use crate::aggregates::aggregate_function_factory::AggregateFunctionFactory; - #[test] fn test_aggregate_combinator_function() -> Result<()> { struct Test { diff --git a/common/functions/src/aggregates/aggregate_function_test.rs b/common/functions/tests/it/aggregates/aggregate_function.rs similarity index 99% rename from common/functions/src/aggregates/aggregate_function_test.rs rename to common/functions/tests/it/aggregates/aggregate_function.rs index acd18a6adc594..a4bb1f4c2c40f 100644 --- a/common/functions/src/aggregates/aggregate_function_test.rs +++ b/common/functions/tests/it/aggregates/aggregate_function.rs @@ -15,11 +15,10 @@ use bumpalo::Bump; use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::aggregates::*; use float_cmp::approx_eq; use pretty_assertions::assert_eq; -use crate::aggregates::*; - #[test] fn test_aggregate_function() -> Result<()> { struct Test { diff --git a/common/functions/tests/it/aggregates/mod.rs b/common/functions/tests/it/aggregates/mod.rs new file mode 100644 index 0000000000000..dec21f80b874f --- /dev/null +++ b/common/functions/tests/it/aggregates/mod.rs @@ -0,0 +1,16 @@ +// Copyright 2020 Datafuse Labs. +// +// Licensed 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. + +mod aggregate_combinator; +mod aggregate_function; diff --git a/common/functions/tests/it/main.rs b/common/functions/tests/it/main.rs new file mode 100644 index 0000000000000..10fb3b2916a8a --- /dev/null +++ b/common/functions/tests/it/main.rs @@ -0,0 +1,16 @@ +// Copyright 2020 Datafuse Labs. +// +// Licensed 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. + +mod aggregates; +mod scalars; diff --git a/common/functions/src/scalars/arithmetics/arithmetic_test.rs b/common/functions/tests/it/scalars/arithmetics.rs similarity index 99% rename from common/functions/src/scalars/arithmetics/arithmetic_test.rs rename to common/functions/tests/it/scalars/arithmetics.rs index 5b7e13736c3d5..6501d08bb907f 100644 --- a/common/functions/src/scalars/arithmetics/arithmetic_test.rs +++ b/common/functions/tests/it/scalars/arithmetics.rs @@ -15,10 +15,9 @@ use common_datavalues::chrono; use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_arithmetic_function() -> Result<()> { #[allow(dead_code)] diff --git a/common/functions/src/scalars/comparisons/comparison_test.rs b/common/functions/tests/it/scalars/comparisons.rs similarity index 99% rename from common/functions/src/scalars/comparisons/comparison_test.rs rename to common/functions/tests/it/scalars/comparisons.rs index 05e947a491918..1f8e00e138f99 100644 --- a/common/functions/src/scalars/comparisons/comparison_test.rs +++ b/common/functions/tests/it/scalars/comparisons.rs @@ -14,10 +14,9 @@ use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_comparison_function() -> Result<()> { #[allow(dead_code)] diff --git a/common/functions/src/scalars/conditionals/if_test.rs b/common/functions/tests/it/scalars/conditionals.rs similarity index 98% rename from common/functions/src/scalars/conditionals/if_test.rs rename to common/functions/tests/it/scalars/conditionals.rs index 5ca4cc876f26a..9084eea6e0f6e 100644 --- a/common/functions/src/scalars/conditionals/if_test.rs +++ b/common/functions/tests/it/scalars/conditionals.rs @@ -15,10 +15,9 @@ use common_datavalues::prelude::*; use common_datavalues::DataType; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_if_function() -> Result<()> { #[allow(dead_code)] diff --git a/common/functions/src/scalars/dates/date_test.rs b/common/functions/tests/it/scalars/dates/date.rs similarity index 98% rename from common/functions/src/scalars/dates/date_test.rs rename to common/functions/tests/it/scalars/dates/date.rs index 14e71f465e172..25b2056dc373b 100644 --- a/common/functions/src/scalars/dates/date_test.rs +++ b/common/functions/tests/it/scalars/dates/date.rs @@ -11,13 +11,12 @@ // 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 common_datavalues::prelude::*; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use super::RoundFunction; -use crate::scalars::*; - #[allow(dead_code)] struct Test { name: &'static str, diff --git a/common/functions/src/scalars/dates/date_function_test.rs b/common/functions/tests/it/scalars/dates/date_function.rs similarity index 98% rename from common/functions/src/scalars/dates/date_function_test.rs rename to common/functions/tests/it/scalars/dates/date_function.rs index 8a0e9bd2f32f7..bdb29f8e80ea3 100644 --- a/common/functions/src/scalars/dates/date_function_test.rs +++ b/common/functions/tests/it/scalars/dates/date_function.rs @@ -14,19 +14,7 @@ use common_datavalues::prelude::*; use common_exception::Result; - -use crate::scalars::dates::number_function::ToDayOfMonthFunction; -use crate::scalars::dates::number_function::ToDayOfWeekFunction; -use crate::scalars::dates::number_function::ToDayOfYearFunction; -use crate::scalars::dates::number_function::ToMinuteFunction; -use crate::scalars::dates::number_function::ToMondayFunction; -use crate::scalars::dates::number_function::ToMonthFunction; -use crate::scalars::Function; -use crate::scalars::ToHourFunction; -use crate::scalars::ToSecondFunction; -use crate::scalars::ToYYYYMMDDFunction; -use crate::scalars::ToYYYYMMDDhhmmssFunction; -use crate::scalars::ToYYYYMMFunction; +use common_functions::scalars::*; #[allow(dead_code)] struct Test { diff --git a/common/functions/src/scalars/dates/interval_function_test.rs b/common/functions/tests/it/scalars/dates/interval_function.rs similarity index 98% rename from common/functions/src/scalars/dates/interval_function_test.rs rename to common/functions/tests/it/scalars/dates/interval_function.rs index 6e7a0f935a279..eda3bd2452b9d 100644 --- a/common/functions/src/scalars/dates/interval_function_test.rs +++ b/common/functions/tests/it/scalars/dates/interval_function.rs @@ -16,9 +16,8 @@ use common_datablocks::DataBlock; use common_datavalues::chrono::DateTime; use common_datavalues::prelude::*; use common_exception::Result; - -use crate::scalars::MonthsArithmeticFunction; -use crate::scalars::SecondsArithmeticFunction; +use common_functions::scalars::MonthsArithmeticFunction; +use common_functions::scalars::SecondsArithmeticFunction; #[test] fn test_add_months() -> Result<()> { diff --git a/common/functions/tests/it/scalars/dates/mod.rs b/common/functions/tests/it/scalars/dates/mod.rs new file mode 100644 index 0000000000000..0e9291bbb4186 --- /dev/null +++ b/common/functions/tests/it/scalars/dates/mod.rs @@ -0,0 +1,17 @@ +// Copyright 2020 Datafuse Labs. +// +// Licensed 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. + +mod date; +mod date_function; +mod interval_function; diff --git a/common/functions/src/scalars/expressions/cast_test.rs b/common/functions/tests/it/scalars/expressions.rs similarity index 99% rename from common/functions/src/scalars/expressions/cast_test.rs rename to common/functions/tests/it/scalars/expressions.rs index 640860d4f6a9c..b4ec6131ee777 100644 --- a/common/functions/src/scalars/expressions/cast_test.rs +++ b/common/functions/tests/it/scalars/expressions.rs @@ -14,10 +14,9 @@ use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_cast_function() -> Result<()> { #[allow(dead_code)] diff --git a/common/functions/src/scalars/function_column_test.rs b/common/functions/tests/it/scalars/function_column.rs similarity index 97% rename from common/functions/src/scalars/function_column_test.rs rename to common/functions/tests/it/scalars/function_column.rs index 754b2cae4dcec..7cd47bc05cb2b 100644 --- a/common/functions/src/scalars/function_column_test.rs +++ b/common/functions/tests/it/scalars/function_column.rs @@ -15,8 +15,7 @@ use common_datablocks::*; use common_datavalues::prelude::*; use common_exception::Result; - -use crate::scalars::*; +use common_functions::scalars::*; #[test] fn test_column_function() -> Result<()> { diff --git a/common/functions/src/scalars/hashes/siphash_test.rs b/common/functions/tests/it/scalars/hashes.rs similarity index 99% rename from common/functions/src/scalars/hashes/siphash_test.rs rename to common/functions/tests/it/scalars/hashes.rs index bb1732c7fbc9a..1caf64f9b8d93 100644 --- a/common/functions/src/scalars/hashes/siphash_test.rs +++ b/common/functions/tests/it/scalars/hashes.rs @@ -15,8 +15,7 @@ use common_datavalues::columns::DataColumn; use common_datavalues::prelude::*; use common_exception::Result; - -use crate::scalars::SipHashFunction; +use common_functions::scalars::SipHashFunction; #[test] fn test_siphash_function() -> Result<()> { diff --git a/common/functions/src/scalars/logics/logic_test.rs b/common/functions/tests/it/scalars/logics.rs similarity index 99% rename from common/functions/src/scalars/logics/logic_test.rs rename to common/functions/tests/it/scalars/logics.rs index 80c23d253ae7c..3488cb254bd33 100644 --- a/common/functions/src/scalars/logics/logic_test.rs +++ b/common/functions/tests/it/scalars/logics.rs @@ -14,10 +14,9 @@ use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_logic_function() -> Result<()> { #[allow(dead_code)] diff --git a/common/functions/src/scalars/maths/abs_test.rs b/common/functions/tests/it/scalars/maths/abs.rs similarity index 98% rename from common/functions/src/scalars/maths/abs_test.rs rename to common/functions/tests/it/scalars/maths/abs.rs index 6c7f571ad9890..02b6c5edaee1e 100644 --- a/common/functions/src/scalars/maths/abs_test.rs +++ b/common/functions/tests/it/scalars/maths/abs.rs @@ -15,8 +15,7 @@ use common_datavalues::prelude::*; use common_exception::ErrorCode; use common_exception::Result; - -use crate::scalars::*; +use common_functions::scalars::*; #[test] fn test_abs_function() -> Result<()> { diff --git a/common/functions/src/scalars/maths/crc32_test.rs b/common/functions/tests/it/scalars/maths/crc32.rs similarity index 98% rename from common/functions/src/scalars/maths/crc32_test.rs rename to common/functions/tests/it/scalars/maths/crc32.rs index d694f219bd0e8..409e9b3a1b079 100644 --- a/common/functions/src/scalars/maths/crc32_test.rs +++ b/common/functions/tests/it/scalars/maths/crc32.rs @@ -14,8 +14,7 @@ use common_datavalues::prelude::*; use common_exception::Result; - -use crate::scalars::*; +use common_functions::scalars::*; #[test] fn test_crc32_function() -> Result<()> { diff --git a/common/functions/tests/it/scalars/maths/mod.rs b/common/functions/tests/it/scalars/maths/mod.rs new file mode 100644 index 0000000000000..7c63be17a2510 --- /dev/null +++ b/common/functions/tests/it/scalars/maths/mod.rs @@ -0,0 +1,18 @@ +// Copyright 2020 Datafuse Labs. +// +// Licensed 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. + +mod abs; +mod crc32; +mod pi; +mod trigonometric; diff --git a/common/functions/src/scalars/maths/pi_test.rs b/common/functions/tests/it/scalars/maths/pi.rs similarity index 97% rename from common/functions/src/scalars/maths/pi_test.rs rename to common/functions/tests/it/scalars/maths/pi.rs index 81c9299ea939d..5ec0ee66822e5 100644 --- a/common/functions/src/scalars/maths/pi_test.rs +++ b/common/functions/tests/it/scalars/maths/pi.rs @@ -16,8 +16,7 @@ use std::f64::consts::PI; use common_datavalues::prelude::*; use common_exception::Result; - -use crate::scalars::*; +use common_functions::scalars::*; #[test] fn test_pi_function() -> Result<()> { diff --git a/common/functions/src/scalars/maths/trigonometric_test.rs b/common/functions/tests/it/scalars/maths/trigonometric.rs similarity index 99% rename from common/functions/src/scalars/maths/trigonometric_test.rs rename to common/functions/tests/it/scalars/maths/trigonometric.rs index 94ee40ac5ea14..a2a16c8c3d715 100644 --- a/common/functions/src/scalars/maths/trigonometric_test.rs +++ b/common/functions/tests/it/scalars/maths/trigonometric.rs @@ -16,8 +16,7 @@ use std::f64::consts::PI; use common_datavalues::prelude::*; use common_exception::Result; - -use crate::scalars::*; +use common_functions::scalars::*; #[test] fn test_trigonometic_function() -> Result<()> { diff --git a/common/functions/tests/it/scalars/mod.rs b/common/functions/tests/it/scalars/mod.rs new file mode 100644 index 0000000000000..45c0f6b737409 --- /dev/null +++ b/common/functions/tests/it/scalars/mod.rs @@ -0,0 +1,26 @@ +// Copyright 2020 Datafuse Labs. +// +// Licensed 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. + +mod arithmetics; +mod comparisons; +mod conditionals; +mod dates; +mod expressions; +mod function_column; +mod hashes; +mod logics; +mod maths; +mod nullables; +mod others; +mod udfs; diff --git a/common/functions/src/scalars/nullables/nullable_test.rs b/common/functions/tests/it/scalars/nullables.rs similarity index 98% rename from common/functions/src/scalars/nullables/nullable_test.rs rename to common/functions/tests/it/scalars/nullables.rs index 0ae0dee4a0bdd..4c3b81bf1ff37 100644 --- a/common/functions/src/scalars/nullables/nullable_test.rs +++ b/common/functions/tests/it/scalars/nullables.rs @@ -15,10 +15,9 @@ use common_datavalues::prelude::*; use common_datavalues::DataType; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_nullable_function() -> Result<()> { #[allow(dead_code)] diff --git a/common/functions/src/scalars/others/running_difference_function_test.rs b/common/functions/tests/it/scalars/others.rs similarity index 99% rename from common/functions/src/scalars/others/running_difference_function_test.rs rename to common/functions/tests/it/scalars/others.rs index 897904aae4b3e..6598cc0b32a01 100644 --- a/common/functions/src/scalars/others/running_difference_function_test.rs +++ b/common/functions/tests/it/scalars/others.rs @@ -19,8 +19,7 @@ use common_arrow::arrow::array::Int64Array; use common_datablocks::*; use common_datavalues::prelude::*; use common_exception::Result; - -use crate::scalars::RunningDifferenceFunction; +use common_functions::scalars::RunningDifferenceFunction; macro_rules! run_difference_constant_test { ($method_name:ident, $primitive_type:ty, $logic_type:ident, $result_primitive_type:ty, $result_logic_type:ident, $array_type:ident) => { diff --git a/common/functions/src/scalars/strings/substring_test.rs b/common/functions/tests/it/scalars/strings.rs similarity index 98% rename from common/functions/src/scalars/strings/substring_test.rs rename to common/functions/tests/it/scalars/strings.rs index ea93f98f1cba9..aba3c93c3a0b7 100644 --- a/common/functions/src/scalars/strings/substring_test.rs +++ b/common/functions/tests/it/scalars/strings.rs @@ -16,8 +16,8 @@ use common_datavalues::prelude::*; use common_exception::Result; use pretty_assertions::assert_eq; -use crate::scalars::Function; -use crate::scalars::SubstringFunction; +use common_functions::scalars::Function; +use common_functions::scalars::SubstringFunction; #[test] fn test_substring_function() -> Result<()> { diff --git a/common/functions/src/scalars/udfs/database_test.rs b/common/functions/tests/it/scalars/udfs/database.rs similarity index 98% rename from common/functions/src/scalars/udfs/database_test.rs rename to common/functions/tests/it/scalars/udfs/database.rs index 5e9ef4b48d09e..65077eeaca300 100644 --- a/common/functions/src/scalars/udfs/database_test.rs +++ b/common/functions/tests/it/scalars/udfs/database.rs @@ -14,10 +14,9 @@ use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_database_function() -> Result<()> { #[allow(dead_code)] diff --git a/common/functions/tests/it/scalars/udfs/mod.rs b/common/functions/tests/it/scalars/udfs/mod.rs new file mode 100644 index 0000000000000..b9aba2569b3c1 --- /dev/null +++ b/common/functions/tests/it/scalars/udfs/mod.rs @@ -0,0 +1,18 @@ +// Copyright 2020 Datafuse Labs. +// +// Licensed 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. + +mod database; +mod to_type_name; +mod udf_example; +mod version; diff --git a/common/functions/src/scalars/udfs/to_type_name_test.rs b/common/functions/tests/it/scalars/udfs/to_type_name.rs similarity index 98% rename from common/functions/src/scalars/udfs/to_type_name_test.rs rename to common/functions/tests/it/scalars/udfs/to_type_name.rs index d34ab5fe629ac..01374e57707c4 100644 --- a/common/functions/src/scalars/udfs/to_type_name_test.rs +++ b/common/functions/tests/it/scalars/udfs/to_type_name.rs @@ -14,10 +14,9 @@ use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_to_type_name_function() -> Result<()> { #[allow(dead_code)] diff --git a/common/functions/src/scalars/udfs/udf_example_test.rs b/common/functions/tests/it/scalars/udfs/udf_example.rs similarity index 98% rename from common/functions/src/scalars/udfs/udf_example_test.rs rename to common/functions/tests/it/scalars/udfs/udf_example.rs index 04f4110af3377..7209ac565800f 100644 --- a/common/functions/src/scalars/udfs/udf_example_test.rs +++ b/common/functions/tests/it/scalars/udfs/udf_example.rs @@ -18,8 +18,7 @@ use common_datavalues::DataField; use common_datavalues::DataSchemaRefExt; use common_datavalues::DataType; use common_exception::Result; - -use crate::scalars::*; +use common_functions::scalars::*; #[test] fn test_udf_example_function() -> Result<()> { diff --git a/common/functions/src/scalars/udfs/version_test.rs b/common/functions/tests/it/scalars/udfs/version.rs similarity index 98% rename from common/functions/src/scalars/udfs/version_test.rs rename to common/functions/tests/it/scalars/udfs/version.rs index 560f6fdce6860..599499d22e22c 100644 --- a/common/functions/src/scalars/udfs/version_test.rs +++ b/common/functions/tests/it/scalars/udfs/version.rs @@ -14,10 +14,9 @@ use common_datavalues::prelude::*; use common_exception::Result; +use common_functions::scalars::*; use pretty_assertions::assert_eq; -use crate::scalars::*; - #[test] fn test_version_function() -> Result<()> { #[allow(dead_code)]