From 1785b613ccb7541be4af3b966cd04dd0893360cb Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Tue, 16 Apr 2024 16:15:09 -0700 Subject: [PATCH 1/6] Fixes tests --- .../eval/primitives/date-time.ion | 32 +++++--- .../primitives/operators/bag-operators.ion | 1 - .../eval/query/group-by/group-by.ion | 13 +-- .../eval/query/select/from-clause.ion | 80 +++++++++++-------- partiql-tests-data/eval/spec-tests.ion | 64 ++++++++++----- 5 files changed, 112 insertions(+), 78 deletions(-) diff --git a/partiql-tests-data/eval/primitives/date-time.ion b/partiql-tests-data/eval/primitives/date-time.ion index e0c9eab..71995bc 100644 --- a/partiql-tests-data/eval/primitives/date-time.ion +++ b/partiql-tests-data/eval/primitives/date-time.ion @@ -2,20 +2,26 @@ regression::[ { name:"dateTimePartsAsVariableNames", statement:"SELECT VALUE [year, month, day, hour, minute, second] FROM 1968 AS year, 4 AS month, 3 as day, 12 as hour, 31 as minute, 59 as second", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - [ - 1968, - 4, - 3, - 12, - 31, - 59 + assert:[ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + [ + 1968, + 4, + 3, + 12, + 31, + 59 + ] ] - ] - } + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"dateTimePartsAsStructFieldNames", diff --git a/partiql-tests-data/eval/primitives/operators/bag-operators.ion b/partiql-tests-data/eval/primitives/operators/bag-operators.ion index ef5e3e5..29fad6c 100644 --- a/partiql-tests-data/eval/primitives/operators/bag-operators.ion +++ b/partiql-tests-data/eval/primitives/operators/bag-operators.ion @@ -126,7 +126,6 @@ bagOperators::[ evalMode:[EvalModeCoerce, EvalModeError], result:EvaluationSuccess, output:$bag::[ - 1, 2 ] } diff --git a/partiql-tests-data/eval/query/group-by/group-by.ion b/partiql-tests-data/eval/query/group-by/group-by.ion index c7431db..ce37a44 100644 --- a/partiql-tests-data/eval/query/group-by/group-by.ion +++ b/partiql-tests-data/eval/query/group-by/group-by.ion @@ -7449,18 +7449,7 @@ EvalModeCoerce, EvalModeError ], - output:$bag::[ - $bag::[ - { - the_sum:1 - } - ], - $bag::[ - { - the_sum:1 - } - ] - ] + output:$bag::[1, 1] } }, { diff --git a/partiql-tests-data/eval/query/select/from-clause.ion b/partiql-tests-data/eval/query/select/from-clause.ion index 728cbff..ffd16c0 100644 --- a/partiql-tests-data/eval/query/select/from-clause.ion +++ b/partiql-tests-data/eval/query/select/from-clause.ion @@ -198,26 +198,32 @@ envs::{ { name:"ordinalAccessWithNegativeIndex", statement:"SELECT temp[-2] FROM <<[1,2,3,4]>> AS temp", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - { - } - ] - } + assert:[ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ {} ] + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"ordinalAccessWithNegativeIndexAndBindings", statement:"SELECT temp[-2] FROM [[1,2,3,4]] AS temp", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - { - } - ] - } + assert:[ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ {} ] + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] } ] @@ -225,27 +231,37 @@ envs::{ { name:"rangeOverScalar", statement:"SELECT VALUE v FROM 1 AS v", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - 1 - ] - } + assert:[ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ 1 ] + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"rangeTwiceOverScalar", statement:"SELECT VALUE [v1, v2] FROM 1 AS v1, @v1 AS v2", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - [ - 1, - 1 + assert:[ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + [ + 1, + 1 + ] ] - ] - } + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"rangeOverSexp", diff --git a/partiql-tests-data/eval/spec-tests.ion b/partiql-tests-data/eval/spec-tests.ion index 90f6ef7..2c9acaa 100644 --- a/partiql-tests-data/eval/spec-tests.ion +++ b/partiql-tests-data/eval/spec-tests.ion @@ -145,11 +145,17 @@ { name: "single source FROM with scalar", statement: "SELECT x FROM someOrderedTable[0].a AS x", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[{x: 0}] - } + assert: [ + { + evalMode: [EvalModeCoerce, EvalModeError], + result: EvaluationSuccess, + output: $bag::[{x: 0}] + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + } + ] }, { name: "single source FROM with scalar and AT clause", @@ -169,11 +175,17 @@ { name: "single source FROM with tuple", statement: "SELECT x FROM {'someKey': 'someValue' } AS x", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[{x: {someKey: "someValue"}}] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[{x: {someKey: "someValue"}}] + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + } + ] }, { name: "single source FROM with tuple and AT clause", @@ -193,11 +205,17 @@ { name: "single source FROM with absent value null", statement: "SELECT x FROM NULL AS x", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[{x: null}] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[{x: null}] + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + } + ] }, { name: "single source FROM with absent value null and AT clause", @@ -217,11 +235,17 @@ { name: "single source FROM with absent value missing", statement: "SELECT x FROM MISSING AS x", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[{}] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[{}] + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name: "single source FROM with absent value missing and AT clause", From 08b6655877fc48859af1d3d4ad046c5ac3a3fa50 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Wed, 17 Apr 2024 11:00:08 -0700 Subject: [PATCH 2/6] Fixes more tests --- .../eval/query/group-by/group-by.ion | 8 ++--- .../eval/query/select/sql-aggregate.ion | 30 ++++--------------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/partiql-tests-data/eval/query/group-by/group-by.ion b/partiql-tests-data/eval/query/group-by/group-by.ion index ce37a44..166022d 100644 --- a/partiql-tests-data/eval/query/group-by/group-by.ion +++ b/partiql-tests-data/eval/query/group-by/group-by.ion @@ -7375,8 +7375,8 @@ } }, { - name:"Expression with multiple subqueriees containing aggregates : CAST((SELECT COUNT(1) FROM products) AS LIST)[0]._1 / CAST((SELECT COUNT(1) FROM suppliers) AS LIST)[0]._1", - statement:"CAST((SELECT COUNT(1) FROM products) AS LIST)[0]._1 / CAST((SELECT COUNT(1) FROM suppliers) AS LIST)[0]._1", + name:"Expression with multiple subqueries containing aggregates : (SELECT COUNT(1) FROM products) / (SELECT COUNT(1) FROM suppliers)", + statement:"(SELECT COUNT(1) FROM products) / (SELECT COUNT(1) FROM suppliers)", assert:{ result:EvaluationSuccess, evalMode:[ @@ -7387,8 +7387,8 @@ } }, { - name:"Aggregates with subquery containing another aggregate : SELECT COUNT(1) + CAST((SELECT SUM(numInStock) FROM products) AS LIST)[0]._1 as a_number FROM products", - statement:"SELECT COUNT(1) + CAST((SELECT SUM(numInStock) FROM products) AS LIST)[0]._1 as a_number FROM products", + name:"Aggregates with subquery containing another aggregate : SELECT COUNT(1) + (SELECT SUM(numInStock) FROM products) as a_number FROM products", + statement:"SELECT COUNT(1) + (SELECT SUM(numInStock) FROM products) as a_number FROM products", assert:{ result:EvaluationSuccess, evalMode:[ diff --git a/partiql-tests-data/eval/query/select/sql-aggregate.ion b/partiql-tests-data/eval/query/select/sql-aggregate.ion index 9c2c65b..e578ea2 100644 --- a/partiql-tests-data/eval/query/select/sql-aggregate.ion +++ b/partiql-tests-data/eval/query/select/sql-aggregate.ion @@ -832,31 +832,11 @@ multiple_sql_aggregates::[ evalMode:[EvalModeCoerce, EvalModeError], result:EvaluationSuccess, output:$bag::[ - $bag::[ - { - result:27. - } - ], - $bag::[ - { - result:29.0 - } - ], - $bag::[ - { - result:31. - } - ], - $bag::[ - { - result:33. - } - ], - $bag::[ - { - result:35. - } - ] + 27., + 29.0, + 31., + 33., + 35. ] } }, From 3dba584495606c6b7fe0f3bb3fa11b1a6c8595fe Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Wed, 17 Apr 2024 12:17:50 -0700 Subject: [PATCH 3/6] Fixes even more tests --- partiql-tests-data/eval/misc.ion | 30 +- .../eval/query/group-by/group-by.ion | 2015 +++++++++-------- .../eval/query/select/projection.ion | 26 +- .../eval/query/select/select.ion | 30 +- .../eval/query/select/sql-aggregate.ion | 252 ++- .../query/undefined-variable-behavior.ion | 26 +- partiql-tests-data/eval/spec-tests.ion | 130 +- 7 files changed, 1369 insertions(+), 1140 deletions(-) diff --git a/partiql-tests-data/eval/misc.ion b/partiql-tests-data/eval/misc.ion index a302ce1..75c516e 100644 --- a/partiql-tests-data/eval/misc.ion +++ b/partiql-tests-data/eval/misc.ion @@ -110,18 +110,24 @@ uncategorized::[ { name:"selectValueStructConstructorWithMissing", statement:"SELECT VALUE {'x': a.x, 'y': a.y} FROM `[{x:5}, {y:6}]` AS a", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - { - x:5 - }, - { - y:6 - } - ] - } + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + { + x:5 + }, + { + y:6 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"selectIndexStruct", diff --git a/partiql-tests-data/eval/query/group-by/group-by.ion b/partiql-tests-data/eval/query/group-by/group-by.ion index 166022d..b5a4232 100644 --- a/partiql-tests-data/eval/query/group-by/group-by.ion +++ b/partiql-tests-data/eval/query/group-by/group-by.ion @@ -1666,134 +1666,153 @@ { name:"SELECT supplierId_missings FROM products_sparse p GROUP BY p.supplierId_missings", statement:"SELECT supplierId_missings FROM products_sparse p GROUP BY p.supplierId_missings", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - supplierId_missings:10 - }, - { - supplierId_missings:11 - }, - { - supplierId_missings:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + supplierId_missings:10 + }, + { + supplierId_missings:11 + }, + { + supplierId_missings:null // missing coerced to null as per 11.1.1 + } + ] + }, + + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.supplierId_missings FROM products_sparse p GROUP BY p.supplierId_missings", statement:"SELECT p.supplierId_missings FROM products_sparse p GROUP BY p.supplierId_missings", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - supplierId_missings:10 - }, - { - supplierId_missings:11 - }, - { - supplierId_missings:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + supplierId_missings:10 + }, + { + supplierId_missings:11 + }, + { + supplierId_missings:null // missing coerced to null as per 11.1.1 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT VALUE { 'supplierId_missings' : p.supplierId_missings } FROM products_sparse p GROUP BY p.supplierId_missings", statement:"SELECT VALUE { 'supplierId_missings' : p.supplierId_missings } FROM products_sparse p GROUP BY p.supplierId_missings", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - supplierId_missings:10 - }, - { - supplierId_missings:11 - }, - { - supplierId_missings:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + supplierId_missings:10 + }, + { + supplierId_missings:11 + }, + { + supplierId_missings:null // missing coerced to null as per 11.1.1 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT supplierId_mixed FROM products_sparse p GROUP BY p.supplierId_mixed", statement:"SELECT supplierId_mixed FROM products_sparse p GROUP BY p.supplierId_mixed", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - supplierId_mixed:10 - }, - { - supplierId_mixed:11 - }, - { - supplierId_mixed:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + supplierId_mixed:10 + }, + { + supplierId_mixed:11 + }, + { + supplierId_mixed:null // missing coerced to null as per 11.1.1 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.supplierId_mixed FROM products_sparse p GROUP BY p.supplierId_mixed", statement:"SELECT p.supplierId_mixed FROM products_sparse p GROUP BY p.supplierId_mixed", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - supplierId_mixed:10 - }, - { - supplierId_mixed:11 - }, - { - supplierId_mixed:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + supplierId_mixed:10 + }, + { + supplierId_mixed:11 + }, + { + supplierId_mixed:null // missing coerced to null as per 11.1.1 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT VALUE { 'supplierId_mixed' : p.supplierId_mixed } FROM products_sparse p GROUP BY p.supplierId_mixed", statement:"SELECT VALUE { 'supplierId_mixed' : p.supplierId_mixed } FROM products_sparse p GROUP BY p.supplierId_mixed", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - supplierId_mixed:10 - }, - { - supplierId_mixed:11 - }, - { - supplierId_mixed:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + supplierId_mixed:10 + }, + { + supplierId_mixed:11 + }, + { + supplierId_mixed:null // missing coerced to null as per 11.1.1 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT regionId, supplierId_nulls FROM products_sparse p GROUP BY p.regionId, p.supplierId_nulls", @@ -1872,224 +1891,242 @@ { name:"SELECT regionId, supplierId_missings FROM products_sparse p GROUP BY p.regionId, p.supplierId_missings", statement:"SELECT regionId, supplierId_missings FROM products_sparse p GROUP BY p.regionId, p.supplierId_missings", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - regionId:100, - supplierId_missings:10 - }, - { - regionId:100, - supplierId_missings:11 - }, - { - regionId:100, - supplierId_missings:null // missing coerced to null as per 11.1.1 - }, - { - regionId:200, - supplierId_missings:10 - }, - { - regionId:200, - supplierId_missings:11 - }, - { - regionId:200, - supplierId_missings:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + regionId:100, + supplierId_missings:10 + }, + { + regionId:100, + supplierId_missings:11 + }, + { + regionId:100, + supplierId_missings:null // missing coerced to null as per 11.1.1 + }, + { + regionId:200, + supplierId_missings:10 + }, + { + regionId:200, + supplierId_missings:11 + }, + { + regionId:200, + supplierId_missings:null // missing coerced to null as per 11.1.1 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.regionId, p.supplierId_missings FROM products_sparse p GROUP BY p.regionId, p.supplierId_missings", statement:"SELECT p.regionId, p.supplierId_missings FROM products_sparse p GROUP BY p.regionId, p.supplierId_missings", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - regionId:100, - supplierId_missings:10 - }, - { - regionId:100, - supplierId_missings:11 - }, - { - regionId:100, - supplierId_missings:null // missing coerced to null as per 11.1.1 - }, - { - regionId:200, - supplierId_missings:10 - }, - { - regionId:200, - supplierId_missings:11 - }, - { - regionId:200, - supplierId_missings:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + regionId:100, + supplierId_missings:10 + }, + { + regionId:100, + supplierId_missings:11 + }, + { + regionId:100, + supplierId_missings:null // missing coerced to null as per 11.1.1 + }, + { + regionId:200, + supplierId_missings:10 + }, + { + regionId:200, + supplierId_missings:11 + }, + { + regionId:200, + supplierId_missings:null // missing coerced to null as per 11.1.1 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT VALUE { 'regionId': p.regionId, 'supplierId_missings': p.supplierId_missings } FROM products_sparse p GROUP BY p.regionId, p.supplierId_missings", statement:"SELECT VALUE { 'regionId': p.regionId, 'supplierId_missings': p.supplierId_missings } FROM products_sparse p GROUP BY p.regionId, p.supplierId_missings", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - regionId:100, - supplierId_missings:10 - }, - { - regionId:100, - supplierId_missings:11 - }, - { - regionId:100, - supplierId_missings:null // missing coerced to null as per 11.1.1 - }, - { - regionId:200, - supplierId_missings:10 - }, - { - regionId:200, - supplierId_missings:11 - }, - { - regionId:200, - supplierId_missings:null // missing coerced to null as per 11.1.1 - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + regionId:100, + supplierId_missings:10 + }, + { + regionId:100, + supplierId_missings:11 + }, + { + regionId:100, + supplierId_missings:null // missing coerced to null as per 11.1.1 + }, + { + regionId:200, + supplierId_missings:10 + }, + { + regionId:200, + supplierId_missings:11 + }, + { + regionId:200, + supplierId_missings:null // missing coerced to null as per 11.1.1 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT regionId, supplierId_mixed FROM products_sparse p GROUP BY p.regionId, p.supplierId_mixed", statement:"SELECT regionId, supplierId_mixed FROM products_sparse p GROUP BY p.regionId, p.supplierId_mixed", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - regionId:100, - supplierId_mixed:10 - }, - { - regionId:100, - supplierId_mixed:11 - }, - { - regionId:100, - supplierId_mixed:null // missing coerced to null as per 11.1.1 - }, - { - regionId:200, - supplierId_mixed:10 - }, - { - regionId:200, - supplierId_mixed:11 - }, - { - regionId:200, - supplierId_mixed:null - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + regionId:100, + supplierId_mixed:10 + }, + { + regionId:100, + supplierId_mixed:11 + }, + { + regionId:100, + supplierId_mixed:null // missing coerced to null as per 11.1.1 + }, + { + regionId:200, + supplierId_mixed:10 + }, + { + regionId:200, + supplierId_mixed:11 + }, + { + regionId:200, + supplierId_mixed:null + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT regionId, p.supplierId_mixed FROM products_sparse p GROUP BY p.regionId, p.supplierId_mixed", statement:"SELECT regionId, p.supplierId_mixed FROM products_sparse p GROUP BY p.regionId, p.supplierId_mixed", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - regionId:100, - supplierId_mixed:10 - }, - { - regionId:100, - supplierId_mixed:11 - }, - { - regionId:100, - supplierId_mixed:null // missing coerced to null as per 11.1.1 - }, - { - regionId:200, - supplierId_mixed:10 - }, - { - regionId:200, - supplierId_mixed:11 - }, - { - regionId:200, - supplierId_mixed:null - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + regionId:100, + supplierId_mixed:10 + }, + { + regionId:100, + supplierId_mixed:11 + }, + { + regionId:100, + supplierId_mixed:null // missing coerced to null as per 11.1.1 + }, + { + regionId:200, + supplierId_mixed:10 + }, + { + regionId:200, + supplierId_mixed:11 + }, + { + regionId:200, + supplierId_mixed:null + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT VALUE { 'regionId': p.regionId, 'supplierId_mixed': p.supplierId_mixed } FROM products_sparse p GROUP BY p.regionId, p.supplierId_mixed", statement:"SELECT VALUE { 'regionId': p.regionId, 'supplierId_mixed': p.supplierId_mixed } FROM products_sparse p GROUP BY p.regionId, p.supplierId_mixed", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - regionId:100, - supplierId_mixed:10 - }, - { - regionId:100, - supplierId_mixed:11 - }, - { - regionId:100, - supplierId_mixed:null // missing coerced to null as per 11.1.1 - }, - { - regionId:200, - supplierId_mixed:10 - }, - { - regionId:200, - supplierId_mixed:11 - }, - { - regionId:200, - supplierId_mixed:null - } - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + regionId:100, + supplierId_mixed:10 + }, + { + regionId:100, + supplierId_mixed:11 + }, + { + regionId:100, + supplierId_mixed:null // missing coerced to null as per 11.1.1 + }, + { + regionId:200, + supplierId_mixed:10 + }, + { + regionId:200, + supplierId_mixed:11 + }, + { + regionId:200, + supplierId_mixed:null + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, ] @@ -5714,23 +5751,206 @@ { name:"SELECT COUNT(1) AS the_count, COUNT(p.price_missings) AS the_agg FROM products_sparse AS p", statement:"SELECT COUNT(1) AS the_count, COUNT(p.price_missings) AS the_agg FROM products_sparse AS p", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - the_count:10, - the_agg:5 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:5 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT COUNT(1) AS the_count, SUM(p.price_missings) AS the_agg FROM products_sparse AS p", statement:"SELECT COUNT(1) AS the_count, SUM(p.price_missings) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:15.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p", + statement:"SELECT COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:1.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT COUNT(1) AS the_count, MAX(p.price_missings) AS the_agg FROM products_sparse AS p", + statement:"SELECT COUNT(1) AS the_count, MAX(p.price_missings) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:5.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p", + statement:"SELECT COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:3.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p", + statement:"SELECT COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:5 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p", + statement:"SELECT COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:15.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p", + statement:"SELECT COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:1.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p", + statement:"SELECT COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:5.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p", + statement:"SELECT COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + the_count:10, + the_agg:3.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT categoryId, COUNT(1) AS the_count, COUNT( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, COUNT( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -5739,15 +5959,21 @@ ], output:$bag::[ { - the_count:10, - the_agg:15.0 + categoryId:20, + the_count:4, + the_agg:3 + }, + { + categoryId:21, + the_count:6, + the_agg:2 } ] } }, { - name:"SELECT COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p", - statement:"SELECT COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p", + name:"SELECT categoryId, COUNT(1) AS the_count, SUM( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, SUM( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -5756,15 +5982,21 @@ ], output:$bag::[ { - the_count:10, - the_agg:1.0 + categoryId:20, + the_count:4, + the_agg:6.0 + }, + { + categoryId:21, + the_count:6, + the_agg:9.0 } ] } }, { - name:"SELECT COUNT(1) AS the_count, MAX(p.price_missings) AS the_agg FROM products_sparse AS p", - statement:"SELECT COUNT(1) AS the_count, MAX(p.price_missings) AS the_agg FROM products_sparse AS p", + name:"SELECT categoryId, COUNT(1) AS the_count, MIN( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, MIN( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -5773,15 +6005,21 @@ ], output:$bag::[ { - the_count:10, - the_agg:5.0 + categoryId:20, + the_count:4, + the_agg:1.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.0 } ] } }, { - name:"SELECT COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p", - statement:"SELECT COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p", + name:"SELECT categoryId, COUNT(1) AS the_count, MAX( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, MAX( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -5790,15 +6028,21 @@ ], output:$bag::[ { - the_count:10, + categoryId:20, + the_count:4, the_agg:3.0 + }, + { + categoryId:21, + the_count:6, + the_agg:5.0 } ] } }, { - name:"SELECT COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p", - statement:"SELECT COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p", + name:"SELECT categoryId, COUNT(1) AS the_count, AVG( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, AVG( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -5807,191 +6051,14 @@ ], output:$bag::[ { - the_count:10, - the_agg:5 - } - ] - } - }, - { - name:"SELECT COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p", - statement:"SELECT COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - the_count:10, - the_agg:15.0 - } - ] - } - }, - { - name:"SELECT COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p", - statement:"SELECT COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - the_count:10, - the_agg:1.0 - } - ] - } - }, - { - name:"SELECT COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p", - statement:"SELECT COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - the_count:10, - the_agg:5.0 - } - ] - } - }, - { - name:"SELECT COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p", - statement:"SELECT COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - the_count:10, - the_agg:3.0 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, COUNT( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, COUNT( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3 - }, - { - categoryId:21, - the_count:6, - the_agg:2 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, SUM( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, SUM( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:6.0 - }, - { - categoryId:21, - the_count:6, - the_agg:9.0 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, MIN( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, MIN( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:1.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.0 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, MAX( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, MAX( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3.0 - }, - { - categoryId:21, - the_count:6, - the_agg:5.0 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, AVG( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, AVG( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:2.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.5 + categoryId:20, + the_count:4, + the_agg:2.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.5 } ] } @@ -6374,75 +6441,266 @@ { name:"SELECT categoryId, COUNT(1) AS the_count, COUNT(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", statement:"SELECT categoryId, COUNT(1) AS the_count, COUNT(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3 - }, - { - categoryId:21, - the_count:6, - the_agg:2 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:3 + }, + { + categoryId:21, + the_count:6, + the_agg:2 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT categoryId, COUNT(1) AS the_count, SUM(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", statement:"SELECT categoryId, COUNT(1) AS the_count, SUM(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:6.0 - }, - { - categoryId:21, - the_count:6, - the_agg:9.0 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:1.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.0 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:6.0 + }, + { + categoryId:21, + the_count:6, + the_agg:9.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT categoryId, COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:1.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT categoryId, COUNT(1) AS the_count, MAX(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", statement:"SELECT categoryId, COUNT(1) AS the_count, MAX(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:3.0 + }, + { + categoryId:21, + the_count:6, + the_agg:5.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT categoryId, COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:2.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.5 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT categoryId, COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:3 + }, + { + categoryId:21, + the_count:6, + the_agg:2 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT categoryId, COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:6.0 + }, + { + categoryId:21, + the_count:6, + the_agg:9.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT categoryId, COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:1.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT categoryId, COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:3.0 + }, + { + categoryId:21, + the_count:6, + the_agg:5.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT categoryId, COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + statement:"SELECT categoryId, COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:2.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.5 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] + }, + { + name:"SELECT p.categoryId, COUNT(1) AS the_count, COUNT( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", + statement:"SELECT p.categoryId, COUNT(1) AS the_count, COUNT( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -6453,19 +6711,19 @@ { categoryId:20, the_count:4, - the_agg:3.0 + the_agg:3 }, { categoryId:21, the_count:6, - the_agg:5.0 + the_agg:2 } ] } }, { - name:"SELECT categoryId, COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + name:"SELECT p.categoryId, COUNT(1) AS the_count, SUM( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", + statement:"SELECT p.categoryId, COUNT(1) AS the_count, SUM( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -6476,19 +6734,19 @@ { categoryId:20, the_count:4, - the_agg:2.0 + the_agg:6.0 }, { categoryId:21, the_count:6, - the_agg:4.5 + the_agg:9.0 } ] } }, { - name:"SELECT categoryId, COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + name:"SELECT p.categoryId, COUNT(1) AS the_count, MIN( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", + statement:"SELECT p.categoryId, COUNT(1) AS the_count, MIN( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -6499,19 +6757,19 @@ { categoryId:20, the_count:4, - the_agg:3 + the_agg:1.0 }, { categoryId:21, the_count:6, - the_agg:2 + the_agg:4.0 } ] } }, { - name:"SELECT categoryId, COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", + name:"SELECT p.categoryId, COUNT(1) AS the_count, MAX( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", + statement:"SELECT p.categoryId, COUNT(1) AS the_count, MAX( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", assert:{ result:EvaluationSuccess, evalMode:[ @@ -6522,168 +6780,7 @@ { categoryId:20, the_count:4, - the_agg:6.0 - }, - { - categoryId:21, - the_count:6, - the_agg:9.0 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:1.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.0 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3.0 - }, - { - categoryId:21, - the_count:6, - the_agg:5.0 - } - ] - } - }, - { - name:"SELECT categoryId, COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - statement:"SELECT categoryId, COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:2.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.5 - } - ] - } - }, - { - name:"SELECT p.categoryId, COUNT(1) AS the_count, COUNT( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - statement:"SELECT p.categoryId, COUNT(1) AS the_count, COUNT( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3 - }, - { - categoryId:21, - the_count:6, - the_agg:2 - } - ] - } - }, - { - name:"SELECT p.categoryId, COUNT(1) AS the_count, SUM( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - statement:"SELECT p.categoryId, COUNT(1) AS the_count, SUM( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:6.0 - }, - { - categoryId:21, - the_count:6, - the_agg:9.0 - } - ] - } - }, - { - name:"SELECT p.categoryId, COUNT(1) AS the_count, MIN( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - statement:"SELECT p.categoryId, COUNT(1) AS the_count, MIN( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:1.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.0 - } - ] - } - }, - { - name:"SELECT p.categoryId, COUNT(1) AS the_count, MAX( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - statement:"SELECT p.categoryId, COUNT(1) AS the_count, MAX( price_nulls) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3.0 + the_agg:3.0 }, { categoryId:21, @@ -7094,232 +7191,262 @@ { name:"SELECT p.categoryId, COUNT(1) AS the_count, COUNT(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, COUNT(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3 - }, - { - categoryId:21, - the_count:6, - the_agg:2 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:3 + }, + { + categoryId:21, + the_count:6, + the_agg:2 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, SUM(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, SUM(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:6.0 - }, - { - categoryId:21, - the_count:6, - the_agg:9.0 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:6.0 + }, + { + categoryId:21, + the_count:6, + the_agg:9.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, MIN(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:1.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.0 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:1.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, MAX(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, MAX(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3.0 - }, - { - categoryId:21, - the_count:6, - the_agg:5.0 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:3.0 + }, + { + categoryId:21, + the_count:6, + the_agg:5.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, AVG(p.price_missings) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:2.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.5 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:2.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.5 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, COUNT(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3 - }, - { - categoryId:21, - the_count:6, - the_agg:2 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:3 + }, + { + categoryId:21, + the_count:6, + the_agg:2 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, SUM(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:6.0 - }, - { - categoryId:21, - the_count:6, - the_agg:9.0 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:6.0 + }, + { + categoryId:21, + the_count:6, + the_agg:9.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, MIN(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:1.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.0 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:1.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, MAX(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:3.0 - }, - { - categoryId:21, - the_count:6, - the_agg:5.0 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:3.0 + }, + { + categoryId:21, + the_count:6, + the_agg:5.0 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SELECT p.categoryId, COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", statement:"SELECT p.categoryId, COUNT(1) AS the_count, AVG(p.price_mixed) AS the_agg FROM products_sparse AS p GROUP BY p.categoryId", - assert:{ - result:EvaluationSuccess, - evalMode:[ - EvalModeCoerce, - EvalModeError - ], - output:$bag::[ - { - categoryId:20, - the_count:4, - the_agg:2.0 - }, - { - categoryId:21, - the_count:6, - the_agg:4.5 - } - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode: EvalModeCoerce, + output:$bag::[ + { + categoryId:20, + the_count:4, + the_agg:2.0 + }, + { + categoryId:21, + the_count:6, + the_agg:4.5 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, ] diff --git a/partiql-tests-data/eval/query/select/projection.ion b/partiql-tests-data/eval/query/select/projection.ion index cc26bd9..91c6bc9 100644 --- a/partiql-tests-data/eval/query/select/projection.ion +++ b/partiql-tests-data/eval/query/select/projection.ion @@ -4,16 +4,22 @@ { name:"undefinedUnqualifiedVariable_inSelect_withProjectionOption", statement:"SELECT s.a, s.undefined_variable, s.b FROM `[{a:100, b:200}]` s", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - { - a:100, - b:200 - } - ] - } + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + { + a:100, + b:200 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"projectionIterationBehaviorUnfiltered_select_list", diff --git a/partiql-tests-data/eval/query/select/select.ion b/partiql-tests-data/eval/query/select/select.ion index 21e4ef8..283694f 100644 --- a/partiql-tests-data/eval/query/select/select.ion +++ b/partiql-tests-data/eval/query/select/select.ion @@ -239,18 +239,24 @@ envs::{ { name:"selectListWithMissing", statement:"SELECT a.x AS x, a.y AS y FROM `[{x:5}, {y:6}]` AS a", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - { - x:5 - }, - { - y:6 - } - ] - } + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + { + x:5 + }, + { + y:6 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] } ] diff --git a/partiql-tests-data/eval/query/select/sql-aggregate.ion b/partiql-tests-data/eval/query/select/sql-aggregate.ion index e578ea2..bb28bca 100644 --- a/partiql-tests-data/eval/query/select/sql-aggregate.ion +++ b/partiql-tests-data/eval/query/select/sql-aggregate.ion @@ -653,24 +653,30 @@ sql_any::[ FROM << {'a': 1, 'b': 10}, {'a': 1, 'b': 17}, {'a': 2, 'b': 20}, {'a': 3} >> AS x GROUP BY x.a ''', - assert:{ - result:EvaluationSuccess, - evalMode:[EvalModeCoerce, EvalModeError], - output:$bag::[ - { - a: 1, - e: true - }, - { - a: 2, - e: false - }, - { - a: 3, - e: null - }, - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + a: 1, + e: true + }, + { + a: 2, + e: false + }, + { + a: 3, + e: null + }, + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"ANY DISTINCT with GROUP BY", @@ -679,24 +685,30 @@ sql_any::[ FROM [ {'a': 1, 'b': 10}, {'a': 1, 'b': 17}, {'a': 2, 'b': 20}, {'a': 3} ] AS x GROUP BY x.a ''', - assert:{ - result:EvaluationSuccess, - evalMode:[EvalModeCoerce, EvalModeError], - output:$bag::[ - { - a: 1, - e: true - }, - { - a: 2, - e: false - }, - { - a: 3, - e: null - }, - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + a: 1, + e: true + }, + { + a: 2, + e: false + }, + { + a: 3, + e: null + }, + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] } ] @@ -708,24 +720,30 @@ sql_some::[ FROM << {'a': 1, 'b': 10}, {'a': 1, 'b': 17}, {'a': 2, 'b': 20}, {'a': 3} >> AS x GROUP BY x.a ''', - assert:{ - result:EvaluationSuccess, - evalMode:[EvalModeCoerce, EvalModeError], - output:$bag::[ - { - a: 1, - e: true - }, - { - a: 2, - e: false - }, - { - a: 3, - e: null - }, - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + a: 1, + e: true + }, + { + a: 2, + e: false + }, + { + a: 3, + e: null + }, + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"SOME DISTINCT with GROUP BY", @@ -734,24 +752,30 @@ sql_some::[ FROM [ {'a': 1, 'b': 10}, {'a': 1, 'b': 17}, {'a': 2, 'b': 20}, {'a': 3} ] AS x GROUP BY x.a ''', - assert:{ - result:EvaluationSuccess, - evalMode:[EvalModeCoerce, EvalModeError], - output:$bag::[ - { - a: 1, - e: true - }, - { - a: 2, - e: false - }, - { - a: 3, - e: null - }, - ] - } + assert:[ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + a: 1, + e: true + }, + { + a: 2, + e: false + }, + { + a: 3, + e: null + }, + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] } ] @@ -763,24 +787,30 @@ sql_every::[ FROM << {'a': 1, 'b': 10}, {'a': 1, 'b': 11}, {'a': 2, 'b': 20}, {'a': 3} >> AS x GROUP BY x.a ''', - assert:{ - result:EvaluationSuccess, - evalMode:[EvalModeCoerce, EvalModeError], - output:$bag::[ - { - a: 1, - e: true - }, - { - a: 2, - e: false - }, - { - a: 3, - e: null - }, - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + a: 1, + e: true + }, + { + a: 2, + e: false + }, + { + a: 3, + e: null + }, + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name:"EVERY DISTINCT with GROUP BY", @@ -789,24 +819,30 @@ sql_every::[ FROM [ {'a': 1, 'b': 10}, {'a': 1, 'b': 11}, {'a': 2, 'b': 20}, {'a': 3} ] AS x GROUP BY x.a ''', - assert:{ - result:EvaluationSuccess, - evalMode:[EvalModeCoerce, EvalModeError], - output:$bag::[ - { - a: 1, - e: true - }, - { - a: 2, - e: false - }, - { - a: 3, - e: null - }, - ] - } + assert: [ + { + result:EvaluationSuccess, + evalMode:EvalModeCoerce, + output:$bag::[ + { + a: 1, + e: true + }, + { + a: 2, + e: false + }, + { + a: 3, + e: null + }, + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] } ] diff --git a/partiql-tests-data/eval/query/undefined-variable-behavior.ion b/partiql-tests-data/eval/query/undefined-variable-behavior.ion index 440ab76..7ea66cb 100644 --- a/partiql-tests-data/eval/query/undefined-variable-behavior.ion +++ b/partiql-tests-data/eval/query/undefined-variable-behavior.ion @@ -51,15 +51,21 @@ undefined_variable_behavior::[ { name:"undefinedUnqualifiedVariableInSelectWithUndefinedVariableBehaviorMissing", statement:"SELECT s.a, s.undefined_variable, s.b FROM `[{a:100, b:200}]` s", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - { - a:100, - b:200 - } - ] - } + assert:[ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + { + a:100, + b:200 + } + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] } ] diff --git a/partiql-tests-data/eval/spec-tests.ion b/partiql-tests-data/eval/spec-tests.ion index 2c9acaa..dc6bfc3 100644 --- a/partiql-tests-data/eval/spec-tests.ion +++ b/partiql-tests-data/eval/spec-tests.ion @@ -329,38 +329,62 @@ { name: "attribute value evaluates to MISSING", statement: "SELECT VALUE {'a':v.a, 'b':v.b} FROM [{'a':1, 'b':1}, {'a':2}] AS v", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[{a:1, b:1}, {a:2}] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[{a:1, b:1}, {a:2}] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name: "array element evaluates to MISSING", statement: "SELECT VALUE [v.a, v.b] FROM [{'a':1, 'b':1}, {'a':2}] AS v", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[[1, 1], [2, $missing::null]] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[[1, 1], [2, $missing::null]] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name: "bag element evaluates to MISSING", statement: "SELECT VALUE v.b FROM [{'a':1, 'b':1}, {'a':2}] AS v", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[1, $missing::null] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[1, $missing::null] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name: "bag element evaluates to MISSING in bag constructor", statement: "SELECT VALUE <> FROM [{'a':1, 'b':1}, {'a':2}] AS v", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[$bag::[1, 1], $bag::[2, $missing::null]] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[$bag::[1, 1], $bag::[2, $missing::null]] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name: "pivot into a tuple", @@ -412,11 +436,17 @@ { name: "cast and operations with missing argument", statement: "SELECT VALUE {'a':3*v.a, 'b':3*(CAST(v.b AS INTEGER))} FROM [{'a':1, 'b':'1'}, {'a':2}] v", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[{a:3, b:3}, {a:6}] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[{a:3, b:3}, {a:6}] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name: "missing value in arithmetic expression", @@ -721,15 +751,21 @@ {co:0.5} ] }, - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[ - {sensor:1, readings:$bag::[0.4, 0.2]}, - {sensor:2, readings:$bag::[0.3]}, - {sensor:null, readings:$bag::[0.1, 0.5]} - ] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[ + {sensor:1, readings:$bag::[0.4, 0.2]}, + {sensor:2, readings:$bag::[0.3]}, + {sensor:null, readings:$bag::[0.1, 0.5]} + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name: "group by with differenciated absent values", @@ -749,16 +785,22 @@ {co:0.5} ] }, - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[ - {sensor:1, readings:$bag::[0.4, 0.2]}, - {sensor:2, readings:$bag::[0.3]}, - {sensor:null, readings:$bag::[0.1]}, - {readings:$bag::[0.5]} - ] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[ + {sensor:1, readings:$bag::[0.4, 0.2]}, + {sensor:2, readings:$bag::[0.3]}, + {sensor:null, readings:$bag::[0.1]}, + {readings:$bag::[0.5]} + ] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name: "windowing simplified with grouping", From fa00ccd7226c4dc16fd0df9265a9196fd0559146 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Wed, 17 Apr 2024 15:40:21 -0700 Subject: [PATCH 4/6] Fixes WHERE test and previously updated test --- partiql-tests-data/eval/spec-tests.ion | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/partiql-tests-data/eval/spec-tests.ion b/partiql-tests-data/eval/spec-tests.ion index dc6bfc3..cac8f52 100644 --- a/partiql-tests-data/eval/spec-tests.ion +++ b/partiql-tests-data/eval/spec-tests.ion @@ -147,7 +147,7 @@ statement: "SELECT x FROM someOrderedTable[0].a AS x", assert: [ { - evalMode: [EvalModeCoerce, EvalModeError], + evalMode: EvalModeCoerce, result: EvaluationSuccess, output: $bag::[{x: 0}] }, @@ -637,11 +637,17 @@ { name: "WHERE clause eliminating absent values", statement: "SELECT VALUE v.a FROM [{'a':1, 'b':true}, {'a':2, 'b':null}, {'a':3}] v WHERE v.b", - assert: { - evalMode: [EvalModeCoerce, EvalModeError], - result: EvaluationSuccess, - output: $bag::[1] - } + assert: [ + { + evalMode: EvalModeCoerce, + result: EvaluationSuccess, + output: $bag::[1] + }, + { + evalMode:EvalModeError, + result:EvaluationFail + }, + ] }, { name: "null is missing", From 1da4e8b89e9f50072e9540d1bd6e51fd0a992b25 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Thu, 18 Apr 2024 10:47:34 -0700 Subject: [PATCH 5/6] Adds more fixed tests --- .../eval/query/select/from-clause.ion | 216 ++++++++++-------- 1 file changed, 125 insertions(+), 91 deletions(-) diff --git a/partiql-tests-data/eval/query/select/from-clause.ion b/partiql-tests-data/eval/query/select/from-clause.ion index ffd16c0..0fb0730 100644 --- a/partiql-tests-data/eval/query/select/from-clause.ion +++ b/partiql-tests-data/eval/query/select/from-clause.ion @@ -86,64 +86,82 @@ envs::{ { name:"selectFromScalarAndAtUnpivotWildCardOverScalar", statement:"SELECT VALUE [n, v] FROM (100).* AS v AT n", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - [ - "_1", - 100 + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + [ + $missing::null, + 100 + ] ] - ] - } + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"selectFromListAndAtUnpivotWildCardOverScalar", statement:"SELECT VALUE [n, (SELECT VALUE [i, x] FROM @v AS x AT i)] FROM [100, 200].*.*.* AS v AT n", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - [ - "_1", - $bag::[ - [ - 0, - 100 - ], - [ - 1, - 200 + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + [ + $missing::null, + $bag::[ + [ + 0, + 100 + ], + [ + 1, + 200 + ] ] ] ] - ] - } + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"selectFromBagAndAtUnpivotWildCardOverScalar", statement:"SELECT VALUE [n, (SELECT VALUE [i IS MISSING, i, x] FROM @v AS x AT i)] FROM <<100, 200>>.* AS v AT n", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - [ - "_1", - $bag::[ - [ - true, - $missing::null, - 100 - ], - [ - true, - $missing::null, - 200 + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + [ + $missing::null, + $bag::[ + [ + true, + $missing::null, + 100 + ], + [ + true, + $missing::null, + 200 + ] ] ] ] - ] - } + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"selectPathUnpivotWildCardOverStructMultiple", @@ -270,26 +288,30 @@ envs::{ evalMode:[EvalModeCoerce, EvalModeError], result:EvaluationSuccess, output:$bag::[ - ( - a - b - c - ) + a, + b, + c ] } }, { name:"rangeOverStruct", statement:"SELECT VALUE v FROM `{a:5}` AS v", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - { - a:5 - } - ] - } + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + { + a:5 + } + ] + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"rangeOverList", @@ -377,45 +399,57 @@ envs::{ { name:"rangeOverBagWithAt", statement:"SELECT VALUE [i, v] FROM <<1, 2, 3>> AS v AT i", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - [ - $missing::null, - 1 - ], - [ - $missing::null, - 2 - ], - [ - $missing::null, - 3 + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + [ + $missing::null, + 1 + ], + [ + $missing::null, + 2 + ], + [ + $missing::null, + 3 + ] ] - ] - } + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] }, { name:"rangeOverNestedWithAt", statement:"SELECT VALUE [i, v] FROM (SELECT VALUE v FROM `[1, 2, 3]` AS v) AS v AT i", - assert:{ - evalMode:[EvalModeCoerce, EvalModeError], - result:EvaluationSuccess, - output:$bag::[ - [ - $missing::null, - 1 - ], - [ - $missing::null, - 2 - ], - [ - $missing::null, - 3 + assert: [ + { + evalMode:EvalModeCoerce, + result:EvaluationSuccess, + output:$bag::[ + [ + $missing::null, + 1 + ], + [ + $missing::null, + 2 + ], + [ + $missing::null, + 3 + ] ] - ] - } + }, + { + evalMode: EvalModeError, + result: EvaluationFail, + }, + ] } ] From b3bf59f59029fb3919f44312c9e30646f403f155 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Tue, 21 May 2024 13:38:32 -0700 Subject: [PATCH 6/6] Per PR feedback, removes FROM and UNPIVOT mistyping cases --- .../eval/primitives/date-time.ion | 32 ++-- .../eval/query/select/from-clause.ion | 170 +++++++----------- partiql-tests-data/eval/spec-tests.ion | 64 +++---- 3 files changed, 101 insertions(+), 165 deletions(-) diff --git a/partiql-tests-data/eval/primitives/date-time.ion b/partiql-tests-data/eval/primitives/date-time.ion index 71995bc..e0c9eab 100644 --- a/partiql-tests-data/eval/primitives/date-time.ion +++ b/partiql-tests-data/eval/primitives/date-time.ion @@ -2,26 +2,20 @@ regression::[ { name:"dateTimePartsAsVariableNames", statement:"SELECT VALUE [year, month, day, hour, minute, second] FROM 1968 AS year, 4 AS month, 3 as day, 12 as hour, 31 as minute, 59 as second", - assert:[ - { - evalMode:EvalModeCoerce, - result:EvaluationSuccess, - output:$bag::[ - [ - 1968, - 4, - 3, - 12, - 31, - 59 - ] + assert:{ + evalMode:[EvalModeCoerce, EvalModeError], + result:EvaluationSuccess, + output:$bag::[ + [ + 1968, + 4, + 3, + 12, + 31, + 59 ] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - }, - ] + ] + } }, { name:"dateTimePartsAsStructFieldNames", diff --git a/partiql-tests-data/eval/query/select/from-clause.ion b/partiql-tests-data/eval/query/select/from-clause.ion index 0fb0730..5b7865d 100644 --- a/partiql-tests-data/eval/query/select/from-clause.ion +++ b/partiql-tests-data/eval/query/select/from-clause.ion @@ -86,82 +86,64 @@ envs::{ { name:"selectFromScalarAndAtUnpivotWildCardOverScalar", statement:"SELECT VALUE [n, v] FROM (100).* AS v AT n", - assert: [ - { - evalMode:EvalModeCoerce, - result:EvaluationSuccess, - output:$bag::[ - [ - $missing::null, - 100 - ] + assert:{ + evalMode:[EvalModeCoerce, EvalModeError], + result:EvaluationSuccess, + output:$bag::[ + [ + "_1", + 100 ] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - }, - ] + ] + } }, { name:"selectFromListAndAtUnpivotWildCardOverScalar", statement:"SELECT VALUE [n, (SELECT VALUE [i, x] FROM @v AS x AT i)] FROM [100, 200].*.*.* AS v AT n", - assert: [ - { - evalMode:EvalModeCoerce, - result:EvaluationSuccess, - output:$bag::[ - [ - $missing::null, - $bag::[ - [ - 0, - 100 - ], - [ - 1, - 200 - ] + assert:{ + evalMode:[EvalModeCoerce, EvalModeError], + result:EvaluationSuccess, + output:$bag::[ + [ + "_1", + $bag::[ + [ + 0, + 100 + ], + [ + 1, + 200 ] ] ] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - }, - ] + ] + } }, { name:"selectFromBagAndAtUnpivotWildCardOverScalar", statement:"SELECT VALUE [n, (SELECT VALUE [i IS MISSING, i, x] FROM @v AS x AT i)] FROM <<100, 200>>.* AS v AT n", - assert: [ - { - evalMode:EvalModeCoerce, - result:EvaluationSuccess, - output:$bag::[ - [ - $missing::null, - $bag::[ - [ - true, - $missing::null, - 100 - ], - [ - true, - $missing::null, - 200 - ] + assert:{ + evalMode:[EvalModeCoerce, EvalModeError], + result:EvaluationSuccess, + output:$bag::[ + [ + "_1", + $bag::[ + [ + true, + $missing::null, + 100 + ], + [ + true, + $missing::null, + 200 ] ] ] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - }, - ] + ] + } }, { name:"selectPathUnpivotWildCardOverStructMultiple", @@ -249,37 +231,27 @@ envs::{ { name:"rangeOverScalar", statement:"SELECT VALUE v FROM 1 AS v", - assert:[ - { - evalMode:EvalModeCoerce, - result:EvaluationSuccess, - output:$bag::[ 1 ] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - }, - ] + assert:{ + evalMode:[EvalModeCoerce, EvalModeError], + result:EvaluationSuccess, + output:$bag::[ + 1 + ] + } }, { name:"rangeTwiceOverScalar", statement:"SELECT VALUE [v1, v2] FROM 1 AS v1, @v1 AS v2", - assert:[ - { - evalMode:EvalModeCoerce, - result:EvaluationSuccess, - output:$bag::[ - [ - 1, - 1 - ] + assert:{ + evalMode:[EvalModeCoerce, EvalModeError], + result:EvaluationSuccess, + output:$bag::[ + [ + 1, + 1 ] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - }, - ] + ] + } }, { name:"rangeOverSexp", @@ -297,21 +269,15 @@ envs::{ { name:"rangeOverStruct", statement:"SELECT VALUE v FROM `{a:5}` AS v", - assert: [ - { - evalMode:EvalModeCoerce, - result:EvaluationSuccess, - output:$bag::[ - { - a:5 - } - ] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - }, - ] + assert:{ + evalMode:[EvalModeCoerce, EvalModeError], + result:EvaluationSuccess, + output:$bag::[ + { + a:5 + } + ] + } }, { name:"rangeOverList", diff --git a/partiql-tests-data/eval/spec-tests.ion b/partiql-tests-data/eval/spec-tests.ion index cac8f52..6d138fc 100644 --- a/partiql-tests-data/eval/spec-tests.ion +++ b/partiql-tests-data/eval/spec-tests.ion @@ -145,17 +145,11 @@ { name: "single source FROM with scalar", statement: "SELECT x FROM someOrderedTable[0].a AS x", - assert: [ - { - evalMode: EvalModeCoerce, - result: EvaluationSuccess, - output: $bag::[{x: 0}] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - } - ] + assert: { + evalMode: [EvalModeCoerce, EvalModeError], + result: EvaluationSuccess, + output: $bag::[{x: 0}] + } }, { name: "single source FROM with scalar and AT clause", @@ -175,17 +169,11 @@ { name: "single source FROM with tuple", statement: "SELECT x FROM {'someKey': 'someValue' } AS x", - assert: [ - { - evalMode: EvalModeCoerce, - result: EvaluationSuccess, - output: $bag::[{x: {someKey: "someValue"}}] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - } - ] + assert: { + evalMode: [EvalModeCoerce, EvalModeError], + result: EvaluationSuccess, + output: $bag::[{x: {someKey: "someValue"}}] + } }, { name: "single source FROM with tuple and AT clause", @@ -205,17 +193,11 @@ { name: "single source FROM with absent value null", statement: "SELECT x FROM NULL AS x", - assert: [ - { - evalMode: EvalModeCoerce, - result: EvaluationSuccess, - output: $bag::[{x: null}] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - } - ] + assert: { + evalMode: [EvalModeCoerce, EvalModeError], + result: EvaluationSuccess, + output: $bag::[{x: null}] + } }, { name: "single source FROM with absent value null and AT clause", @@ -235,17 +217,11 @@ { name: "single source FROM with absent value missing", statement: "SELECT x FROM MISSING AS x", - assert: [ - { - evalMode: EvalModeCoerce, - result: EvaluationSuccess, - output: $bag::[{}] - }, - { - evalMode: EvalModeError, - result: EvaluationFail, - }, - ] + assert: { + evalMode: [EvalModeCoerce, EvalModeError], + result: EvaluationSuccess, + output: $bag::[{}] + } }, { name: "single source FROM with absent value missing and AT clause",