Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/14181#discussion_r75968909
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
@@ -1534,15 +1534,15 @@ class Dataset[T] private[sql](
* Returns a new Dataset by sampling a fraction of rows.
*
* @param withReplacement Sample with replacement or not.
- * @param fraction Fraction of rows to generate.
+ * @param fraction Fraction of rows to generate and the range is 0.0 <=
`fraction` <= 1.0.
* @param seed Seed for sampling.
*
* @group typedrel
* @since 1.6.0
*/
def sample(withReplacement: Boolean, fraction: Double, seed: Long):
Dataset[T] = {
- require(fraction >= 0,
- s"Fraction must be nonnegative, but got ${fraction}")
+ require(fraction >= 0 && fraction <= 1.0,
+ s"Fraction range must be 0.0 <= `fraction` <= 1.0, but got
${fraction}")
--- End diff --
Hi @maropu, I just wonder if this fix is needed though just to be
consistent whether `withRelacement` is `true` or not.
---
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]