Skip to content

Conversation

heyihong
Copy link
Contributor

@heyihong heyihong commented Aug 20, 2025

What changes were proposed in this pull request?

Refactored RegisterUserDefinedTableFunction handling in SparkConnectPlanner to make it side effect free by converting it from a direct handler to a command transformation that returns a LogicalPlan.

Key changes:

  • Created RegisterPythonTableFunctionCommand to encapsulate UDTF registration logic
  • Moved REGISTER_TABLE_FUNCTION case from process method to transformCommand method
  • Renamed handleRegisterUserDefinedTableFunction to transformRegisterUserDefinedTableFunction to return LogicalPlan instead of performing side effects

Why are the changes needed?

The previous implementation created side effects in SparkConnectPlanner by directly registering functions. This refactoring makes UDTF registration consistent with other commands by deferring the registration to logical plan execution.

Does this PR introduce any user-facing change?

No. This is an internal refactoring that maintains the same external behavior. UDTF registration continues to work exactly as before.

How was this patch tested?

Existing tests

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

Generated-by: Cursor 1.4.5

@heyihong heyihong changed the title [SPARK-53320] Make RegisterUserDefinedTableFunction in SparkConnectPlanner side effect free [WIP[SPARK-53320] Make RegisterUserDefinedTableFunction in SparkConnectPlanner side effect free Aug 20, 2025
@heyihong heyihong changed the title [WIP[SPARK-53320] Make RegisterUserDefinedTableFunction in SparkConnectPlanner side effect free [WIP][SPARK-53320] Make RegisterUserDefinedTableFunction in SparkConnectPlanner side effect free Aug 20, 2025
@heyihong heyihong changed the title [WIP][SPARK-53320] Make RegisterUserDefinedTableFunction in SparkConnectPlanner side effect free [SPARK-53320] Make RegisterUserDefinedTableFunction in SparkConnectPlanner side effect free Aug 20, 2025
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