JingsongLi commented on code in PR #1065:
URL: https://github.com/apache/incubator-paimon/pull/1065#discussion_r1185639714


##########
paimon-common/src/test/java/org/apache/paimon/data/DataFormatTestUtil.java:
##########
@@ -43,6 +44,13 @@ public static String toStringNoRowKind(InternalRow row, 
RowType type) {
                 Object field = fieldGetter.getFieldOrNull(row);
                 if (field instanceof byte[]) {
                     build.append(Arrays.toString((byte[]) field));
+                } else if (field instanceof ColumnarArray) {

Review Comment:
   `instanceof InternalArray`?



##########
paimon-common/src/main/java/org/apache/paimon/utils/TypeUtils.java:
##########
@@ -115,6 +118,19 @@ public static Object castFromString(String s, DataType 
type) {
             case TIMESTAMP_WITHOUT_TIME_ZONE:
                 TimestampType timestampType = (TimestampType) type;
                 return toTimestamp(str, timestampType.getPrecision());
+            case ARRAY:
+                ArrayType arrayType = (ArrayType) type;

Review Comment:
   if str startswith "[", remove "[".
   if str endswith "]", remove "]".



##########
paimon-common/src/test/java/org/apache/paimon/data/DataFormatTestUtil.java:
##########
@@ -43,6 +44,13 @@ public static String toStringNoRowKind(InternalRow row, 
RowType type) {
                 Object field = fieldGetter.getFieldOrNull(row);
                 if (field instanceof byte[]) {
                     build.append(Arrays.toString((byte[]) field));
+                } else if (field instanceof ColumnarArray) {
+                    ColumnarArray columnarArray = (ColumnarArray) field;
+                    String[] result = new String[columnarArray.size()];
+                    for (int j = 0; j < columnarArray.size(); j++) {
+                        result[j] = columnarArray.getString(j).toString();

Review Comment:
   here we can use `InternalArray.ElementGetter` to get object and to string.



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