Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes FROM/UNPIVOT test cases #123

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions partiql-tests-data/eval-equiv/spec-tests.ion
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,17 @@
]
}
},
assert: {
evalMode: [EvalModeCoerce, EvalModeError],
result: EvaluationSuccess,
output: $bag::[1, 2]
}
assert: [
{
evalMode: EvalModeCoerce,
result: EvaluationSuccess,
output: $bag::[1, 2]
},
{
evalMode: EvalModeError,
result: EvaluationFail,
}
]
},
]
'section-5'::[
Expand Down
98 changes: 61 additions & 37 deletions partiql-tests-data/eval/misc.ion
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,23 @@ uncategorized::[
{
name:"variableShadow", // Note that i, f, d, and s are defined in the global environment
statement:"SELECT f, d, s FROM i AS f, f AS d, @f AS s WHERE f = 1 AND d = 2e0 and s = 1",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:$bag::[
{
f:1,
d:2e0,
s:1
}
]
}
assert:[
{
evalMode: EvalModeCoerce,
result: EvaluationSuccess,
output: $bag::[
{
f: 1,
d: 2e0,
s: 1
}
]
},
{
evalMode: EvalModeError,
result: EvaluationFail
}
]
},
{
name:"selectValueStructConstructorWithMissing",
Expand All @@ -132,15 +138,21 @@ uncategorized::[
{
name:"selectIndexStruct",
statement:"SELECT VALUE x[0] FROM (SELECT s.id FROM stores AS s) AS x",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:$bag::[
"5",
"6",
"7"
]
}
assert:[
{
evalMode:EvalModeCoerce,
result:EvaluationSuccess,
output:$bag::[
$missing::null,
$missing::null,
$missing::null
]
},
{
evalMode: EvalModeError,
result: EvaluationFail
}
]
},
{
name:"selectStarSingleSource",
Expand Down Expand Up @@ -212,27 +224,39 @@ uncategorized::[
{
name:"emptySymbol",
statement:"SELECT \"\" FROM `{'': 1}`",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:$bag::[
{
assert:[
{
evalMode:EvalModeCoerce,
result:EvaluationSuccess,
output:$bag::[
{
'':1
}
]
}
}
]
},
{
evalMode: EvalModeError,
result: EvaluationFail
}
]
},
{
name:"emptySymbolInGlobals",
statement:"SELECT * FROM \"\"",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:$bag::[
{
_1:1
}
]
}
assert:[
{
evalMode:EvalModeCoerce,
result:EvaluationSuccess,
output:$bag::[
{
_1:1
}
]
},
{
evalMode: EvalModeError,
result: EvaluationFail
}
]
}
]
32 changes: 19 additions & 13 deletions partiql-tests-data/eval/primitives/date-time.ion
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
57 changes: 33 additions & 24 deletions partiql-tests-data/eval/primitives/path.ion
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,17 @@ pathUnpivotMissing::[
{
name: "unpivotMissing",
statement: "SELECT * FROM UNPIVOT MISSING",
assert: {
evalMode: [
EvalModeCoerce,
EvalModeError
],
result: EvaluationSuccess,
output: $bag::[]
}
assert: [
{
evalMode: EvalModeCoerce,
result: EvaluationSuccess,
output: $bag::[]
},
{
evalMode: EvalModeError,
result: EvaluationFail,
}
]
},
{
name: "unpivotEmptyStruct",
Expand Down Expand Up @@ -586,26 +589,32 @@ pathUnpivotMissing::[
{
name: "unpivotMissingWithAsAndAt",
statement: "SELECT unnestIndex, unnestValue FROM UNPIVOT MISSING AS unnestValue AT unnestIndex",
assert: {
evalMode: [
EvalModeCoerce,
EvalModeError
],
result: EvaluationSuccess,
output: $bag::[]
}
assert: [
{
evalMode: EvalModeCoerce,
result: EvaluationSuccess,
output: $bag::[]
},
{
evalMode: EvalModeError,
result: EvaluationFail,
}
]
},
{
name: "unpivotMissingCrossJoinWithAsAndAt",
statement: "SELECT unnestIndex, unnestValue FROM MISSING, UNPIVOT MISSING AS unnestValue AT unnestIndex",
assert: {
evalMode: [
EvalModeCoerce,
EvalModeError
],
result: EvaluationSuccess,
output: $bag::[]
}
assert: [
{
evalMode: EvalModeCoerce,
result: EvaluationSuccess,
output: $bag::[]
},
{
evalMode: EvalModeError,
result: EvaluationFail,
}
]
},
{
name: "pathUnpivotEmptyStruct1",
Expand Down
82 changes: 46 additions & 36 deletions partiql-tests-data/eval/primitives/symbol.ion
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,44 @@
{
name:"Empty Symbol in table",
statement:"SELECT \"\" FROM `{'': 1}`",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:$bag::[
{
'':1
}
]
}
assert: [
{
result: EvaluationSuccess,
evalMode: EvalModeCoerce,
output: $bag::[
{
'': 1
}
]
},
{
evalMode: EvalModeError,
result: EvaluationFail
}
]
},
{
name:"Empty Symbol in globals",
statement:"SELECT * FROM \"\"",
env:{
'':1
},
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:$bag::[
{
_1:1
}
]
}
assert:[

{
result: EvaluationSuccess,
evalMode: EvalModeCoerce,
output: $bag::[
{
_1: 1
}
]
},
{
evalMode: EvalModeError,
result: EvaluationFail
}
]
},
{
name:"Empty Symbol in alias",
Expand All @@ -42,17 +49,20 @@
v:1
}
},
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:$bag::[
{
'':1
}
]
}
assert: [
{
result: EvaluationSuccess,
evalMode: EvalModeCoerce,
output: $bag::[
{
'': 1
}
]
},
{
evalMode: EvalModeError,
result: EvaluationFail
}
]
}
]
Loading
Loading