Spark SQL的selectExpr

两者等价,可看作把sql语句直接拿来使用
df1.selectExpr("*","(DEST_COUNTRY_NAME = ORIGIN_COUNTRY_NAME) as withincountry").show(5)
spark.sql("select * ,
(DEST_COUNTRY_NAME = ORIGIN_COUNTRY_NAME) as withincountry from dfTable limit 5")

    原文作者:王社英
    原文地址: https://www.jianshu.com/p/444614b4a0a6
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞