Spark dataframe filter and select, why their locations does not matter?

Viewed 32

Given a spark dataframe df, I found that df.filter(col("label")===1).select("user") equals df.select("user").filter(col("label")===1).

Could anyone tell me the reason that the location of filter does not matter? Why the second expression does not throw exception?

spark version is 2.3.4, scala version is 2.11.8

0 Answers
Related