Spark SQL and DataFrame API mastery - window functions, aggregations, CTEs, query optimization, and advanced analytical patterns.