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

Inconsistent handling of NULL values #7065

Closed
derekjn opened this issue Feb 22, 2021 · 2 comments
Closed

Inconsistent handling of NULL values #7065

derekjn opened this issue Feb 22, 2021 · 2 comments
Assignees
Labels
bug fix-it-week good first issue query-engine Issues owned by the ksqlDB Query Engine team
Milestone

Comments

@derekjn
Copy link
Contributor

derekjn commented Feb 22, 2021

Given a stream s1 that contains a NULL value:

CREATE STREAM s1 (x INTEGER) ...
INSERT INTO s1 (x) VALUES (null);

If that NULL expression is used in an arithmetic operation, the result of the operation will be NULL:

SELECT x + 1 FROM s1 EMIT CHANGES;

However, if a NULL literal is used in the same way, an NPE will be thrown:

ksql> SELECT NULL + 1 FROM s1 EMIT CHANGES;
java.lang.NullPointerException

We should make NULL handling consistent regardless of context, as some users will evaluate ksqlDB's NULL handling by testing a simple example using a NULL literal like the one above. Any assumptions they derive from such tests will currently not be valid for actual queries.

@stevenpyzhang
Copy link
Member

select ARRAY[value0+5, 1+5], ARRAY[1+5], value0 + 5 from TEST emit changes;
If value0 is null in a record, then the output is null, [6], null. This seems a bit strange since it seems like the first array should be [null, 6]

select ARRAY[ucase(value0), 'test'] from TEST1 emit changes; returns [null, 'test']

It seems like if there's a NPE thrown in the expression when the query is processing, the corresponding select column gets a null value. The NPE thrown before the query is created/executed is because of our type checking of the expression before we create the query which fails.

@vvcephei vvcephei added streaming-engine Tickets owned by the ksqlDB Streaming Team query-engine Issues owned by the ksqlDB Query Engine team and removed needs-triage streaming-engine Tickets owned by the ksqlDB Streaming Team labels Feb 26, 2021
@agavra agavra added this to the 0.18.0 milestone Mar 12, 2021
@agavra agavra modified the milestones: 0.18.0, 0.19.0 Apr 12, 2021
@cprasad1
Copy link
Contributor

We got rid of the NPE, and we now give a new error message in such cases. See the description of #7554 for more details. I am closing this issue, and I have created this issue #7602 instead since the scope of feature that we want is much larger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix-it-week good first issue query-engine Issues owned by the ksqlDB Query Engine team
Projects
None yet
Development

No branches or pull requests

5 participants