You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@tsfile.apache.org by "hongzhi-gao (via GitHub)" <gi...@apache.org> on 2026/09/08 02:41:33 UTC

Re: [PR] Refactor data type handling with type interfaces [tsfile]

hongzhi-gao commented on code in PR #872:
URL: https://github.com/apache/tsfile/pull/872#discussion_r3953859589


##########
java/tsfile/src/main/java/org/apache/tsfile/read/common/DescReadWriteBatchData.java:
##########
@@ -49,43 +49,7 @@ public DescReadWriteBatchData(TSDataType dataType) {
     timeRet.add(new long[capacity]);
     count = 0;
 
-    switch (dataType) {
-      case BOOLEAN:
-        booleanRet = new LinkedList<>();
-        booleanRet.add(new boolean[capacity]);
-        break;
-      case INT32:
-      case DATE:
-        intRet = new LinkedList<>();
-        intRet.add(new int[capacity]);
-        break;
-      case INT64:
-      case TIMESTAMP:
-        longRet = new LinkedList<>();
-        longRet.add(new long[capacity]);
-        break;
-      case FLOAT:
-        floatRet = new LinkedList<>();
-        floatRet.add(new float[capacity]);
-        break;
-      case DOUBLE:
-        doubleRet = new LinkedList<>();
-        doubleRet.add(new double[capacity]);
-        break;
-      case TEXT:
-      case BLOB:
-      case STRING:
-      case OBJECT:
-        binaryRet = new LinkedList<>();
-        binaryRet.add(new Binary[capacity]);
-        break;
-      case VECTOR:
-        vectorRet = new LinkedList<>();
-        vectorRet.add(new TsPrimitiveType[capacity][]);
-        break;
-      default:
-        throw new UnSupportedDataTypeException(String.valueOf(dataType));
-    }
+    Type.fromTsDataType(dataType).init(this);

Review Comment:
   DescReadWriteBatchData initializes value lists as ArrayLists but casts them to LinkedList when expanding. This causes a ClassCastException on the 1,025th value.



-- 
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: notifications-unsubscribe@tsfile.apache.org

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