Use a UTF-8 locale for PySpark integration tests #17083
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #17083"
general
weight: 0.35
wjxiz1992
Fixes #17063. Related to #17086.
Description
The PySpark path tests write a partition named
p=路径before comparing CPU and GPU reads. In premerge's local mode the write runs in the driver JVM. A standalone executor inherits the environment of its Worker and can fail to encode the same filename even when the test driver uses UTF-8.The shared PySpark test launcher selects a UTF-8 locale before starting Spark and passes the effective locale to executors through
spark.executorEnv.LC_ALL. This applies to both Spark 3 and Spark 4.<details>
<summary>How the locale reaches the process that writes the partition</summary>
1. Image and test entry point. The Ubuntu premerge Dockerfile runs
locale-gen en_US.UTF-8and leaves the default locale unset. The regular path test invokes the shared launcher without a locale argument. The separateLC_ALL=en_US.UTF-8assignment applies only to the regex test command. Ubuntu Dockerfile · Premerge test commands2. CPython startup. With C-locale coercion enabled, an initial character locale of
C, andLC_ALLunset or empty, CPython 3.10 triesC.UTF-8,C.utf8, thenUTF-8. It exports the first usable candidate asLC_CTYPEbefore pytest runs. In a rebuild of the premerge image, Python 3.10.12 selectedC.UTF-8with no test-side setting. WithLC_ALL=CorPYTHONCOERCECLOCALE=0, Python still reported UTF-8 mode in this experiment, but the child JDK 17 reported ASCII for its filename encoding (sun.jnu.encoding). Startup condition · Startup call · Candidate order · Selection loop · LC_CTYPE export3. Premerge execution. Premerge
#15564ran pytest via Python with Spark 3.3.0 inlocal[4,1]. PySpark copies the Python environment when it launches the driver JVM. In local mode that JVM also runs the CPU task that writesp=路径, before the GPU read. The historical log records the launch mode and passing test. The child JVM’s UTF-8 filename encoding was measured in the reproduction. Python test entry point · PySpark child environment · Partition write4. Nightly execution and the fix. In the Rocky nightly image, the shell starts a standalone Worker before Python starts. The Worker later launches the executor that writes the partition. A locale set inside Python cannot update that Worker’s environment. This PR exports
PYSP_TEST_spark_executorEnv_LC_ALLin the shared launcher. The test harness maps it tospark.executorEnv.LC_ALLon the SparkSession builder, and the Worker applies that value to the new executor process. Rocky Dockerfile · Nightly Worker startup · Launcher export · Test harness configuration · Worker child environment</details>
Locally, we started a standalone Worker with
LC_ALL=Cand rantest_path_characters[base-v1-parquet-PERFILE]with the test launcher inC.UTF-8. On Spark 3.3.0, 4.0.1, and 4.0.5 the original launcher failed withInvalidPathExceptionon the Chinese partition name. With the fix, the same test passed its CPU write, GPU read, and result checks. All 44 path-character cases also passed on Spark 4.0.5 and 4.1.1 in earlier launcher validation.The change and this description were prepared with Codex assistance.
Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance