Skip to content

[SPARK-59886][UDF][TESTS][FOLLOWUP] Test scalar external UDFs end to end through a direct gRPC worker - #59155

Open
zozo123 wants to merge 5 commits into
apache:masterfrom
zozo123:SPARK-59886-e2e
Open

zozo123 wants to merge 5 commits into
apache:masterfrom
zozo123:SPARK-59886-e2e

Conversation

@zozo123

@zozo123 zozo123 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Depends on #59153. The commits before 00ece1b3 are that pull request. Please review 00ece1b3 only.

What changes were proposed in this pull request?

PlanExternalUDFsSuite runs a scalar external UDF through the real DIRECT path. ExecuteExternalUDFExec asks SparkEnv for the built-in dispatcher. DirectGrpcDispatcher starts EchoGrpcWorkerMain and talks to it over a Unix domain socket. The echo worker returns each Arrow batch unchanged, so a bigint column is an identity function.

The test input is Range(0, 6) in two partitions. The collected rows are (0, 0) through (5, 5).

sql/core gains a test-scoped dependency on spark-udf-worker-grpc and its test jar, so the reflective load of DirectDispatcherFactory succeeds in this suite. core still does not depend on gRPC.

This replaces the suite's missing-runtime assertion. SparkEnvUDFDispatcherSuite still covers that error on the core classpath, which does not contain the gRPC module.

Why are the changes needed?

#59153 routes DIRECT to the built-in factory, and the SQL node can already stream Arrow batches. Nothing in sql/core checked that a query returns rows from a spawned worker. This test is that check. Shading and a Python worker stay in SPARK-57214 and the Python worker tickets.

Does this PR introduce any user-facing change?

No. The new dependency is test scope. A packaged Spark still reports the missing runtime until SPARK-57214.

How was this patch tested?

  • sql/testOnly org.apache.spark.sql.execution.externalUDF.PlanExternalUDFsSuite on macOS. 32 tests passed, including this one. The log shows one kqueue domain socket per task.
  • The same suite on Linux aarch64. 32 tests passed. The log shows epoll domain sockets.
  • sql/Test/scalastyle reported 0 errors.

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

Generated-by: Cursor Grok 4.7

Made with Cursor

zozo123 and others added 5 commits September 30, 2026 12:03
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the review focused on Spark-owned worker routing by dropping the unrelated formatting churn.

Co-authored-by: Cursor <cursoragent@cursor.com>
The class-name hook never shipped, so a compatibility check is unnecessary.

Co-authored-by: Cursor <cursoragent@cursor.com>
…class loader

The thread context class loader includes user artifacts, so a user jar could supply the Spark-owned factory class name while spark-udf-worker-grpc is absent from the engine classpath.

Co-authored-by: Cursor <cursoragent@cursor.com>
…end through a direct gRPC worker

Runs a scalar external UDF query through the built-in DIRECT dispatcher, which spawns the gRPC echo worker over a Unix domain socket, and asserts the returned rows. Replaces the test that asserted the gRPC runtime was missing from the sql/core test classpath.

Co-authored-by: Cursor <cursoragent@cursor.com>
@HyukjinKwon

Copy link
Copy Markdown
Member

cc @haiyangsun-db FYI

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants