fpompermaier commented on a change in pull request #11906:
URL: https://github.com/apache/flink/pull/11906#discussion_r427823029



##########
File path: 
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/AbstractJdbcCatalog.java
##########
@@ -126,31 +124,33 @@ public String getBaseUrl() {
 
        // ------ retrieve PK constraint ------
 
-       protected UniqueConstraint getPrimaryKey(DatabaseMetaData metaData, 
String schema, String table) throws SQLException {
+       protected Optional<UniqueConstraint> getPrimaryKey(DatabaseMetaData 
metaData, String schema, String table) throws SQLException {
 
                // According to the Javadoc of 
java.sql.DatabaseMetaData#getPrimaryKeys,
                // the returned primary key columns are ordered by COLUMN_NAME, 
not by KEY_SEQ.
                // We need to sort them based on the KEY_SEQ value.
                ResultSet rs = metaData.getPrimaryKeys(null, schema, table);
 
-               List<Map.Entry<Integer, String>> columnsWithIndex = null;
+               Map<Integer, String> keySeqColumnName = new HashMap<>();

Review comment:
       I didn't initialize any structure for a table before PK discovery in 
order to avoid GC pressure (If you have thousands of tables maybe this could 
save some memory). What do you think?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to