You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "ankitsultana (via GitHub)" <gi...@apache.org> on 2025/09/15 19:20:51 UTC
[I] [multistage] Null Semantics Breaking Change wrt Pinot 1.3.0 [pinot]
ankitsultana opened a new issue, #16821:
URL: https://github.com/apache/pinot/issues/16821
It seems like we are no longer simplifying `IS NULL / IS NOT NULL` predicates in the MSE optimizer anymore.
Testing with this query:
```
SET useMultistageEngine=true;
explain plan for select * from userAttributes
where deviceOS IS NULL
limit 10
```
With Pinot 1.3.0 Docker image, we get this plan, which is what I would expect with the null settings in the Quickstart (no column level null handling enabled)
```
Execution Plan
LogicalValues(tuples=[[]])
```
With latest Docker image, I am getting:
```
Execution Plan
LogicalSort(offset=[0], fetch=[10])
PinotLogicalSortExchange(distribution=[hash], collation=[[]], isSortOnSender=[false], isSortOnReceiver=[false])
LogicalSort(fetch=[10])
LogicalProject(daysSinceFirstTrip=[$4], deviceOS=[$5], totalTrips=[$6], userUUID=[$7])
LogicalFilter(condition=[IS NULL($5)])
PinotLogicalTableScan(table=[[default, userAttributes]])
```
I think this is a breaking change because if null vectors are enabled, the nullability filter will be evaluated with latest Pinot but it wasn't getting evaluated with Pinot 1.3.0
cc: @yashmayya
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-4317212289
This issue has been closed because it has been inactive for 180 days. If you believe this issue is still relevant, please feel free to reopen it or create a new issue. Thank you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "ankitsultana (via GitHub)" <gi...@apache.org>.
ankitsultana commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-3300708414
I actually agree with that problem and was working on finding a solution for it for the Lite Mode when I encountered this issue.
But the concern I have is that this is changing results for existing queries completely. e.g. if a user has `IS NOT NULL` in their MSE queries, before that filter was getting simplified to `true`. Now, the filter would actually be evaluated using null vectors at segment level (if they are enabled). Similarly, `IS NULL` would get simplified to `false` before but now will be executed for each segment, leading to different results.
I'll need to check what the impact of this is at Uber, but if we do end up going with this approach we need to call this out as a breaking change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #16821: [multistage] Null Semantics Breaking Change on Master
URL: https://github.com/apache/pinot/issues/16821
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-4113107684
This issue has been automatically marked as stale because it has not had any activity in the last 150 days. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please leave a comment to keep it open. Thank you for your contributions!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "ankitsultana (via GitHub)" <gi...@apache.org>.
ankitsultana commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-3300617136
> When null handling is disabled must be transformed into:
I don't follow, why should the `NOT IS NULL` get transformed to `<> 0`?
Prior to this change if column level nullability was disabled, the user contract for MSE was that each column would be considered as not nullable, so it is correct to simplify `NOT IS NULL` to `true`.
Moreover, the default value in the schema shouldn't be used in such a way in the query optimizer. IMO that default value has only served as a guide for the storage layer, and it can change across segments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-3300650023
The actual problem here is that before the change, there is no way to use `IS NULL` or `IS NOT NULL` without enabling null handling with MSE (this is inconsistent with SSE), but null handling comes with overhead.
When people specify `IS NULL` or `IS NOT NULL` in the query, I'd expect the intention to be using the null vector to filter the column instead of being ignored.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "ankitsultana (via GitHub)" <gi...@apache.org>.
ankitsultana commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-3303697369
> I don't follow, why should the NOT IS NULL get transformed to <> 0?
> ...
> Because that is the ill-defined semantics when using basic null handling (aka null handling is disabled)
I don't think that's true and the existing semantics made sense to me. Nowhere in SSE do we rewrite the predicate `IS NOT NULL` to `<> 0` or anything like that. The SSE semantics were:
1. If you use `IS NOT NULL / IS NULL`, the null vectors will be used. If null vectors don't exist in the segment, this is simplified to a match all or empty (i.e. we assume all columns as not nullable if null vectors are disabled).
2. The default null value is used for storage **only**, and you can use comparisons against that value if you don't want to use null predicates. This is independent of whether you have null vectors enabled.
These semantics make perfect sense to me and seem quite reasonable.
**Note:** This discussion seems like a digression though, because I don't think you are transforming `IS NOT NULL` to `<> 0` or vice versa, right? At least I couldn't reproduce it with the latest Docker image.
You can see the relevant FilterPlanNode code below and also verify this with the Realtime Quickstart.
<img width="753" height="307" alt="Image" src="https://github.com/user-attachments/assets/a0a77ae0-8998-4c4b-ac08-af2ddb29f52c" />
<img width="1884" height="820" alt="Image" src="https://github.com/user-attachments/assets/cd5d7b0f-845a-4f7b-9784-ab2fd6305d68" />
> Yes, because previously it was returning incorrect results (again, as defined as the strange Pinot semantics).
The results weren't incorrect. They were what the semantics were. The semantics didn't make sense I agree, but if the semantics were defined that way I don't agree that we can call the results incorrect.
> Not exactly, given null handling is disabled, what Pinot does is literally to compare the value with the default null value for the column (which is 0 or MIN_INT, depending on whether the column is a metric or a dimension).
Same as the first inline comment: I don't think Pinot does this. i.e. Pinot will not use the `IS NULL / IS NOT NULL` filter and automatically convert it to a default null value exact match filter, regardless of any config.
Maybe I am mistaken, could you share a repro?
> This is not a breaking change, it is a bugfix.
Again, the new semantics make sense to me, but whether this is a breaking change or not is not up for debate. Query results for existing customers are going to change. You can call it a bugfix too, but this is a breaking change.
As a platform at Uber we will have to assess whether this has impact to our customers or not. These null handling semantics and oddities were known to us and we had documented it in our internal Runbooks too to help users understand them.
In fact I was trying to find a way to make this work with Lite Mode without triggering a b/w incompatible change like the one introduced in the related PR, when I realized that it's already been addressed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "gortiz (via GitHub)" <gi...@apache.org>.
gortiz commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-3293706217
This change was added in https://github.com/apache/pinot/pull/16658. The PR explains the issue, but the TL;DR: is it was a bug fix when, like in they query you include here, only basic null handling is used. When that happens, IS NULL cannot be removed because our null implementation is not actually compatible with SQL semantics.
If null handling is enabled, the plan should be what you expect
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "gortiz (via GitHub)" <gi...@apache.org>.
gortiz commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-3301964304
> I don't follow, why should the NOT IS NULL get transformed to <> 0?
Because that is the ill-defined semantics when using basic null handling (aka null handling is disabled), as documented in https://docs.pinot.apache.org/developers/advanced/null-value-support. I think this basic null handling is very confusing and incorrect, but it is too late to change that decision.
> But the concern I have is that this is changing results for existing queries completely.
Yes, because previously it was returning incorrect results (again, as defined as the strange Pinot semantics).
> Now, the filter would actually be evaluated using null vectors at segment level (if they are enabled)
Not exactly, given null handling is disabled, what Pinot does is literally to compare the value with the default null value for the column (which is 0 or MIN_INT, depending on whether the column is a metric or a dimension). When null handling is enabled, Calcite will simplify the expression as false, producing the same plan as previously.
> I'll need to check what the impact of this is at Uber, but if we do end up going with this approach we need to call this out as a breaking change.
This is not a breaking change, it is a bugfix. Now MSE returns the same result as SSE in this situation. If you want actual SQL semantics, you need to enable null handling (which can be enabled by default).
To be clear, I'm the one who applied the change, but I strongly suggest we start changing MSE to use null handling by default, prioritizing correctness over incorrect but slightly more efficient queries. Basic null handling is error prone and difficult to explain and understand. But having 2 different null handling modes is already too complex, making MSE behave differently than SSE when null handling is disabled would mean adding a 3 null handling mode, which makes everything even worse.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] [multistage] Null Semantics Breaking Change on Master [pinot]
Posted by "gortiz (via GitHub)" <gi...@apache.org>.
gortiz commented on issue #16821:
URL: https://github.com/apache/pinot/issues/16821#issuecomment-3307078798
You are right, when `enableNullHandling` is false, the implementation of `IS NULL` and `IS NOT NULL` uses the null vector (as we should), we don't use the default value. I was misled by the fact that in that situation, queries like `col = value` use the default value and ignore the null vector (again, when `enableNullHandling` is set to false).
But my point is still valid when the query uses `IS NULL` or `IS NOT NULL` and other predicates using thevalue.
For example, using `NullHandlingQuickstart`, the following query
```
select *
from clientSalaryNulls
where salary is null and salary = -2147483648
limit 10
```
Returns:
| engine | null handling | returned pre #16658 | returned after #16658 |
|--------|--------------|---------------------------|---------------------------|
| sse | false | rows where salary is null | rows where salary is null |
| sse | true | empty | empty |
| mse | false | empty | rows where salary is null |
| mse | true | empty | empty |
Another example that is even worse. The query:
```sql
select *
from clientSalaryNulls
where salary IS NOT NULL
and salary <> 4398214
and salary < 0
```
Returns
| engine | null handling | returned pre #16658 | returned after #16658 |
|--------|--------------|---------------------|---------------------------|
| sse | false | empty | empty |
| sse | true | empty | empty |
| mse | false | empty | rows where salary is null |
| mse | true | empty | empty |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org