Skip to content

change pipe-level none handling, empty subquery, and add has() - #7635

Merged
mccanne merged 3 commits into
mainfrom
pipe-nones
Nov 9, 2026
Merged

mccanne merged 3 commits into
mainfrom
pipe-nones

Conversation

@mccanne

@mccanne mccanne commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

This commit changes none handling at the output of relevant pipe operators to drop singleton nones. If a none is created, the query writer knows what they are doing, and if they didn't want to drop it, they should use ??. We also changed the behavior of pipe expression subqueries to return none instead of null for empty result. SQL subqueries still return null.

In agg output, none values are dropped. For single column output with a none column, the output is a singleton none, which must be handled by the query or it fails type check. To implement this, we needed an expression that could check the existence of a field so we brought back the has() function with new semantics.

Closes #7599

This commit changes none handling at the output of relevant pipe
operators to drop singleton nones.  If a none is created, the query
writer knows what they are doing, and if they didn't want to drop it,
they should use ??.  We also changed the behavior of pipe expression
subqueries to return none instead of null for empty result.  SQL
subqueries still return null.

In agg output, none values are dropped. For single column output
with a none column, the output is a singleton none, which must
be handled by the query or it fails type check.  To implement
this, we needed an expression that could check the existence of a
field so we brought back the has() function with new semantics.
Comment thread compiler/semantic/checker.go Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are just return the inner type here but in reality this should doing what the runtime is doing: Filtering plain nones from the type and returning that.

Also (not having to do with this pr but generally) should probably have a TypeSet check here as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnest now drops plain none from the element type, and sets are supported.

Comment thread compiler/semantic/checker.go Outdated
Comment on lines +886 to +888
func isPlainNone(typ super.Type) bool {
return defuse(typ) == super.TypeNone
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've already got isNoneType you could/should use that instead of adding this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNoneType now means plain none (it was unwrapping named types, which also fixed a bug with named-none fields); removed isPlainNone.

Comment thread runtime/op/nones.go Outdated
Comment on lines +111 to +113
if isNoneVec(vec) {
return allSlots(vec.Len())
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want to allocate n of uint32 for a batch that is entirely none right? Maybe just return a bool/skip in this case?

@mccanne mccanne Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plainNoneSlots now returns “all none” without allocating.

@mccanne
mccanne merged commit d322a95 into main Nov 9, 2026
4 checks passed
@mccanne
mccanne deleted the pipe-nones branch November 9, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plain none from a grouping expression appears in aggregate output

2 participants