两者等价,可看作把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")
两者等价,可看作把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")