这是一个完全菜鸟的问题,很抱歉。在 Spark 中,我可以使用 select as:
df.select("*"); //to select everything
df.select(df.col("colname")[, df.col("colname")]); //to select one or more columns
df.select(df.col("colname"), df.col("colname").plus(1)) //to select a column and a calculated column
但。如何选择所有列加上计算的列?显然 select("*", df.col("colname").plus(1))
不起作用(编译错误)。这在JAVA下怎么实现呢?谢谢!
原文由 lte__ 发布,翻译遵循 CC BY-SA 4.0 许可协议
做就是了: