Difference between filter and where in scala spark sql

前端 未结 3 1039
鱼传尺愫
鱼传尺愫 2020-12-31 02:14

I\'ve tried both but it works same

example

val items =  List(1, 2, 3)

using filter

employees.filter($\"emp_id\".         


        
3条回答
  •  伪装坚强ぢ
    2020-12-31 02:28

    just FYI,

    maxTsunx.filter(r => r.get(0) == 1)

    maxTsunx.where(col("ticker_id")===1)

    or

    maxTsunx.filter(col("ticker_id")===1)

    In first case, passing function to filter function

    In second case, passing condition expression (either string or column type) to filter or where function. Physical plan 2 is also possible by replacing where with filter function.

提交回复
热议问题