Package io.delta.kernel.internal.util
Class VectorUtils
Object
io.delta.kernel.internal.util.VectorUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayValuebuildArrayValue(List<?> values, DataType dataType) Creates anArrayValuefrom list of objects.static ColumnVectorbuildColumnVector(List<?> values, DataType dataType) Utility method to create aColumnVectorfor given list of object, the object should be primitive type or an Row instance.static ObjectgetValueAsObject(ColumnVector columnVector, DataType dataType, int rowId) Gets the value atrowIdfrom the column vector.static MapValuestringStringMapValue(Map<String, String> keyValues) Creates aMapValuefrom map of string keys and string values.static <T> List<T> toJavaList(ArrayValue arrayValue) Converts anArrayValueto a Java list.static <K,V> Map <K, V> Converts aMapValueto a Java map.
-
Method Details
-
toJavaList
Converts anArrayValueto a Java list. Any nested complex types are also converted to their Java type. -
toJavaMap
Converts aMapValueto a Java map. Any nested complex types are also converted to their Java type.Please note not all key types override hashCode/equals. Be careful when using with keys of: - Struct type at any nesting level (i.e. ArrayType(StructType) does not) - Binary type
-
stringStringMapValue
Creates aMapValuefrom map of string keys and string values. The typemap(string -> string)is a common occurrence in Delta Log schema.- Parameters:
keyValues-- Returns:
-
buildArrayValue
Creates anArrayValuefrom list of objects. -
buildColumnVector
Utility method to create aColumnVectorfor given list of object, the object should be primitive type or an Row instance.- Parameters:
values- list of strings- Returns:
- a
ColumnVectorwith the given values type.
-
getValueAsObject
Gets the value atrowIdfrom the column vector. The type of the Object returned depends on the data type of the column vector. For complex types array and map, returns the value as Java list or Java map. For struct type, returns anRow.
-