laughingman7743 commented on code in PR #156:
URL:
https://github.com/apache/flink-connector-jdbc/pull/156#discussion_r2553228223
##########
flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/statement/FieldNamedPreparedStatementImpl.java:
##########
@@ -170,6 +174,18 @@ public void setObject(int fieldIndex, Object x) throws
SQLException {
}
}
+ @Override
+ public void setArray(int fieldIndex, Array x) throws SQLException {
+ for (int index : indexMapping[fieldIndex]) {
+ statement.setArray(index, x);
+ }
+ }
+
+ @Override
+ public Array createArrayOf(String typeName, Object[] elements) throws
SQLException {
+ return connection.createArrayOf(typeName, elements);
+ }
Review Comment:
This implementation introduces the first full ARRAY type write support in the
flink-connector-jdbc project. Currently, PostgreSQL dialect only supports
reading
ARRAY types (throws `IllegalStateException` on write - see
[PostgresDialectConverter.java:61-67](https://github.com/apache/flink-connector-jdbc/blob/v4.0.0/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/PostgresDialectConverter.java#L61-L67)).
If this change is merged, the implementation pattern here could serve as a
reference
for adding ARRAY write support to PostgreSQL and other dialects in the
future.
--
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]