Using either the DataFrame API (df.groupby(\'id\').sum()) or Spark SQL (spark.sql(\'select * from tableA\')) we can build complex queries. I\'m writing
df.groupby(\'id\').sum()
spark.sql(\'select * from tableA\')