I am new to spark and going through the data frame operations.
As per given in documentation of Apache Spark registerTempTable and createTempView looks similar a lot.
Can anyone tell what exactly is the difference between the registerTempTable and createTempView?
Thanks
The registerTempTable method has been deprecated in spark 2.0.0+ and it internally calls createOrReplaceTempView. Dataset object-
private[sql] object Dataset {
/**
* Registers this Dataset as a temporary table using the given name. The lifetime of this
* temporary table is tied to the [[SparkSession]] that was used to create this Dataset.
*
* @group basic
* @since 1.6.0
*/
@deprecated("Use createOrReplaceTempView(viewName) instead.", "2.0.0")
def registerTempTable(tableName: String): Unit = {
createOrReplaceTempView(tableName)
}
............
}
Below is the description of the both.
def createTempView(viewName: String): Unit
Creates a local temporary view using the given name. The lifetime of this
temporary view is tied to the SparkSession that was used to create this Dataset
def registerTempTable(tableName: String): Unit
Registers this Dataset as a temporary table using the given name. The
lifetime of this temporary table is tied to the SparkSession that was used to create this Dataset.

From the image you can see registerTempTable is deprecated in Spark 2.0. Means registerTempTable was the feature prior to Spark 2.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With