Skip to content
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

Remove redundant QualifiedTablePrefix.matches checks #18607

Conversation

findepi
Copy link
Member

@findepi findepi commented Aug 9, 2023

The case where table name is present is handled earlier in the method (prefix.asQualifiedObjectName().isPresent() check). The connector is asked to list entities for given schema (or all entities if schema is Optional.empty), thus subsequent check for prefix.matches was redundant.

The case where table name is present is handled earlier in the method
(`prefix.asQualifiedObjectName().isPresent()` check). The connector is
asked to list entities for given schema (or all entities if schema is
`Optional.empty`), thus subsequent check for `prefix.matches` was
redundant.
@findepi findepi added the no-release-notes This pull request does not require release notes entry label Aug 9, 2023
@cla-bot cla-bot bot added the cla-signed label Aug 9, 2023
@@ -529,7 +529,6 @@ public List<QualifiedObjectName> listTables(Session session, QualifiedTablePrefi
metadata.listTables(connectorSession, prefix.getSchemaName()).stream()
.map(convertFromSchemaTableName(prefix.getCatalogName()))
.filter(table -> !isExternalInformationSchema(catalogHandle, table.getSchemaName()))
.filter(prefix::matches)
Copy link
Member

Choose a reason for hiding this comment

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

Without this filter, this method may return unmatched tables if the connectors include such objects. I have a small concern to trust the connectors' implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, i didn't refresh the page before merging and didn't see the comment.

Such a behavior would be a bug in the connector and such be fixed there.
if we wanted to allow connector to return unfiltered results, that should be documented (and tested).
BTW, we didn't have prefix.matches calls (or equivalent) in eg listTableColumns.

@findepi findepi merged commit 740f5f9 into trinodb:master Aug 10, 2023
@findepi findepi deleted the findepi/remove-redundant-qualifiedtableprefix-matches-checks-c0e873 branch August 10, 2023 08:10
@github-actions github-actions bot added this to the 423 milestone Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed no-release-notes This pull request does not require release notes entry
Development

Successfully merging this pull request may close these issues.

3 participants