viirya commented on code in PR #16: URL: https://github.com/apache/spark-connect-swift/pull/16#discussion_r1994366213
########## Sources/SparkConnect/DataFrame.swift: ########## @@ -192,4 +192,38 @@ public actor DataFrame: Sendable { print(table.render()) } } + + /// Projects a set of expressions and returns a new ``DataFrame``. + /// - Parameter cols: Column names + /// - Returns: A ``DataFrame`` with subset of columns. + public func select(_ cols: String...) -> DataFrame { + return DataFrame(spark: self.spark, plan: SparkConnectClient.getProject(self.plan.root, cols)) + } + + /// Return a new ``DataFrame`` sorted by the specified column(s). + /// - Parameter cols: Column names. + /// - Returns: A sorted ``DataFrame`` + public func sort(_ cols: String...) -> DataFrame { + return DataFrame(spark: self.spark, plan: SparkConnectClient.getSort(self.plan.root, cols)) + } + + /// <#Description#> + /// - Parameter cols: <#cols description#> + /// - Returns: <#description#> + public func orderBy(_ cols: String...) -> DataFrame { + return DataFrame(spark: self.spark, plan: SparkConnectClient.getSort(self.plan.root, cols)) + } + + /// Limits the result count to the number specified. + /// - Parameter n: Number of records to return. Will return this number of records or all records if the ``DataFrame`` contains less than this number of records. + /// - Returns: A subset of the records + public func limit(_ n: Int32) -> DataFrame { + return DataFrame(spark: self.spark, plan: SparkConnectClient.getLimit(self.plan.root, n)) + } + + /// Chec if the ``DataFrame`` is empty and returns a boolean value. Review Comment: ```suggestion /// Checks if the ``DataFrame`` is empty and returns a boolean value. ``` -- 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