Difference between createOrReplaceTempView and registerTempTable

ⅰ亾dé卋堺 提交于 2019-12-18 12:24:17

问题


I am new to spark and was trying out a few commands in sparkSql using python when I came across these two commands:

createOrReplaceTempView() and registerTempTable().

What is the difference between the two commands?. They seem to have same set of functionalities.


回答1:


registerTempTable is a part of the 1.x API and has been deprecated in Spark 2.0.

createOrReplaceTempView and createTempView have been introduced in Spark 2.0, as a replacement for registerTempTable.

Other than that registerTempTable and createOrReplaceTempView functionally equivalent and the former one calls the latter one.




回答2:


No difference at all between createOrReplaceTempView and registerTempTable both performs the same functionality and if you open the below link and search for registerTempTable you can see that this function is deprecated in 2.0.

There is a note like below: Deprecated in 2.0 use createOrReplaceTempView instead.

https://spark.apache.org/docs/2.0.0/api/python/pyspark.sql.html




回答3:


Both the function between createOrReplaceTempView and registerTempTable are same and have same functionalities.

However registerTempTable is depricated from spark 2.0.0

Instead of registerTempTable, createOrReplaceTempView is used

@deprecated("Use createOrReplaceTempView(viewName) instead.", "2.0.0")
  def registerTempTable(tableName: String): Unit = {
    createOrReplaceTempView(tableName)
  }


来源:https://stackoverflow.com/questions/45145866/difference-between-createorreplacetempview-and-registertemptable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!