Open umanwizard opened 2 years ago
The bummer here is that Union(UnionSchema { schemas: [Piece(Null), Piece(String)]
is the default representation of Postgres's string[]
/ uuid[]
native data type in Debezium w/ the Avro converter. There's no way in Postgres DDL to specify "array of non-nullable values"; the best we can do is a check
constraint on the array column that verifies no array element is null.
@justjake, an update ICYMI: the fix for nullability-pattern unions was released in v0.26.4
. This should make PostgreSQL array types tractable downstream!
Fantastic!
Thanks for sending this our way, @chaas! Agree that this is a storage issue and not an adapter issue. I'm moving this off the storage team board since we've already got it triaged in our mega tracker issue: https://github.com/MaterializeInc/materialize/issues/24755.
Linking in an option about how to do this without proper sum types: https://github.com/MaterializeInc/materialize/issues/28265#issuecomment-2234988861
Materialize can't ingest a topic with this schema:
The error message:
What's happening here is that in
validate_schema_2
, we force the Avro type to be a type that can be interpreted by Materialize, which unions can't (Materialize has no sum types). In other contexts, such as record fields, we hack in support as follows:["null", "something"]
, we interpret it as a nullable something (the one special case of sum type that SQL actually supports)But we're not going into that code path for the type of array elements.
We could fix that, or (my preference) we could finally add real sum types to Materialize, but I'm not sure how much support from the SQL team that needs. (Also, it'd be a pretty serious BC break)