HyukjinKwon opened a new pull request, #174:
URL: https://github.com/apache/spark-connect-rust/pull/174

   ### What changes were proposed in this pull request?
   
   [SPARK-60952](https://issues.apache.org/jira/browse/SPARK-60952): these 
functions now send their optional arguments, as PySpark 4.3.0 does:
   
   - `hmac(key, message, algorithm)`
   - `variant_set(v, path, value, create_if_missing)` and `try_variant_set`
   - `vector_norm(vector, degree)` and `vector_normalize(vector, degree)`
   - `counter_diff(value, startTime)`
   
   The Python wrappers take PySpark's signatures:
   - An optional argument is sent when it is given, and `None` is not given.
   - `variant_set` and `try_variant_set` always send `create_if_missing`, 
`True` by default, as PySpark does.
   
   The Rust core has `hmac_with_algorithm`, 
`variant_set_with_create_if_missing`, `try_variant_set_with_create_if_missing`, 
`vector_norm_with_degree`, `vector_normalize_with_degree` and 
`counter_diff_with_start_time`, which the dispatch uses when the argument is 
given.
   
   ### Why are the changes needed?
   
   The wrappers took these arguments, but the dispatch sent only the leading 
ones, so the results were silently wrong:
   
   - `F.hmac(k, m, F.lit("SHA-1"))` computed an HMAC-SHA256.
   - `variant_set(v, "$.b", lit(2), False)` inserted the missing path.
   - `vector_norm(vec, one)` computed the L2 norm: 5.0 for `[3.0, 4.0]`, where 
PySpark gives 7.0.
   - `counter_diff(value, startTime)` ignored `startTime`.
   
   An explicit `None`, as `vector_norm(v, None)`, was also sent as the argument.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, these functions now compute as in PySpark 4.3.0.
   
   ### How was this patch tested?
   
   - Against a local Spark 4.3.0 server, `hmac` with `SHA-1`, `variant_set` 
with `create_if_missing=False` and the default, and `vector_norm` and 
`vector_normalize` of degree 1 give the same values as official PySpark 4.3.0; 
before this change, they gave the defaults' values.
   - The reprs of the fourteen calls of a probe have the same arguments as 
official PySpark 4.3.0. Two print their literals differently, as `true` rather 
than `True` and `1` rather than `1.0`, which 
[SPARK-60948](https://issues.apache.org/jira/browse/SPARK-60948) tracks.
   - New offline tests check that each optional argument is sent when given and 
not when `None`; their cases agree with official PySpark 4.3.0. A new live test 
checks the values, and it also passes with official PySpark 4.3.0.
   - The lib tests and every integration test, e2e included, against the local 
server (643 passed), the build of all tests with `wasm-udf`, the offline Python 
suites (620 passed, 8 live cases skipped), and the live drop-in and Arrow 
suites (58 passed) and live cases (10 passed). Clippy reports no diagnostics in 
the changed lines.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


-- 
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