I am trying to understand the difference between createOrReplaceGlobalTempView and createOrReplaceTempView.
createOrReplaceTempView is introduced in version 2.0 and createOrReplaceGlobalTempView is introduced in 2.2.
As per the documentation,
for createOrReplaceGlobalTempView : the lifetime of this temporary view is tied to this Spark application.
For createOrReplaceGlobalTempView : The lifetime of this temporary table is tied to the SparkSession that was used to create this DataFrame.
Could you please elaborate the difference on Spark Application and SparkSession.
Regards,
Neeraj
Standard temporary tables live in the user space, similarly to Hive
The data in these tables is stored in the user's scratch directory rather than in the Hive warehouse directory. The scratch directory effectively acts as the user' data sandbox.
and are limited to a single user session.
Global temporary views, are different, in the way that can be accessed by multiple sessions, so there are intermediate between normal view (it can be accessed globally, it is registered in global temporary database) and temporary view (its scope is limited to a single session).
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