Implemented with java api for Apache Spark