You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "hvanhovell (via GitHub)" <gi...@apache.org> on 2023/03/17 22:13:36 UTC
[GitHub] [spark] hvanhovell commented on a diff in pull request #40413: [SPARK-42786][Connect] Typed Select
hvanhovell commented on code in PR #40413:
URL: https://github.com/apache/spark/pull/40413#discussion_r1140760114
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -1084,6 +1084,68 @@ class Dataset[T] private[sql] (
}
}
+ /**
+ * Internal helper function for building typed selects that return tuples. For simplicity and
+ * code reuse, we do this without the help of the type system and then use helper functions that
+ * cast appropriately for the user facing interface.
+ */
+ private def selectUntyped(columns: TypedColumn[_, _]*): Dataset[_] = {
+ val encoder = ProductEncoder.tuple(columns.map(_.encoder))
+ sparkSession.newDataset(encoder) { builder =>
Review Comment:
Nit you could make this is a bit DRYer if you combine some of the code with select.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org