Skip to content

Commit

Permalink
Fix null/missing set op coerce tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Aug 21, 2024
1 parent 3183bb0 commit 8c39883
Showing 1 changed file with 54 additions and 8 deletions.
62 changes: 54 additions & 8 deletions partiql-tests-data/eval/primitives/operators/bag-operators.ion
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ bagOperators::[
result:EvaluationSuccess,
output:$bag::[
null,
$missing::null
]
},
{
Expand Down Expand Up @@ -261,7 +260,8 @@ bagOperators::[
{
evalMode:EvalModeCoerce,
result:EvaluationSuccess,
output:$bag::[ // still empty bag since both sides coerce to bag of absent value
output:$bag::[
null
]
},
{
Expand Down Expand Up @@ -325,9 +325,7 @@ bagOperators::[
{
evalMode:EvalModeCoerce,
result:EvaluationSuccess,
output:$bag::[
null
]
output:$bag::[]
},
{
evalMode: EvalModeError,
Expand Down Expand Up @@ -395,7 +393,7 @@ bagOperators::[
}
},
{
name:"SQL UNION with ORDER BY LIMIT on children and bag op",
name:"SQL UNION with ORDER BY LIMIT on children and set op",
statement:"(SELECT a, tbl FROM t1 ORDER BY a LIMIT 2) UNION ALL (SELECT a, tbl FROM t2 ORDER BY a LIMIT 2) ORDER BY a LIMIT 2",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
Expand All @@ -413,7 +411,7 @@ bagOperators::[
}
},
{
name:"SQL INTERSECT with ORDER BY LIMIT on children and bag op",
name:"SQL INTERSECT with ORDER BY LIMIT on children and set op",
statement:"(SELECT a FROM t1 ORDER BY a LIMIT 4) INTERSECT ALL (SELECT a FROM t2 ORDER BY a LIMIT 4) ORDER BY a LIMIT 2",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
Expand All @@ -429,7 +427,7 @@ bagOperators::[
}
},
{
name:"SQL EXCEPT with ORDER BY LIMIT on children and bag op",
name:"SQL EXCEPT with ORDER BY LIMIT on children and set op",
statement:"(SELECT a FROM t1 ORDER BY a LIMIT 2) EXCEPT ALL (SELECT a FROM t2 ORDER BY a LIMIT 2) ORDER BY a LIMIT 2",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
Expand All @@ -441,4 +439,52 @@ bagOperators::[
]
}
},
// following tests are equivalent to above but use the PartiQL outer bag op
{
name:"PartiQL OUTER UNION with ORDER BY LIMIT on children and bag op",
statement:"(SELECT a, tbl FROM t1 ORDER BY a LIMIT 2) OUTER UNION ALL (SELECT a, tbl FROM t2 ORDER BY a LIMIT 2) ORDER BY a LIMIT 2",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:[
{
a: 1,
tbl: 1,
},
{
a: 2,
tbl: 1
}
]
}
},
{
name:"PartiQL OUTER INTERSECT with ORDER BY LIMIT on children and bag op",
statement:"(SELECT a FROM t1 ORDER BY a LIMIT 4) OUTER INTERSECT ALL (SELECT a FROM t2 ORDER BY a LIMIT 4) ORDER BY a LIMIT 2",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:[
{
a: 2,
},
{
a: 3,
}
]
}
},
{
name:"PartiQL OUTER EXCEPT with ORDER BY LIMIT on children and bag op",
statement:"(SELECT a FROM t1 ORDER BY a LIMIT 2) OUTER EXCEPT ALL (SELECT a FROM t2 ORDER BY a LIMIT 2) ORDER BY a LIMIT 2",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:[
{
a: 1,
},
]
}
},
]

0 comments on commit 8c39883

Please sign in to comment.