-
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
Attempt to Refactor identify mapping to use in non jdbc connector #17996
Attempt to Refactor identify mapping to use in non jdbc connector #17996
Conversation
Please rebase |
...in/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/mapping/RemoteSchemaNamesProvider.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Show resolved
Hide resolved
9085d15
to
372de04
Compare
...n/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/mapping/RuleBasedIdentifierMapping.java
Show resolved
Hide resolved
2119498
to
1565882
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.
I would squash these commits.
...rino-plugin-toolkit/src/main/java/io/trino/plugin/base/mapping/CachingIdentifierMapping.java
Outdated
Show resolved
Hide resolved
...rino-plugin-toolkit/src/main/java/io/trino/plugin/base/mapping/DefaultIdentifierMapping.java
Outdated
Show resolved
Hide resolved
...rino-plugin-toolkit/src/main/java/io/trino/plugin/base/mapping/DefaultIdentifierMapping.java
Outdated
Show resolved
Hide resolved
...trino-plugin-toolkit/src/main/java/io/trino/plugin/base/mapping/IdentifierMappingModule.java
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-druid/src/main/java/io/trino/plugin/druid/DruidJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestingH2JdbcClient.java
Outdated
Show resolved
Hide resolved
b3c55ce
to
316906a
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.
LGTM % comments and review from others.
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
d9fdf70
to
cba3029
Compare
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcRemoteIdentifiers.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
eb1dddf
to
68bd938
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.
LGTM
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcRemoteIdentifiers.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcRemoteIdentifiers.java
Outdated
Show resolved
Hide resolved
68bd938
to
61e0379
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.
% nits
@@ -1440,4 +1448,9 @@ private static ColumnMetadata getPageSinkIdColumn(List<String> otherColumnNames) | |||
} | |||
return new ColumnMetadata(columnName, TRINO_PAGE_SINK_ID_COLUMN_TYPE); | |||
} | |||
|
|||
public RemoteIdentifiers getRemoteIdentifiers(Connection connection) |
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.
protected or private?
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.
cannot, PhoenixMetadata need it:
private String toRemoteSchemaName(ConnectorSession session, String schemaName)
{
try (Connection connection = phoenixClient.getConnection(session)) {
return identifierMapping.toRemoteSchemaName(phoenixClient.getRemoteIdentifiers(connection), session.getIdentity(), schemaName);
}
catch (SQLException e) {
throw new TrinoException(PHOENIX_METADATA_ERROR, "Couldn't get casing for the schema name", e);
}
}
public static class JdbcRemoteIdentifiersFactory | ||
{ | ||
private final BaseJdbcClient baseJdbcClient; | ||
// cache this field to omit metadata check/call for every remote identifiers call |
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.
it it is about LazyConnection
, to not populate (create) connection each time.
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.
Not sure, connection is already created when we pass it to:
public JdbcRemoteIdentifiers createJdbcRemoteIdentifies(Connection connection)
{
return new JdbcRemoteIdentifiers(baseJdbcClient, connection, storesUpperCaseIdentifiers(connection));
}
we just don't want to call this :
DatabaseMetaData metadata = connection.getMetaData();
storesUpperCaseIdentifiers = metadata.storesUpperCaseIdentifiers();
all the time when we call createJdbcRemoteIdentifies
bc74cdf
to
6b85799
Compare
And move identify mapping to plugin toolkit
6b85799
to
09cbeb5
Compare
Description
To raise discussion
Additional context and related issues
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: