July 2017
Intermediate to advanced
796 pages
18h 55m
English
Left semi join results in rows from only statesPopulationDF if, and only if, there is a corresponding row in statesTaxRatesDF.

Join the two datasets by the state column as follows:
val joinDF = statesPopulationDF.join(statesTaxRatesDF, statesPopulationDF("State") === statesTaxRatesDF("State"), "leftsemi")%sqlval joinDF = spark.sql("SELECT * FROM statesPopulationDF LEFT SEMI JOIN statesTaxRatesDF ON statesPopulationDF.State = statesTaxRatesDF.State")scala> joinDF.countres22: Long = 322scala> joinDF.show(5)+----------+----+----------+| State|Year|Population|+----------+----+----------+| Alabama|2010| 4785492|| Arizona|2010| 6408312| ...Read now
Unlock full access