spark code