jgp*_*jgp 1 java dataframe apache-spark apache-spark-sql
我在 Java 中使用 Apache Spark 1.6.2。
我有一个包含以下内容的数据帧:
如果业务未关闭,则 close_date 中的值为 null。
我想要:
我可以让 Spark 来做还是应该手动做?
您只需要一个coalesce:
import static org.apache.spark.sql.functions.*;
df.withColumn("last_date_business", coalesce(col("close_date"), current_date()));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3509 次 |
| 最近记录: |