You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
null columns that are CAST(col, VARCHAR) become the string "null", but should stay as null.
Example: INT columns that are CAST(col, VARCHAR) when null are mistakenly counted by the COUNT() aggregate function.
This may also effect other field type and aggregation functions. I've only tested this situation.
To Reproduce
KSQL 5.4.0
-- Create a stream and insert some data into it with null values
CREATE STREAM HAS_NULL_VALUES (USER VARCHAR, VIEWTIME INT) WITH (VALUE_FORMAT='Avro', PARTITIONS=1);
INSERT INTO HAS_NULL_VALUES (USER) VALUES ('amy');
INSERT INTO HAS_NULL_VALUES (USER, VIEWTIME) VALUES ('amy', 123);
-- Aggregate without CAST. Result should be 1
CREATE TABLE COUNT_WITH_NULL WITH (VALUE_FORMAT='Avro') AS
SELECT USER, COUNT(VIEWTIME) FROM HAS_NULL_VALUES GROUP BY USER;
SELECT * FROM COUNT_WITH_NULL EMIT CHANGES LIMIT 1;
-- Aggregate with CAST. Result should still be 1, but is isntead 2.
CREATE TABLE COUNT_WITH_CAST_NULL WITH (VALUE_FORMAT='Avro') AS
SELECT USER, COUNT(CAST(VIEWTIME AS VARCHAR)) FROM HAS_NULL_VALUES GROUP BY USER;
SELECT * FROM COUNT_WITH_CAST_NULL EMIT CHANGES LIMIT 1;
Expected behavior
The CAST null should not be counted, as it's value should still be null.
Describe the bug
null columns that are CAST(col, VARCHAR) become the string "null", but should stay as null.
Example: INT columns that are CAST(col, VARCHAR) when null are mistakenly counted by the COUNT() aggregate function.
This may also effect other field type and aggregation functions. I've only tested this situation.
To Reproduce
KSQL 5.4.0
Expected behavior
The CAST null should not be counted, as it's value should still be null.
Actual behaviour
The text was updated successfully, but these errors were encountered: