Writing UDF for looks up in the Map in java giving Unsupported literal type class java.util.HashMap
You can pass the look up map or array etc. to the udf by using partial. check out this example. from functools import partial from pyspark.sql.functions import udf fruit_dict = {“O”: “Orange”, “A”: “Apple”, “G”: “Grape”} df = spark.createDataFrame([(“A”, 20), (“G”, 30), (“O”, 10)], [“Label”, “Count”]) def decipher_fruit(label, fruit_map): label_names = list(fruit_map.keys()) if label in … Read more