Nhập môn Spark SQL bằng Python
Mark Plutowski
Data Scientist
Spark Task là đơn vị thực thi chạy trên một CPU
Spark Stage là nhóm các task thực hiện cùng phép tính song song, mỗi task thường chạy trên một phần dữ liệu khác nhau
Spark Job là phép tính được kích hoạt bởi một action, được chia thành một hoặc nhiều stage.



spark.catalog.cacheTable('table1')spark.catalog.uncacheTable('table1')spark.catalog.isCached('table1')spark.catalog.dropTempView('table1')spark.catalog.listTables()
[Table(name='text', database=None, description=None, tableType='TEMPORARY', isTemporary=True)]


Hiển thị nơi các partition dữ liệu tồn tại
query3agg = """ SELECT w1, w2, w3, COUNT(*) as count FROM ( SELECT word AS w1, LEAD(word,1) OVER(PARTITION BY part ORDER BY id ) AS w2, LEAD(word,2) OVER(PARTITION BY part ORDER BY id ) AS w3 FROM df ) GROUP BY w1, w2, w3 ORDER BY count DESC """spark.sql(query3agg).show()




Nhập môn Spark SQL bằng Python