-
Notifications
You must be signed in to change notification settings - Fork 3.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
Support Iceberg materialized views with types not supported directly in Iceberg library #16050
Conversation
39eb0a7
to
e4a8319
Compare
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/AbstractTrinoCatalog.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/AbstractTrinoCatalog.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/AbstractTrinoCatalog.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/AbstractTrinoCatalog.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/analyzer/StatementAnalyzer.java
Show resolved
Hide resolved
e4a8319
to
bc224dc
Compare
(just rebased) |
A materialized view should be able to capture any query results and these are not constrained to be limited to types directly supported by Iceberg. Coerce unsupported types to supported ones. When reading, when the storage table has types different than MV output types, coercions are already applied by the `StatementAnalyzer`. The MV/storage schema mismatch is not supported in REFRESH MATERIALIZED VIEW yet.
bc224dc
to
bdf6982
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the data for an arbitrary type stored? We don’t have any way for a type to declare its stable representation or how it should be serialized/deserialized. I looked at the code but couldn’t find where this happens.
the solution does not support arbitrary types. only the chosen, selected, types from among standard type. |
The materialized view's storage table may have a schema different than the materialized view itself. This is already supported when reading (the coercions are getting applied as necessary), but was not supported for REFRESH. In the REFRESH normal INSERT constraints where getting applied, thus not allowing the materialized view to, for example, store temporal values in a varchar column. The change removes the constraint, and therefore a storage table may use any type that is coercible to from the view definition type. Of course, the implementations should only use types where coercion to the storage and backwards does round trip.
bdf6982
to
b5e0c23
Compare
CI unrelated
|
@findepi does this need release notes? |
@colebow yes. |
No description provided.