नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
Creates or replaces a local temporary view with this DataFrame.
Syntax
createOrReplaceTempView(name: str)
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str | Name of the view. |
Notes
The lifetime of this temporary table is tied to the SparkSession that was used to create this DataFrame.
Examples
df = spark.createDataFrame([(2, "Alice"), (5, "Bob")], schema=["age", "name"])
df.createOrReplaceTempView("people")
df2 = df.filter(df.age > 3)
df2.createOrReplaceTempView("people")
df3 = spark.sql("SELECT * FROM people")
assert sorted(df3.collect()) == sorted(df2.collect())
spark.catalog.dropTempView("people")
# True