You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/10/23 01:42:36 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #34359: [SPARK-36986][SQL] Improving external schema management flexibility on DataSet and StructType

HyukjinKwon commented on a change in pull request #34359:
URL: https://github.com/apache/spark/pull/34359#discussion_r734908797



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
##########
@@ -511,6 +511,20 @@ class SparkSession private(
     createDataset(data.asScala.toSeq)
   }
 
+  /**
+   * Creates a [[Dataset]] from an RDD of spark.sql.catalyst.InternalRow. This method allows
+   * the caller to create externally the InternalRow set, as we as define the schema externally.
+   *
+   * @since 3.3.0
+   */
+  def createDataset(data: RDD[InternalRow], schema: StructType): DataFrame = {

Review comment:
       My concern is that `InternalRow` is not supposed to be exposed to end users.
   
   Maybe we should expose `Dataset.ofRows` as a developer API, and do it like:
   
   ```scala
   Dataset.ofRows(
     spark,
     org.apache.spark.sql.execution.LogicalRDD(
       df.queryExecution.executedPlan.output, df.queryExecution.toRdd)(spark))
   ```




-- 
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