Skip to content

[SPARK-53148][CONNECT][SQL] Make SqlCommand in SparkConnectPlanner side effect free #51903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

heyihong
Copy link
Contributor

@heyihong heyihong commented Aug 7, 2025

What changes were proposed in this pull request?

This PR refactors the SqlCommand handling in SparkConnectPlanner to make it side-effect free by separating the transformation and execution phases. The key changes include:

  1. Separation of concerns: Split handleSqlCommand into transformSqlCommand (pure transformation) and runSQLCommand (execution with side effects)
  2. Enhanced SQL parsing: Added sqlParsedPlan methods to SparkSession to support both named and positional parameters for SQL parsing without execution

Why are the changes needed?

The handleSqlCommand method performs both transformation and execution in a single phase, making it difficult to observe, reason about and test

Does this PR introduce any user-facing change?

No. This is a purely internal refactoring.

How was this patch tested?

Existing tests (e.g. SparkConnectServiceE2ESuite)

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Cursor 1.3.9

@heyihong heyihong force-pushed the SPARK-53148 branch 2 times, most recently from 43e71e2 to c313fb7 Compare August 7, 2025 16:05
@heyihong heyihong changed the title [SPARK-53148][CONNECT][SQL] Make SqlCommand in SparkConnectPlanner side effect free [WIP[SPARK-53148][CONNECT][SQL] Make SqlCommand in SparkConnectPlanner side effect free Aug 7, 2025
@heyihong heyihong changed the title [WIP[SPARK-53148][CONNECT][SQL] Make SqlCommand in SparkConnectPlanner side effect free [WIP][SPARK-53148][CONNECT][SQL] Make SqlCommand in SparkConnectPlanner side effect free Aug 7, 2025
@heyihong heyihong force-pushed the SPARK-53148 branch 3 times, most recently from c522df8 to 3814a3d Compare August 13, 2025 14:39
@heyihong heyihong changed the title [WIP][SPARK-53148][CONNECT][SQL] Make SqlCommand in SparkConnectPlanner side effect free [SPARK-53148][CONNECT][SQL] Make SqlCommand in SparkConnectPlanner side effect free Aug 13, 2025
@heyihong heyihong force-pushed the SPARK-53148 branch 2 times, most recently from a771cd8 to 67834ee Compare August 14, 2025 12:00
@heyihong
Copy link
Contributor Author

@heyihong heyihong force-pushed the SPARK-53148 branch 2 times, most recently from 6b707da to 4771a57 Compare August 14, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant