Class VectorUtils

Object
io.delta.kernel.internal.util.VectorUtils

public final class VectorUtils extends Object
  • Method Details

    • toJavaList

      public static <T> List<T> toJavaList(ArrayValue arrayValue)
      Converts an ArrayValue to a Java list. Any nested complex types are also converted to their Java type.
    • toJavaMap

      public static <K, V> Map<K,V> toJavaMap(MapValue mapValue)
      Converts a MapValue to 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

      public static MapValue stringStringMapValue(Map<String,String> keyValues)
      Creates a MapValue from map of string keys and string values. The type map(string -> string) is a common occurrence in Delta Log schema.
      Parameters:
      keyValues -
      Returns:
    • buildArrayValue

      public static ArrayValue buildArrayValue(List<?> values, DataType dataType)
      Creates an ArrayValue from list of objects.
    • buildColumnVector

      public static ColumnVector buildColumnVector(List<?> values, DataType dataType)
      Utility method to create a ColumnVector for given list of object, the object should be primitive type or an Row instance.
      Parameters:
      values - list of strings
      Returns:
      a ColumnVector with the given values type.
    • getValueAsObject

      public static Object getValueAsObject(ColumnVector columnVector, DataType dataType, int rowId)
      Gets the value at rowId from 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 an Row.