I know Kmeans is not a good selection to be applied to categorical data, but we dont have much options in spark 1.4 for clustering categorical data. Regardless of above issue. I'm getting errors in my below code. I read my table from hive, use onehotencoder in a pipeline and then send the code into Kmeans.I know Kmeans is not a good selection to be app