spark client code