dongjoon-hyun commented on code in PR #60306:
URL: https://github.com/apache/spark/pull/60306#discussion_r4533564611


##########
python/pyspark/sql/dataframe.py:
##########
@@ -78,6 +79,31 @@
 __all__ = ["DataFrame", "DataFrameNaFunctions", "DataFrameStatFunctions"]
 
 
+def validate_approx_quantile_relative_error(relativeError: Any) -> float:

Review Comment:
   **[3] Nit: could the helper name start with an underscore?**
   
   `pyspark.sql.dataframe` is a public API module, so 
`validate_approx_quantile_relative_error` shows up next to `DataFrame` in IDE 
completion and `dir()`, and `from pyspark.sql.dataframe import 
validate_approx_quantile_relative_error` works, even though it is not in 
`__all__`. Internal helpers that other modules import usually start with an 
underscore, such as `_parse_datatype_json_string` and 
`_validate_vectorized_udf`, which `classic/dataframe.py` and 
`connect/dataframe.py` already import. Could it be 
`_validate_approx_quantile_relative_error`? The same applies to 
`validate_approx_quantile_probabilities` in #60248.



##########
python/pyspark/sql/classic/dataframe.py:
##########
@@ -73,7 +74,11 @@
     _first_timestamp_nanos_map_key_type,
     _parse_datatype_json_string,
 )
-from pyspark.sql.utils import get_active_spark_context, to_java_array, 
to_scala_map
+from pyspark.sql.utils import (
+    get_active_spark_context,
+    to_java_array,
+    to_scala_map,
+)

Review Comment:
   **[4] Nit: this import is only rewrapped.**
   
   No name is added to the `pyspark.sql.utils` import. The rewrap looks left 
over from the first commit, which imported the helper from `pyspark.sql.utils` 
before 91b2507 moved it. Could we keep the original line, so the diff stays 
small? #60248 has the same rewrap.
   ```suggestion
   from pyspark.sql.utils import get_active_spark_context, to_java_array, 
to_scala_map
   ```



##########
python/pyspark/sql/dataframe.py:
##########
@@ -35,6 +35,7 @@
 
 from pyspark import _NoValue
 from pyspark._globals import _NoValueType
+from pyspark.errors import PySparkTypeError, PySparkValueError

Review Comment:
   **[5] Nit: the module-level import makes two local imports redundant.**
   
   This file has imported `pyspark.errors` only inside functions so far, e.g. 
`from pyspark.errors import PySparkTypeError` in `_preapare_args_for_sample` 
(L2200) and `from pyspark.errors import PySparkIndexError, PySparkTypeError, 
PySparkValueError` in `_preapare_cols_for_sort` (L3329). With this module-level 
import, those two now re-import names that are already global. Could the helper 
import them locally like the rest of the file? #60248 adds the same line.



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