analyze_pyspark_source
Statically analyzes PySpark and DLT Python source code to detect Catalyst plan bloat, anti-patterns, skew risks, watermark reordering, and missing quarantine gates.
Instructions
Statically analyze PySpark or Delta Live Tables (DLT) Python source code for Catalyst plan bloat, anti-patterns, skew risks, watermark reordering, and missing quarantine gates.
Usage Guidelines:
Use for individual Python (.py) source strings or pipeline scripts.
For SQL queries or DLT SQL statements, use analyze_sql_source instead.
For scanning entire directories or multiple repository files, use scan_pipeline_directory instead.
Behavior:
Runs 100% offline via local Python AST inspection. Does NOT connect to Databricks clusters, execute code, or require JVM/cloud credentials.
Deterministic and idempotent. Returns a structured JSON report containing finding counts and diagnostic items.
Syntax errors or invalid Python constructs are surfaced as diagnostic findings rather than raising unhandled exceptions.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"source_code": "<source_code>"
},
"name": "analyze_pyspark_source"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_name | No | Optional contextual filename for reporting (default: pipeline.py). | pipeline.py |
| source_code | Yes | Python source code of the PySpark or DLT pipeline to audit. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| findings | Yes | List of diagnostic issues detected in the PySpark source. | |
| file_name | Yes | Contextual filename that was audited. | |
| finding_count | Yes | Total number of diagnostic findings discovered. |