databricks/Spark-The-Definitive-Guide

what does "in SQL" mean in book

yuxh opened this issue · 1 comments

yuxh commented

there are many statements in book like this:
// in Scala
df.select("ORIGIN_COUNTRY_NAME", "DEST_COUNTRY_NAME").distinct().count()
-- in SQL
SELECT COUNT(DISTINCT(ORIGIN_COUNTRY_NAME, DEST_COUNTRY_NAME)) FROM dfTable
I understand "in Scala " means execution in spark-shell. Does "in SQL" mean short hand for spark.sql("xx")? similar question is how can I execute commands in Spark-The-Definitive-Guide/code/xx.sql file?