Skip to content

feat: trino support replace table iceberg and delta#5279

Merged
eakmanrq merged 1 commit intomainfrom
eakmanrq/trino_replace_table_support
Sep 2, 2025
Merged

feat: trino support replace table iceberg and delta#5279
eakmanrq merged 1 commit intomainfrom
eakmanrq/trino_replace_table_support

Conversation

@eakmanrq
Copy link
Collaborator

@eakmanrq eakmanrq commented Sep 2, 2025

Prior to this PR we assumed all Trino catalogs didn't support replace table but this isn't true for Iceberg and Delta Lake. Therefore this PR updates Trino to use replace table for those catalogs.

Some other key changes:

@eakmanrq eakmanrq requested review from erindru and treysp September 2, 2025 16:52
@eakmanrq eakmanrq force-pushed the eakmanrq/trino_replace_table_support branch from 3ee5976 to 4744324 Compare September 2, 2025 17:43
@eakmanrq eakmanrq merged commit 454e942 into main Sep 2, 2025
35 of 36 checks passed
@eakmanrq eakmanrq deleted the eakmanrq/trino_replace_table_support branch September 2, 2025 18:12
)
assert adapter.current_catalog_type == storage_type
expected_current_type = storage_type
assert adapter.current_catalog_type == expected_current_type
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change do anything?

)
assert adapter.get_catalog_type(f"datalake_{storage_type}") == storage_type
expected_type = storage_type
assert adapter.get_catalog_type(f"datalake_{storage_type}") == expected_type
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this one?

supports_replace_table_override: t.Optional[bool] = None,
**kwargs: t.Any,
) -> None:
catalog_type = self.get_catalog_type(self.get_catalog_type_from_table(table_name))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't self.get_catalog_type_from_table(table_name) already call self.get_catalog_type()?

So this would do:

self.get_catalog_type_from_table(table_name) -> may return "delta_lake"

Then it would call:

self.get_catalog_type("delta_lake")

There is probably no catalog called delta_lake as it's a trino connector type (which is what we call "catalog type" here), so this would fall back on the connector type of the default catalog and not that of the table.

I think this "worked" in the test you wrote because for unit testing purposes we infer the catalog type from the catalog name, but this doesn't happen on a running cluster.

The catalog can be named anything you want and the catalog type comes from whatever was configured for the connector.name property for that catalog in the Trino config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants