[SPARK-1170] Add histogram method