SPARK-2624 add tests
SPARK-2624 update documentation