我有一个特定的要求,其中我需要检查空的DataFrame。如果为空,则填充默认值。这是我尝试过的,但没有得到我想要的。def checkNotEmpty(df: org.apache.spark.sql.DataFrame, col: String):org.apache.spark.sql.DataFrame =}
val age = checkNotEmpty(w_feature_md.filter("age='22'").select("age_i
$.head(List.scala:420) at org.apache.spark.sql.catalyst.encoders.ExpressionEncoder(Aggregator.scala:100)
at org.apache.spark.sql.KeyValueGroupedDataset.reduceGroups(KeyValueGroup
我已经检查了下面的问题,它给出了python或scala的解决方案。和for java的方法是不同的。How to replace null values with a specific value in Dataframe using spark in Java?因此,所有列值都是字符串。其中一些值为空。我使用.na().fill("")将null值替换为空字符串 Dataset<Row> ds1