Views
No views yet
| Language | Pass Rate |
|---|---|
| SQL | 48% |
| HiveQL | 61% |
| PL/SQL | 50% |
| Stored Procedure | 22% |
| Overall | 45% |
syntax_valid AND has_pyspark_ops AND semantic_sim (60% table name coverage).### Instruction:
Convert the following {SOURCE_LANGUAGE} code to PySpark.
Difficulty: {difficulty}
### Input:
{source_code}
### Response:1SELECT customer_id, SUM(amount) AS total
2FROM orders
3WHERE status = 'completed'
4GROUP BY customer_id
5ORDER BY total DESC;1from pyspark.sql import functions as F
2
3df = spark.table('orders')
4result = (
5 df.filter(F.col('status') == 'completed')
6 .groupBy('customer_id')
7 .agg(F.sum('amount').alias('total'))
8 .orderBy(F.col('total').desc())
9)
10result.show()