StaticInvoke¶
StaticInvoke is an expression with no SQL representation that represents a static method call in Scala or Java.
StaticInvoke supports Java code generation to evaluate itself.
StaticInvoke is <
-  
ScalaReflectionis requested for the deserializer or serializer for a Scala type -  
RowEncoder is requested for
deserializerForor serializer for a Scala type -  
JavaTypeInferenceis requested fordeserializerFororserializerFor 
import org.apache.spark.sql.types.StructType
val schema = new StructType()
  .add($"id".long.copy(nullable = false))
  .add($"name".string.copy(nullable = false))
import org.apache.spark.sql.catalyst.encoders.RowEncoder
val encoder = RowEncoder(schema)
scala> println(encoder.serializer(0).numberedTreeString)
00 validateexternaltype(getexternalrowfield(assertnotnull(input[0, org.apache.spark.sql.Row, true]), 0, id), LongType) AS id#1640L
01 +- validateexternaltype(getexternalrowfield(assertnotnull(input[0, org.apache.spark.sql.Row, true]), 0, id), LongType)
02    +- getexternalrowfield(assertnotnull(input[0, org.apache.spark.sql.Row, true]), 0, id)
03       +- assertnotnull(input[0, org.apache.spark.sql.Row, true])
04          +- input[0, org.apache.spark.sql.Row, true]
NOTE: StaticInvoke is similar to CallMethodViaReflection expression.
Creating Instance¶
StaticInvoke takes the following when created:
- [[staticObject]] Target object of the static call
 - [[dataType]] Data type of the return value of the <
>  - [[functionName]] Name of the method to call on the <
>  - [[arguments]] Optional Expression.md[expressions] to pass as input arguments to the <
>  - [[propagateNull]] Flag to control whether to propagate 
nullsor not (enabled by default). If any of the arguments isnull,nullis returned instead of calling the <>