-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Struct dereference on non-uppercase field names returns nulls #2543
Comments
The pattern seems to be that KSQL is able to deserialize the data iff the fieldname does not contain lowercase letters. For example, this variant of the workaround above doesn't work:
I think the problem has to do with the fact that KSQL's JSON deserializer only uses uppercase schemas. Specifically, this issue is an instance of the more general bug that KSQL doesn't deserialize JSON properly in the case of non-uppercase field names. For example, given this JSON topic with data:
this works as expected (with
but this doesn't:
(Those last two values shouldn't be null.) |
Confirmed that this bug only occurs with JSON data (and not Avro). Closing this issue in favor of the more general #2551. |
Suppose I've created a topic and put some struct data in it:
Then define a stream on the topic and verify the record is there:
Now, deferencing the struct fields works as expected via
SELECT
:but not as
CREATE STREAM ... AS SELECT
followed bySELECT *
:Specifically, there should not be nulls in the last two columns of the last output.
Workaround: Name the deferenced fields.
Another option: Allow fieldnames in original struct to be uppercased by KSQL (the default unless quotes are used).
This bug is present on the current master, as well as previous branches.
Extra info for debugging:
Source topic:
Stream
source
:Stream
sink1
(results in nulls when printed back):^ Notably, data are written to this topic as expected, but KSQL prints them back as nulls.
Stream
sink2
(from workaround, prints as expected):Stream
source2
(from "another option," with uppercase field names):Stream
sink3
(from "another option", prints as expected):The text was updated successfully, but these errors were encountered: