Class SparkVariants

java.lang.Object
dev.vortex.spark.SparkVariants

public final class SparkVariants extends Object
Spark's VARIANT type, which Spark 4 introduced, as Vortex stores it: Arrow's arrow.parquet.variant extension, a struct of the binary metadata and value of each variant.

Spark 3.5 has no VARIANT, and its build carries a class of this name that supports none.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The Arrow extension name Vortex reads as its variant type.
  • Method Summary

    Modifier and Type
    Method
    Description
    static dev.vortex.relocated.org.apache.arrow.vector.types.pojo.Field
    arrowField(String name, boolean nullable)
    The Arrow field holding a variant column named name.
    static boolean
    isVariant(dev.vortex.relocated.org.apache.arrow.vector.types.pojo.Field field)
    Whether field is Arrow's variant extension.
    static boolean
    isVariant(org.apache.spark.sql.types.DataType dataType)
    Whether dataType is Spark's variant type.
    static Optional<org.apache.spark.sql.types.DataType>
    Spark's variant type, when this Spark has one.
    static void
    write(dev.vortex.relocated.org.apache.arrow.vector.complex.StructVector vector, org.apache.spark.sql.catalyst.expressions.SpecializedGetters row, int ordinal, int index)
    Writes the variant at ordinal of row into row index of vector.
    static void
    writeNull(dev.vortex.relocated.org.apache.arrow.vector.complex.StructVector vector, int index)
    Marks row index of vector null, with empty, non-null parts.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EXTENSION

      public static final String EXTENSION
      The Arrow extension name Vortex reads as its variant type.
      See Also:
  • Method Details

    • isVariant

      public static boolean isVariant(org.apache.spark.sql.types.DataType dataType)
      Whether dataType is Spark's variant type.
    • variantType

      public static Optional<org.apache.spark.sql.types.DataType> variantType()
      Spark's variant type, when this Spark has one.
    • isVariant

      public static boolean isVariant(dev.vortex.relocated.org.apache.arrow.vector.types.pojo.Field field)
      Whether field is Arrow's variant extension.
    • arrowField

      public static dev.vortex.relocated.org.apache.arrow.vector.types.pojo.Field arrowField(String name, boolean nullable)
      The Arrow field holding a variant column named name.
    • write

      public static void write(dev.vortex.relocated.org.apache.arrow.vector.complex.StructVector vector, org.apache.spark.sql.catalyst.expressions.SpecializedGetters row, int ordinal, int index)
      Writes the variant at ordinal of row into row index of vector.
    • writeNull

      public static void writeNull(dev.vortex.relocated.org.apache.arrow.vector.complex.StructVector vector, int index)
      Marks row index of vector null, with empty, non-null parts.