spark example with different method