Hello @AgusBudianto
can you this and check once? I got it from GPT
ensure the pytz library and its timezone data are fully initialized on every worker node before the UDF is called.
import pytz
from datetime import datetime
# Force pytz to load all timezones on the driver and workers
# This is a key step to prevent the race condition
pytz.timezone('UTC')
def get_sysdate():
jkt_tz = pytz.timezone('Asia/Jakarta')
sysdate = datetime.now(jkt_tz).strftime('%Y-%m-%d %H:%M:%S')
return sysdate
spark.udf.register("get_sysdate", get_sysdate)
I did run on my workspace and got these results.
