zhangshenghang commented on code in PR #10254:
URL: https://github.com/apache/seatunnel/pull/10254#discussion_r2649546505
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/utils/CatalogUtils.java:
##########
@@ -156,46 +157,57 @@ public static Optional<PrimaryKey>
getPrimaryKey(DatabaseMetaData metaData, Tabl
public static List<ConstraintKey> getConstraintKeys(
DatabaseMetaData metadata, TablePath tablePath) throws
SQLException {
- // We set approximate to true to avoid querying the statistics table,
which is slow.
- try (ResultSet resultSet =
- metadata.getIndexInfo(
- tablePath.getDatabaseName(),
- tablePath.getSchemaName(),
- tablePath.getTableName(),
- false,
- true)) {
- // index name -> index
- Map<String, ConstraintKey> constraintKeyMap = new HashMap<>();
- while (resultSet.next()) {
- String columnName = resultSet.getString("COLUMN_NAME");
- if (columnName == null) {
- continue;
+ try {
+ // We set approximate to true to avoid querying the statistics
table, which is slow.
+ try (ResultSet resultSet =
+ metadata.getIndexInfo(
+ tablePath.getDatabaseName(),
+ tablePath.getSchemaName(),
+ tablePath.getTableName(),
+ false,
+ true)) {
+ // index name -> index
+ Map<String, ConstraintKey> constraintKeyMap = new HashMap<>();
+ while (resultSet.next()) {
+ String columnName = resultSet.getString("COLUMN_NAME");
+ if (columnName == null) {
+ continue;
+ }
+ String indexName =
cleanKeyName(resultSet.getString("INDEX_NAME"));
+ boolean noUnique = resultSet.getBoolean("NON_UNIQUE");
+
+ ConstraintKey constraintKey =
+ constraintKeyMap.computeIfAbsent(
+ indexName,
+ s -> {
+ ConstraintKey.ConstraintType
constraintType =
+
ConstraintKey.ConstraintType.INDEX_KEY;
+ if (!noUnique) {
+ constraintType =
+
ConstraintKey.ConstraintType.UNIQUE_KEY;
+ }
+ return ConstraintKey.of(
+ constraintType, indexName, new
ArrayList<>());
+ });
+
+ ConstraintKey.ColumnSortType sortType =
+ "A".equals(resultSet.getString("ASC_OR_DESC"))
Review Comment:
done
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/config/JdbcCommonOptions.java:
##########
@@ -48,6 +48,20 @@ public class JdbcCommonOptions {
.defaultValue(30)
.withDescription("connection check time second");
+ public static final Option<Integer> SOCKET_TIMEOUT_MS =
Review Comment:
done
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]