Hisoka-X commented on code in PR #9812:
URL: https://github.com/apache/seatunnel/pull/9812#discussion_r2319179810


##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/ArrayType.java:
##########
@@ -61,6 +66,35 @@ public ArrayType(Class<T> arrayClass, SeaTunnelDataType<E> 
elementType) {
         this.elementType = elementType;
     }
 
+    @SuppressWarnings("unchecked")
+    public static <E> ArrayType<E[], E> of(SeaTunnelDataType<E> elementType) {
+        if (elementType == null) {
+            throw CommonError.illegalArgument("elementType is null", 
OPERATION);
+        }
+        Class<E[]> arrayClass = (Class<E[]>) toArrayClass(elementType);
+        return new ArrayType<>(arrayClass, elementType);
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <E> ArrayType<?, ?> of(SeaTunnelDataType<E> elementType, int 
dimensions) {
+        if (dimensions < 1) {
+            throw CommonError.illegalArgument("dimensions must be >= 1", 
OPERATION);
+        }
+        SeaTunnelDataType<?> current = elementType;
+        for (int i = 0; i < dimensions; i++) {
+            current = of(current);
+        }
+        return (ArrayType<?, ?>) current;
+    }
+
+    public ArrayType<T[], T> addDimension() {
+        return ArrayType.of(this);
+    }
+
+    public int getDimensions() {
+        return dimensionOf(arrayClass);
+    }

Review Comment:
   I'm not sure we really need this tool. How about let's add it when we need 
it?



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