pyspark.sql.functions.reflect¶
-
pyspark.sql.functions.
reflect
(*cols: ColumnOrName) → pyspark.sql.column.Column[source]¶ Calls a method with reflection.
New in version 3.5.0.
- Parameters
- cols
Column
or str the first element should be a literal string for the class name, and the second element should be a literal string for the method name, and the remaining are input arguments to the Java method.
- cols
Examples
>>> df = spark.createDataFrame([("a5cf6c42-0c85-418f-af6c-3e4e5b1328f2",)], ["a"]) >>> df.select( ... reflect(lit("java.util.UUID"), lit("fromString"), df.a).alias('r') ... ).collect() [Row(r='a5cf6c42-0c85-418f-af6c-3e4e5b1328f2')]