nacz0 commented on code in PR #41840:
URL: https://github.com/apache/beam/pull/41840#discussion_r4775275270
##########
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcReadSchemaTransformProvider.java:
##########
@@ -250,7 +250,7 @@ public PCollectionRowTuple expand(PCollectionRowTuple
input) {
}
@Nullable Integer fetchSize = config.getFetchSize();
- if (fetchSize != null && fetchSize > 0) {
+ if (fetchSize != null && (fetchSize > 0 || fetchSize ==
Integer.MIN_VALUE)) {
Review Comment:
They should reject it. PostgreSQL, SQL Server, and Oracle drivers all reject
negative fetch sizes in `Statement.setFetchSize`, and `ReadFromPostgres` /
`ReadFromSqlServer` already fail fast at construction for MySQL-only options
like `connectionInitSql`.
Updated `validate(String jdbcType)` to reject `Integer.MIN_VALUE` (along
with other negative values) whenever `jdbcType` is a known non-MySQL type
(`postgres`, `mssql`, `oracle` — covering `ReadFromPostgres`,
`ReadFromSqlServer`, `ReadFromOracle`, and `ReadFromJdbc` with those
`jdbc_type` values), and added the missing `configuration.validate(jdbcType())`
call in `ReadFromPostgresSchemaTransformProvider.from()` so all providers fail
fast at construction time.
`Integer.MIN_VALUE` remains allowed for `ReadFromMySql`, `ReadFromJdbc` with
`jdbc_type: mysql`, and generic `ReadFromJdbc` without a `jdbc_type` (custom
`driver_class_name`, e.g. custom MySQL or MariaDB drivers). Added unit tests
covering `ReadFromPostgres`, `ReadFromSqlServer`, `ReadFromOracle`, and
`jdbc_type` validation.
##########
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcReadSchemaTransformProvider.java:
##########
@@ -250,7 +250,7 @@ public PCollectionRowTuple expand(PCollectionRowTuple
input) {
}
@Nullable Integer fetchSize = config.getFetchSize();
- if (fetchSize != null && fetchSize > 0) {
+ if (fetchSize != null && (fetchSize > 0 || fetchSize ==
Integer.MIN_VALUE)) {
Review Comment:
They should reject it. PostgreSQL, SQL Server, and Oracle drivers all reject
negative fetch sizes in `Statement.setFetchSize`, and `ReadFromPostgres` /
`ReadFromSqlServer` already fail fast at construction for MySQL-only options
like `connectionInitSql`.
Updated `validate(String jdbcType)` to reject `Integer.MIN_VALUE` (along
with other negative values) whenever `jdbcType` is a known non-MySQL type
(`postgres`, `mssql`, `oracle`, covering `ReadFromPostgres`,
`ReadFromSqlServer`, `ReadFromOracle`, and `ReadFromJdbc` with those
`jdbc_type` values), and added the missing `configuration.validate(jdbcType())`
call in `ReadFromPostgresSchemaTransformProvider.from()` so all providers fail
fast at construction time.
`Integer.MIN_VALUE` remains allowed for `ReadFromMySql`, `ReadFromJdbc` with
`jdbc_type: mysql`, and generic `ReadFromJdbc` without a `jdbc_type` (custom
`driver_class_name`, e.g. custom MySQL or MariaDB drivers). Added unit tests
covering `ReadFromPostgres`, `ReadFromSqlServer`, `ReadFromOracle`, and
`jdbc_type` validation.
--
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]