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



##########
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:
       The modern GC algorithms are actually optimized for creating many many 
small objects that are short lived, that is basically the 99% heuristic for 
Java objects in every program. So I think the GC overhead is very low, besides 
it's in the client side. I think it's fine to early initialize the map. 




----------------------------------------------------------------
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