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:
-
Field Summary
Fields inherited from interface org.apache.spark.sql.connector.expressions.Expression
EMPTY_EXPRESSION, EMPTY_NAMED_REFERENCE -
Constructor Summary
ConstructorsConstructorDescriptionVariantGet(Expression child, String path, DataType targetType, boolean failOnError, String timeZoneId) Creates VariantGet expression. -
Method Summary
Methods inherited from class org.apache.spark.sql.internal.connector.ExpressionWithToString
describe, references, toString
-
Constructor Details
-
VariantGet
public VariantGet(Expression child, String path, DataType targetType, boolean failOnError, String timeZoneId) Creates VariantGet expression.- Parameters:
child- variant column referencepath- JSON path stringtargetType- expected result typefailOnError- 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
-
path
-
targetType
-
failOnError
public boolean failOnError() -
timeZoneId
-
children
Description copied from interface:ExpressionReturns an array of the children of this node. Children should not change. -
equals
-
hashCode
public int hashCode()
-