trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.27k stars 2.95k forks source link

createView is not supported for Iceberg Nessie catalogs #17768

Open alex5995 opened 1 year ago

alex5995 commented 1 year ago

Hi everyone,

I just tried the new catalog type (Nessie catalog) added in the Trino version 419.

I'd like to create an iceberg view, for example executing the following statement in Trino

CREATE VIEW datalake.default.random_view AS (
    SELECT *
    FROM datalake.default.random_table 
    WHERE field = 'value'
)

When I run it, I receive the following error

SQL Error [13]: Query failed (#20230606_085036_00017_hqbnt): createView is not supported for Iceberg Nessie catalogs

Is it a known issue? Will you support it in the future?

Thanks for helping.

ebyhr commented 1 year ago

That's a known limitation and there's no plan to support it for now.

Jovvx commented 10 months ago

That's a known limitation and there's no plan to support it for now.

Why not? It’s a basic feature for a metastore. It also prevents from DBT users to use incremental tables. Not everyone is using Spark.

daniel-mueller commented 10 months ago

@Jovvx You can use incrementals with dbt-trino (we do that successfully in prod), but you need to disable views like described here: https://docs.getdbt.com/reference/resource-configs/trino-configs#incremental

Jovvx commented 10 months ago

@Jovvx You can use incrementals with dbt-trino (we do that successfully in prod), but you need to disable views like described here: https://docs.getdbt.com/reference/resource-configs/trino-configs#incremental

Thanks! Didn’t see that line though. How do you manage iceberg table locations with S3? Using the iceberg.unique-table-location=true ? And how do you serve views for the analysts where table is not needed?

daniel-mueller commented 10 months ago

@Jovvx Walking you through our whole implementation would be a bit much to do in a simple comment. Maybe try the Trino Slack? They have a dedicated channel for Iceberg where questions like this can be asked.

Oixver commented 10 months ago

@Jovvx Walking you through our whole implementation would be a bit much to do in a simple comment. Maybe try the Trino Slack? They have a dedicated channel for Iceberg where questions like this can be asked.

Alright, I'll try, anyways can I contact you somewhere to understand how you implemented it? If that's okay with you ofcourse... an email/slack/whatever?

ajantha-bhat commented 6 months ago

Will support Iceberg views similar to https://github.com/trinodb/trino/pull/19818 soon.

sdasdasd1 commented 4 months ago

@ajantha-bhat Hi! What the progress on that? When iceberg nessie views will be in trino?

ajantha-bhat commented 4 months ago

I have done the analysis.

TrinoRestCatalog directly uses TrinoCatalog and maintain RestSessionCatalog class from Iceberg repo.

where as all other Iceberg catalogs (like Nessie) uses AbstractTrinoCatalog. So, we need to duplicate lot of code from BaseMetastoreViewCatalog? There is also AbstractIcebergTableOperations instead of directly using the class from Iceberg repo. That means we also need to introduce AbstractIcebergViewOperations for Trino?

So, I estimate that this is a big work which involves lot of duplication.

I see two simpler ways. a) Make TrinoNessieCatalog like TrinoRestCatalog by directly using the NessieCatalog from Iceberg repo? Not sure why it was done in the first place. Need to understand it. (cc: @nastra) b) Do nothing. Once, Nessie adopts rest catalog spec, the views can be created using the rest path.

I think we will mostly with option b), Soon, Nessie will be compatible with REST spec and it automatically gets the view support via that path.