sridharplv
Valued Contributor II

Hi @arjunraja_azure , Below is the best version for your code which will avoid failure:

from pyspark.sql.functions import max
df = spark.read.table('workspace.default.emp')

df1 = df.agg(max('sal')) # Aggregate in separate step and also avoid caching before execution
df1.show() # Use show() instead of display()

If you still see this in Spark Connect + serverless, switch to a standard compute cluster, and it should resolve.