snuyanzin commented on code in PR #18604:
URL: https://github.com/apache/flink/pull/18604#discussion_r844948656


##########
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/internal/converter/PostgresRowConverter.java:
##########
@@ -78,38 +76,20 @@ protected JdbcSerializationConverter 
createNullableExternalConverter(LogicalType
     }
 
     private JdbcDeserializationConverter 
createPostgresArrayConverter(ArrayType arrayType) {
-        // PG's bytea[] is wrapped in PGobject, rather than primitive byte 
arrays
-        if (arrayType.getElementType().is(LogicalTypeFamily.BINARY_STRING)) {
-            final Class<?> elementClass =
-                    
LogicalTypeUtils.toInternalConversionClass(arrayType.getElementType());
-            final JdbcDeserializationConverter elementConverter =
-                    
createNullableInternalConverter(arrayType.getElementType());
-
-            return val -> {
-                PgArray pgArray = (PgArray) val;
-                Object[] in = (Object[]) pgArray.getArray();
-                final Object[] array = (Object[]) 
Array.newInstance(elementClass, in.length);
-                for (int i = 0; i < in.length; i++) {
-                    array[i] =
-                            elementConverter.deserialize(((PGobject) 
in[i]).getValue().getBytes());
-                }
-                return new GenericArrayData(array);
-            };
-        } else {
-            final Class<?> elementClass =
-                    
LogicalTypeUtils.toInternalConversionClass(arrayType.getElementType());
-            final JdbcDeserializationConverter elementConverter =
-                    
createNullableInternalConverter(arrayType.getElementType());
-            return val -> {
-                PgArray pgArray = (PgArray) val;
-                Object[] in = (Object[]) pgArray.getArray();
-                final Object[] array = (Object[]) 
Array.newInstance(elementClass, in.length);
-                for (int i = 0; i < in.length; i++) {
-                    array[i] = elementConverter.deserialize(in[i]);
-                }
-                return new GenericArrayData(array);
-            };
-        }
+        // Since PGJDBC 42.2.15 (https://github.com/pgjdbc/pgjdbc/pull/1194) 
is wrapped in primitive byte arrays

Review Comment:
   ```suggestion
           // Since PGJDBC 42.2.15 (https://github.com/pgjdbc/pgjdbc/pull/1194) 
bytea[] is wrapped in primitive byte arrays
   ```
   `bytea[]` was missed



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

Reply via email to