Class VariantGet

Object
org.apache.spark.sql.internal.connector.ExpressionWithToString
org.apache.spark.sql.connector.expressions.VariantGet
All Implemented Interfaces:
Serializable, Expression

@Evolving public class VariantGet extends org.apache.spark.sql.internal.connector.ExpressionWithToString
A DSv2 connector expression that extracts a value from a variant column. It reads the value at the JSON path from the variant child and casts it to targetType. This is the connector-facing form of the variant_get / try_variant_get SQL functions: failOnError() selects between them (throw vs. return null on a cast failure), and timeZoneId() binds the time zone used for timestamp casts. V2ExpressionBuilder produces it so data sources can push variant extractions down (for example into filters).
Since:
4.3.0
See Also:
  • Constructor Details

    • VariantGet

      public VariantGet(Expression child, String path, DataType targetType, boolean failOnError, String timeZoneId)
      Creates VariantGet expression.
      Parameters:
      child - variant column reference
      path - JSON path string
      targetType - expected result type
      failOnError - whether to throw on cast failure (variant_get) or return null (try_variant_get)
      timeZoneId - timezone bound on the catalyst expression for timestamp casts, or null
  • Method Details

    • child

      public Expression child()
    • path

      public String path()
    • targetType

      public DataType targetType()
    • failOnError

      public boolean failOnError()
    • timeZoneId

      public String timeZoneId()
    • children

      public Expression[] children()
      Description copied from interface: Expression
      Returns an array of the children of this node. Children should not change.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object