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

    https://github.com/apache/spark/pull/11443#discussion_r73107764
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala ---
    @@ -745,6 +825,80 @@ class DataFrame private[sql](
       }
     
       /**
    +   * Returns a new [[Dataset]] by computing the given [[Column]] 
expression for each element.
    +   *
    +   * {{{
    +   *   val ds = Seq(1, 2, 3).toDS()
    +   *   val newDS = ds.select(expr("value + 1").as[Int])
    +   * }}}
    +   * @since 1.6.0
    +   */
    +  def select[U1: Encoder](c1: TypedColumn[T, U1]): Dataset[U1] = {
    --- End diff --
    
    @vlad17 The reason why the snippet in your Gist fails is that `(1 to 
10).toDS` is a `Dataset[Int]`, while `agg.toColumn` is a `TypedColumn[Long, 
Long]`. Thus the `select` call is dispatched to the untyped one. The following 
one works:
    
    ```
    scala> spark.range(10).as[Long].select(agg.toColumn).show()
    +---------------+
    |$anon$1(bigint)|
    +---------------+
    |             10|
    +---------------+
    ```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to