Github user holdenk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12207#discussion_r59281355
  
    --- Diff: python/pyspark/sql/dataframe.py ---
    @@ -1181,18 +1181,25 @@ def approxQuantile(self, col, probabilities, 
relativeError):
             Space-efficient Online Computation of Quantile Summaries]]
             by Greenwald and Khanna.
     
    -        :param col: the name of the numerical column
    +        :param cols: str, list.
    +            Can be a single column name, or a list of names for multiple 
columns.
             :param probabilities: a list of quantile probabilities
    -          Each number must belong to [0, 1].
    -          For example 0 is the minimum, 0.5 is the median, 1 is the 
maximum.
    -        :param relativeError:  The relative target precision to achieve
    -          (>= 0). If set to zero, the exact quantiles are computed, which
    -          could be very expensive. Note that values greater than 1 are
    -          accepted but give the same result as 1.
    -        :return:  the approximate quantiles at the given probabilities
    -        """
    -        if not isinstance(col, str):
    -            raise ValueError("col should be a string.")
    +            Each number must belong to [0, 1].
    +            For example 0 is the minimum, 0.5 is the median, 1 is the 
maximum.
    +        :param relativeError: The relative target precision to achieve
    +            (>= 0). If set to zero, the exact quantiles are computed, which
    +            could be very expensive. Note that values greater than 1 are
    +            accepted but give the same result as 1.
    +        :return: the approximate quantiles at the given probabilities for
    +            the given column or columns.
    +        """
    +        if not isinstance(cols, (str, list, tuple)):
    +            raise ValueError("col should be a string, list or tuple.")
    +
    +        if isinstance(cols, tuple):
    +            cols = list(cols)
    +        if isinstance(cols, list):
    +            cols = _to_list(self._sc, cols)
    --- End diff --
    
    We could consider verifying the contents of the list as done for 
probabilities right bellow (but just a minor point and probably not as 
important - just if people pass in a list of expressions rather than strings 
would be nice to have a useful error message).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to