@Werner Stinckens​ you can execute spark.sql("...") in the cluster but I want to execute this for example:

collection = [1, 2, 3, 4, 5]
sum = 0
for x in collection:
     sum += x

stupid example!