import org.apache.spark.sql.catalyst.expressions.CallMethodViaReflection
import org.apache.spark.sql.catalyst.expressions.Literal
scala> val expr = CallMethodViaReflection(
     |   Literal("java.time.LocalDateTime") ::
     |   Literal("now") :: Nil)
expr: org.apache.spark.sql.catalyst.expressions.CallMethodViaReflection = reflect(java.time.LocalDateTime, now)
scala> println(expr.numberedTreeString)
00 reflect(java.time.LocalDateTime, now)
01 :- java.time.LocalDateTime
02 +- now
// CallMethodViaReflection as the expression for reflect SQL function
val q = """
  select reflect("java.time.LocalDateTime", "now") as now
  """
val plan = spark.sql(q).queryExecution.logical
// CallMethodViaReflection shows itself under "reflect" name
scala> println(plan.numberedTreeString)
00 Project [reflect(java.time.LocalDateTime, now) AS now#39]
01 +- OneRowRelation$
CallMethodViaReflection Expression
CallMethodViaReflection is an expression that represents a static method call in Scala or Java using reflect and java_method functions.
| 
 Note 
 | 
reflect and java_method functions are only supported in SQL and expression modes.
 | 
| DataType | JVM Type | 
|---|---|
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
CallMethodViaReflection supports a fallback mode for expression code generation.
| Property | Description | 
|---|---|
  | 
|
Disabled (i.e.   | 
|
Enabled (i.e.   | 
|
  | 
| 
 Note 
 | 
CallMethodViaReflection is very similar to StaticInvoke expression.
 |