This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 383a5b7324 [doc][spark] Update view doc (#6411)
383a5b7324 is described below

commit 383a5b732407a9fb4fba3dc324056548078f97ad
Author: Zouxxyy <[email protected]>
AuthorDate: Thu Oct 16 19:18:37 2025 +0800

    [doc][spark] Update view doc (#6411)
---
 docs/content/spark/sql-ddl.md                       |  6 +++---
 .../paimon/spark/sql/PaimonViewTestBase.scala       | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/docs/content/spark/sql-ddl.md b/docs/content/spark/sql-ddl.md
index 0019d8de18..654c391e71 100644
--- a/docs/content/spark/sql-ddl.md
+++ b/docs/content/spark/sql-ddl.md
@@ -288,7 +288,7 @@ CREATE TABLE my_table_all_as PARTITIONED BY (dt) 
TBLPROPERTIES ('primary-key' =
 ## View
 
 Views are based on the result-set of an SQL query, when using 
`org.apache.paimon.spark.SparkCatalog`, views are managed by paimon itself. 
-And in this case, views are supported when the `metastore` type is `hive`, and 
temporary views are not supported yet.
+And in this case, views are supported when the `metastore` type is `hive` or 
`rest`.
 
 ### Create Or Replace View
 
@@ -296,10 +296,10 @@ CREATE VIEW constructs a virtual table that has no 
physical data.
 
 ```sql
 -- create a view.
-CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE [TEMPORARY] VIEW v1 AS SELECT * FROM t1;
 
 -- create a view, if a view of same name already exists, it will be replaced.
-CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
+CREATE OR REPLACE [TEMPORARY] VIEW v1 AS SELECT * FROM t1;
 ```
 
 ### Drop View
diff --git 
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PaimonViewTestBase.scala
 
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PaimonViewTestBase.scala
index 00f5566ed4..6d59d96cf4 100644
--- 
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PaimonViewTestBase.scala
+++ 
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PaimonViewTestBase.scala
@@ -155,4 +155,25 @@ abstract class PaimonViewTestBase extends 
PaimonHiveTestBase {
       }
     }
   }
+
+  test("Paimon View: create temp view") {
+    sql(s"USE $paimonHiveCatalogName")
+    withDatabase("test_db") {
+      sql("CREATE DATABASE test_db")
+      sql("USE test_db")
+      withTable("t") {
+        withTempView("v1") {
+          sql("CREATE TABLE t (id INT) USING paimon")
+          sql("INSERT INTO t VALUES (1), (2)")
+
+          sql("CREATE TEMPORARY VIEW v1 AS SELECT * FROM t")
+          checkAnswer(sql("SELECT * FROM v1"), Seq(Row(1), Row(2)))
+          checkAnswer(sql("SELECT * FROM v1 WHERE id >= (SELECT max(id) FROM 
v1)"), Seq(Row(2)))
+
+          sql("CREATE OR REPLACE TEMPORARY VIEW v1 AS SELECT * FROM t WHERE id 
< 2")
+          checkAnswer(sql("SELECT * FROM v1"), Seq(Row(1)))
+        }
+      }
+    }
+  }
 }

Reply via email to