You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/10/17 06:26:52 UTC

[GitHub] [incubator-seatunnel] FWLamb commented on a diff in pull request #3047: [Improve] [Connector-V2-Clickhouse] Support nest type and array

FWLamb commented on code in PR #3047:
URL: https://github.com/apache/incubator-seatunnel/pull/3047#discussion_r996653946


##########
seatunnel-translation/seatunnel-translation-spark/seatunnel-translation-spark-common/src/main/java/org/apache/seatunnel/translation/spark/common/serialization/InternalRowConverter.java:
##########
@@ -216,4 +213,31 @@ private static SeaTunnelRow reconvert(InternalRow engineRow, SeaTunnelRowType ro
         }
         return new SeaTunnelRow(fields);
     }
+
+    private static Object reconvertArray(Object field, SeaTunnelDataType<?> dataType) {
+        BasicType<?> elementType = ((ArrayType<?, ?>) dataType).getElementType();
+        Object[] objectArray = ((ArrayData) field).toObjectArray(TypeConverterUtils.convert(elementType));
+        switch (elementType.getSqlType()) {

Review Comment:
   > Why we need copy data from array to another array?
   
   Because we need to convert the object type array to the exact wrapper type array according to the SQL type. If we do not do this, when JDBC inserts the array data, it will return ClassCastException.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org