Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-49978][R] Move sparkR deprecation warning to package attach time
### What changes were proposed in this pull request? Previously, the output deprecation warning happens in the `spark.session` function, in this PR, we move it to the `.onAttach` function so it will be triggered whenever library is attached ### Why are the changes needed? I believe having the warning message on attach time have the following benefits: - **Have a more prompt warning.** If the deprecation is for the whole package instead of just the `sparkR.session` function, it is more intuitive for the warning to show up on attach time instead of waiting til later time - **Do not rely on the assumption of "every sparkR user will run sparkR.session method".** This asumption may not hold true all the time. For example, some hosted spark platform like Databricks already configure the spark session in the background and therefore will not show the error message. So making this change should make sure a broader reach for this warning notification - **Less intrusive warning**. Previous warning show up every time `sparkR.session` is called, but the new warning message will only show up once even if user run multiple `library`/`require` commands ### Does this PR introduce _any_ user-facing change? **Yes** 1. No more waring message in sparkR.session method 2. Warning message on library attach (when calling `library`/`require` function) <img width="859" alt="image" src="https://github.com/user-attachments/assets/d88d9108-ec63-4f69-8de6-3f34eeafdd0c"> 3. Able to surpress warning by setting `SPARKR_SUPPRESS_DEPRECATION_WARNING` <img width="733" alt="image" src="https://github.com/user-attachments/assets/0266e6dd-3dc7-4c20-b999-b83906f381cd"> ### How was this patch tested? Just a simple migration change, will rely on existing pre/post-merge check, and this existing test Also did manual testing(see previous section for screenshot) ### Was this patch authored or co-authored using generative AI tooling? No Closes #48482 from tinglongliao-db/sparkR-deprecation-migration. Authored-by: Tinglong Liao <tinglong.liao@databricks.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
- Loading branch information