Github user clockfly commented on a diff in the pull request: https://github.com/apache/spark/pull/12945#discussion_r62617764 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala --- @@ -2306,8 +2306,37 @@ class Dataset[T] private[sql]( * @group basic * @since 1.6.0 */ + @deprecated("Use createTempView(tableName, replaceIfExists = true) instead.", "2.0.0") def registerTempTable(tableName: String): Unit = { - sparkSession.registerTable(toDF(), tableName) + createTempView(tableName, replaceIfExists = true) + } + + /** + * Creates a temporary view using the given name. The lifetime of this + * temporary view is tied to the [[SQLContext]] that was used to create this Dataset. + * + * @throws AnalysisException if the view name already exists + * + * @group basic + * @since 2.0.0 + */ + @throws[AnalysisException] + def createTempView(viewName: String): Unit = { + createTempView(viewName, replaceIfExists = false) + } + + /** + * Creates a temporary view using the given name. The lifetime of this + * temporary view is tied to the [[SQLContext]] that was used to create this Dataset. + * + * @throws AnalysisException if replaceIfExists flag is false and the view name already exists. + * + * @group basic + * @since 2.0.0 + */ + @throws[AnalysisException] + def createTempView(viewName: String, replaceIfExists: Boolean): Unit = { --- End diff -- @rxin, there is a little difference between these two. createTempView(viewName, replace=false) will throw exception when view name already exists. createOrReplaceTempView will **NOT** throw exception when view name exists.
--- 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