pyspark.sql.functions.java_method#
- pyspark.sql.functions.java_method(*cols)[source]#
- Calls a method with reflection. - New in version 3.5.0. - Parameters
- colsColumnor 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 - >>> import pyspark.sql.functions as sf >>> spark.range(1).select( ... sf.java_method( ... sf.lit("java.util.UUID"), ... sf.lit("fromString"), ... sf.lit("a5cf6c42-0c85-418f-af6c-3e4e5b1328f2") ... ) ... ).show(truncate=False) +-----------------------------------------------------------------------------+ |java_method(java.util.UUID, fromString, a5cf6c42-0c85-418f-af6c-3e4e5b1328f2)| +-----------------------------------------------------------------------------+ |a5cf6c42-0c85-418f-af6c-3e4e5b1328f2 | +-----------------------------------------------------------------------------+