LiJie20190102 commented on code in PR #10254:
URL: https://github.com/apache/seatunnel/pull/10254#discussion_r2649427302
##########
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:
Should the configuration be described in the `md` file of the help document?
##########
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 =
+ Options.key("socket_timeout_ms")
+ .intType()
+ .defaultValue(1000 * 60 * 60 * 24)
+ .withDescription(
+ "Socket timeout in milliseconds for reading data
from the server. Default is 24h. Set to 0 for no timeout.");
+
+ public static final Option<Integer> CONNECT_TIMEOUT_MS =
Review Comment:
ditto
##########
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:
Does `equals` consider being case insensitive, that is, is it possible for
`a` to occur in a scenario?
--
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]