HyukjinKwon opened a new pull request #35917:
URL: https://github.com/apache/spark/pull/35917


   ### What changes were proposed in this pull request?
   
   This PR proposes to add a new alias `PYSPARK_PANDAS_USAGE_LOGGER` for 
`KOALAS_USAGE_LOGGER`.
   
   ### Why are the changes needed?
   
   To avoid legacy name, Koalas.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, uses can set `PYSPARK_PANDAS_USAGE_LOGGER` environment variable for 
using a usage logger.
   
   ### How was this patch tested?
   
   Manual positive tests:
   
   ```bash
   PYSPARK_PANDAS_USAGE_LOGGER=pyspark.pandas.usage_logging.usage_logger 
./bin/pyspark
   ```
   
   ```python
   >>> import pyspark.pandas as ps
   >>> df = ps.range(1)
   >>> import logging
   >>> import sys
   >>> root = logging.getLogger()
   >>> root.setLevel(logging.INFO)
   >>> handler = logging.StreamHandler(sys.stdout)
   >>> handler.setLevel(logging.INFO)
   >>> formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - 
%(message)s')
   >>> handler.setFormatter(formatter)
   >>> root.addHandler(handler)
   >>> df.id.sort_values()
   ...
   INFO:pyspark.pandas.usage_logger:A function `DataFrame.__getattr__(self, 
key)` was successfully finished after 0.136 ms.
   ....
   ```
   
   ```bash
   KOALAS_USAGE_LOGGER=pyspark.pandas.usage_logging.usage_logger ./bin/pyspark
   ```
   
   ```python
   >>> import pyspark.pandas as ps
   >>> df = ps.range(1)
   >>> import logging
   >>> import sys
   >>> root = logging.getLogger()
   >>> root.setLevel(logging.INFO)
   >>> handler = logging.StreamHandler(sys.stdout)
   >>> handler.setLevel(logging.INFO)
   >>> formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - 
%(message)s')
   >>> handler.setFormatter(formatter)
   >>> root.addHandler(handler)
   >>> df.id.sort_values()
   ...
   2022-03-21 11:51:21,039 - pyspark.pandas.usage_logger - INFO - A function 
`DataFrame.__getattr__(self, key)` was successfully finished after 0.107 ms.
   ...
   ```
   
   Manual negative tests:
   
   ```bash
   PYSPARK_PANDAS_USAGE_LOGGER=abc ./bin/pyspark
   ```
   
   ```python
   >>> import pyspark.pandas as ps
   WARNING:pyspark.pandas.usage_logger:Tried to attach usage logger `abc`, but 
an exception was raised: module 'abc' has no attribute 'get_logger'
   ```
   
   ```bash
   KOALAS_USAGE_LOGGER=abc ./bin/pyspark
   ```
   
   ```python
   >>> import pyspark.pandas as ps
   WARNING:pyspark.pandas.usage_logger:Tried to attach usage logger `abc`, but 
an exception was raised: module 'abc' has no attribute 'get_logger'
   ```


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