spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahmoudmahdi24 <...@git.apache.org>
Subject [GitHub] spark pull request #21944: [SPARK-24988][SQL]Add a castBySchema method which...
Date Thu, 02 Aug 2018 14:34:41 GMT
Github user mahmoudmahdi24 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21944#discussion_r207250060
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
    @@ -1367,6 +1367,22 @@ class Dataset[T] private[sql](
         }: _*)
       }
     
    +  /**
    +   * Casts all the values of the current Dataset following the types of a specific StructType.
    +   * This method works also with nested structTypes.
    +   *
    +   *  @group typedrel
    +   *  @since 2.4.0
    +   */
    +  def castBySchema(schema: StructType): DataFrame = {
    +    assert(schema.fields.map(_.name).toList.sameElements(this.schema.fields.map(_.name).toList),
    +      "schema should have the same fields as the original schema")
    +
    +    selectExpr(schema.map(
    --- End diff --
    
    Ok I understand, Thanks


---

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


Mime
View raw message