This is an automated email from the ASF dual-hosted git repository.
jooger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 76d8bd0799 IGNITE-21966: Extend test coverage for SQL E091-01(Set
functions. AVG) (#3898)
76d8bd0799 is described below
commit 76d8bd0799f070431b4a6f05d4a71e4f51316dc2
Author: Max Zhuravkov <[email protected]>
AuthorDate: Tue Jun 11 11:58:09 2024 +0400
IGNITE-21966: Extend test coverage for SQL E091-01(Set functions. AVG)
(#3898)
---
.../sql/aggregate/aggregates/test_avg.test | 35 ++++++++++++--
.../sql/aggregate/aggregates/test_avg.test_ignored | 54 ----------------------
2 files changed, 32 insertions(+), 57 deletions(-)
diff --git
a/modules/sql-engine/src/integrationTest/sql/aggregate/aggregates/test_avg.test
b/modules/sql-engine/src/integrationTest/sql/aggregate/aggregates/test_avg.test
index bf2ccc3ece..74d6709e52 100644
---
a/modules/sql-engine/src/integrationTest/sql/aggregate/aggregates/test_avg.test
+++
b/modules/sql-engine/src/integrationTest/sql/aggregate/aggregates/test_avg.test
@@ -1,5 +1,6 @@
# name: test/sql/aggregate/aggregates/test_avg.test
# description: Test AVG operator
+# feature SQL E091-01(Set functions. AVG)
# group: [aggregates]
# scalar average
@@ -29,11 +30,39 @@ SELECT AVG(i) FROM integers WHERE i > 100
NULL
# invalid use of average
-statement error
+statement error: Invalid number of arguments to function 'AVG'. Was expecting
1 arguments
SELECT AVG()
-statement error
+statement error: Invalid number of arguments to function 'AVG'. Was expecting
1 arguments
SELECT AVG(1, 2, 3)
-statement error
+statement error: Aggregate expressions cannot be nested
SELECT AVG(AVG(1))
+
+# TODO https://issues.apache.org/jira/browse/IGNITE-22447
+# Update error message the issue is fixed
+statement error: Character c is neither a decimal digit number, decimal point,
nor "e" notation exponential mark
+SELECT AVG('cbcde')
+
+statement error: Cannot apply 'AVG' to arguments of type 'AVG(<BINARY(1)>)'.
Supported form(s): 'AVG(<NUMERIC>)
+SELECT AVG(x'00')
+
+query I
+SELECT * FROM integers GROUP BY i HAVING AVG(i) = 1
+----
+1
+
+# AVG function uses FamilyOperandTypeChecker that coerces its arguments if
possible.
+# Here it transforms AVG('100') into AVG(CAST('100' AS DECIMAL(32767, 16383)))
+query I
+SELECT AVG('100')
+----
+100
+
+statement error: Cannot apply 'AVG' to arguments of type 'AVG(<DATE>)'.
Supported form(s): 'AVG(<NUMERIC>)'
+SELECT AVG('2011-01-01'::DATE)
+
+# TODO https://issues.apache.org/jira/browse/IGNITE-22448 incorrect error
message
+# Update error message the issue is fixed. Current error: Unable to optimize
plan due to internal error
+statement error
+SELECT AVG('c4a0327c-44be-416d-ae90-75c05079789f'::UUID)
diff --git
a/modules/sql-engine/src/integrationTest/sql/aggregate/aggregates/test_avg.test_ignored
b/modules/sql-engine/src/integrationTest/sql/aggregate/aggregates/test_avg.test_ignored
deleted file mode 100644
index bf32a26131..0000000000
---
a/modules/sql-engine/src/integrationTest/sql/aggregate/aggregates/test_avg.test_ignored
+++ /dev/null
@@ -1,54 +0,0 @@
-# name: test/sql/aggregate/aggregates/test_avg.test
-# description: Test AVG operator
-# group: [aggregates]
-
-# scalar average
-query RR
-SELECT AVG(3), AVG(NULL)
-----
-3
-NULL
-
-# test average on sequence
-statement ok
-CREATE SEQUENCE seq;
-
-query R
-SELECT AVG(nextval('seq'))
-----
-1
-
-query R
-SELECT AVG(nextval('seq'))
-----
-2
-
-statement ok
-CREATE TABLE integers(i INTEGER);
-
-statement ok
-INSERT INTO integers VALUES (1), (2), (3)
-
-query RRRR
-SELECT AVG(i), AVG(1), AVG(DISTINCT i), AVG(NULL) FROM integers
-----
-2
-1
-2
-NULL
-
-query R
-SELECT AVG(i) FROM integers WHERE i > 100
-----
-NULL
-
-# invalid use of average
-statement error
-SELECT AVG()
-
-statement error
-SELECT AVG(1, 2, 3)
-
-statement error
-SELECT AVG(AVG(1))
-