Skip to content

Commit

Permalink
Update nullability of aggregations in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rchowell committed Oct 19, 2023
1 parent cb01875 commit b3d4cd5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ class NormalizeTest {
@Test
fun normalize() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,13 @@ internal class PlanTyper(
// Found a match!
val newAgg = aggResolved(match.signature)
val newArgs = rewriteFnArgs(match.mapping, args)
var type = newAgg.signature.returns.toStaticType()
val returns = newAgg.signature.returns

// Return type with calculated nullability
var type = when {
newAgg.signature.isNullable -> returns.toStaticType()
else -> returns.toNonNullStaticType()
}

// Some operators can return MISSING during runtime
if (match.isMissable) {
Expand Down
30 changes: 24 additions & 6 deletions partiql-planner/src/testFixtures/resources/tests/aggregations.ion
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ suite::{
fields: [
{
name: "avg",
type: "int32"
type: [
"int32",
"null"
],
},
],
},
Expand Down Expand Up @@ -150,7 +153,10 @@ suite::{
fields: [
{
name: "min",
type: "int32"
type: [
"int32",
"null"
],
},
],
},
Expand All @@ -167,7 +173,10 @@ suite::{
fields: [
{
name: "max",
type: "int32"
type: [
"int32",
"null"
],
},
],
},
Expand All @@ -184,7 +193,10 @@ suite::{
fields: [
{
name: "sum",
type: "int32"
type: [
"int32",
"null"
],
},
],
},
Expand Down Expand Up @@ -224,7 +236,10 @@ suite::{
fields: [
{
name: "_1",
type: "float32"
type: [
"float32",
"null"
],
},
{
name: "y",
Expand All @@ -250,7 +265,10 @@ suite::{
fields: [
{
name: "_1",
type: "float32"
type: [
"float32",
"null"
],
},
{
name: "a",
Expand Down

0 comments on commit b3d4cd5

Please sign in to comment.