消除重复的数据可以通过使用distinct和dropDuplicates两个方法。distinct数据去重distinct是所有的列进行去重的操作,假如你的DataFrame里面有10列,那么只有这10列完全相同才会去重。使用distinct:返回当前DataFrame中不重复的Row记录。该方法和接下来的dropDuplicates()方法不传入指定字段时的结果相同。dropDuplicates()y有四个重载方法第一个defdropDuplicates():Dataset[T]=dropDuplicates(this.columns)这个方法,不需要传入任何的参数,默认根据所有列进行去重,