-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Refactor ConnectorMetadata to deprecate multi-layouts returning method #21767
Conversation
I think we need to come up with a deprecation strategy. For now, I would recommend adding a new method In the release notes, we should mark that this method is being deprecated. Then, we should create an issue for X months down the road to delete the method.
|
Thanks for the instruction. Sounds great, I will do it. |
9739983
to
46241df
Compare
Hi @tdcmeehan, following your guidance, the new method |
@@ -364,14 +364,10 @@ public TableLayoutResult getLayout(Session session, TableHandle table, Constrain | |||
CatalogMetadata catalogMetadata = getCatalogMetadata(session, connectorId); | |||
ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); | |||
ConnectorSession connectorSession = session.toConnectorSession(connectorId); | |||
List<ConnectorTableLayoutResult> layouts = metadata.getTableLayouts(connectorSession, connectorTable, constraint, desiredColumns); | |||
ConnectorTableLayoutResult layout = metadata.getTableLayoutForConstraint(connectorSession, connectorTable, constraint, desiredColumns); |
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.
I would try to ensure that the results between getTableLayouts
and getTableLayoutForConstaint
are consistent, otherwise it might be confusing to connector authors.
Remember that this method is also used by connectors not even known to Presto (i.e. external libraries). So we need to accomodate people who are slow to adopt to the new API.
Description
The support for multiple layouts has been removed in PR #12674, however the SPI method
ConnectorMetadata.getTableLayouts()
still return aList<ConnectorTableLayoutResult>
which should always contains exactly one element. That's somehow unreasonable, and may lead in some confusion and inconvenience in the reading and subsequent development of the code. This PR try to deprecate this method, and replace it bygetTableLayoutForConstraint()
which explicitly return aConnectorTableLayoutResult
.Test Plan
Contributor checklist
Release Notes