Repository navigation
[source-postgres] add optional for all array schemabuilder - #41654
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
Marius Posta (postamar)
left a comment
There was a problem hiding this comment.
This change seems harmless enough but I'm not sure this will fix the issue. My impression was that we already have a datatype test case with a TIMESTAMP[] column which contains an array value with a NULL element, and that this test case gets exercised with debezium in a CDC-variant of the test suite. I may be wrong.
|
Marius Posta (@postamar) Thanks for reviewing! I checked test - we only have PostgresSourceOperationsTest which only tests for non debezium converter (debezium use PostgresConverter). Also, this is to prevent the entire array is null; elements in array should not trigger this problem because we define the schema as OPTIONAL_STRING_SCHEMA which already declared optional properties. I'm not sure if that could fix user's problem - as they claimed they do not have any NULL value but we are seeing null value on our side. My guess is the deletion event could create such value but that's just a pure guess! |
|
I thought that |
What
fixes https://github.com/airbytehq/oncall/issues/5498
Schema does not allow NULL value for array. Not 100% confident it will resolve the oncall issue, but nevertheless we should allow null value in user's array table.
How
We defined a converter for array timestamp.
Because on kafka the schema is not marked as optional:
https://github.com/a0x8o/kafka/blob/master/connect/api/src/main/java/org/apache/kafka/connect/data/SchemaBuilder.java#L361
and thus it will be thrown as error here:
https://github.com/a0x8o/kafka/blob/master/connect/api/src/main/java/org/apache/kafka/connect/data/ConnectSchema.java#L218
Thus, the fix should be changing in PostgresConverter.java to SchemaBuilder.array(OPTIONAL_STRING_SCHEMA).optional()
The problem I haven't figured out is user does not have NULL value - I wonder if that is caused by deletion change event?
Review guide
User Impact
Can this PR be safely reverted and rolled back?