ueshin opened a new pull request, #51821:
URL: https://github.com/apache/spark/pull/51821
### What changes were proposed in this pull request?
Introduces `ansi_mode_context` to avoid multiple config checks per API call.
### Why are the changes needed?
Currently `is_ansi_mode_enabled` is called many times, which could cause a
performance issue as it retrieves the related config every time it's called.
For example:
```py
many_columns = ps.DataFrame({f"col_{i}": [i] for i in range(500)})
many_columns + 1
```
will cause the roundtrip between the client and the server 500 times. To be
exact, classic needs two roundtrips to check configs, so the number is 1000
times.
We should reduce the number of calls to at most once per API call.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
The existing tests should pass, also manually checked the number of config
retrivals.
### Was this patch authored or co-authored using generative AI tooling?
No.
--
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]