HyukjinKwon commented on code in PR #59169:
URL: https://github.com/apache/spark/pull/59169#discussion_r4173844737


##########
python/pyspark/testing/tests/test_changed_files.py:
##########
@@ -72,6 +72,38 @@ def test_relevance(self):
             with self.subTest(desc):
                 self.assertEqual(self._is_relevant(_TEST_MODULE, files), 
expected)
 
+    def test_entry_point_proxy_selectivity(self):
+        # JVM-launched worker/daemon scripts are never imported by a test, so 
they are mapped to the
+        # API module whose use triggers them. The shared worker files are 
relevant to every test;
+        # the data source / UDTF runners only to modules that reach their 
proxy module. _TEST_MODULE
+        # reaches both sql.datasource and sql.udtf; unrelated_module reaches 
neither.
+        worker_file = "python/pyspark/worker.py"
+        datasource_worker = "python/pyspark/sql/worker/create_data_source.py"
+        udtf_worker = "python/pyspark/sql/worker/analyze_udtf.py"
+        unrelated_module = "pyspark.loose_version"
+
+        cases = [
+            ("shared worker relevant to a reaching module", _TEST_MODULE, 
worker_file, True),
+            ("shared worker relevant to an unrelated module", 
unrelated_module, worker_file, True),
+            (
+                "data source worker relevant via sql.datasource",
+                _TEST_MODULE,
+                datasource_worker,
+                True,
+            ),
+            (
+                "data source worker irrelevant to a non-datasource module",
+                unrelated_module,
+                datasource_worker,
+                False,
+            ),

Review Comment:
   **Nit (P3):** This test can't catch a wrong per-script proxy target. Both 
cases use _TEST_MODULE (reaches both sql.datasource and sql.udtf) and 
unrelated_module (reaches neither), so the UDTF and data-source cases have 
identical expected values -- mapping analyze_udtf to sql.datasource instead of 
sql.udtf (or vice versa for a data-source runner) would still pass. The one 
behavior this change adds, the specific proxy target routed by 
chain_exists(module, target), is never actually pinned. Consider adding a test 
module that reaches exactly one of {sql.datasource, sql.udtf} so the two cases 
diverge and a swapped target fails.
   
   **Verification:**
   - **Regression:** With a test module that reaches exactly one of 
{sql.datasource, sql.udtf}, mapping analyze_udtf to sql.datasource (or a 
data-source runner to sql.udtf) flips an assertion and fails the test.
   - **Behavior:** The current correct mappings and the None always-relevant 
path still pass all assertions.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to