viirya commented on code in PR #59: URL: https://github.com/apache/spark-connect-swift/pull/59#discussion_r2043945625
########## Sources/SparkConnect/DataFrame.swift: ########## @@ -297,6 +297,45 @@ public actor DataFrame: Sendable { return DataFrame(spark: self.spark, plan: SparkConnectClient.getLimit(self.plan.root, n)) } + /// Returns a new ``Dataset`` by sampling a fraction of rows, using a user-supplied seed. + /// - Parameters: + /// - withReplacement: Sample with replacement or not. + /// - fraction: Fraction of rows to generate, range [0.0, 1.0]. + /// - seed: Seed for sampling. + /// - Returns: A subset of the records. + public func sample(_ withReplacement: Bool, _ fraction: Double, _ seed: Int64) -> DataFrame { + return DataFrame(spark: self.spark, plan: SparkConnectClient.getSample(self.plan.root, withReplacement, fraction, seed)) + } + + /// Returns a new ``Dataset`` by sampling a fraction of rows, using a random seed. + /// - Parameters: + /// - withReplacement: Sample with replacement or not. + /// - fraction: Fraction of rows to generate, range [0.0, 1.0]. + /// - seed: Seed for sampling. Review Comment: ```suggestion ``` -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org