rdblue commented on code in PR #9787:
URL: https://github.com/apache/iceberg/pull/9787#discussion_r1501179380


##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java:
##########
@@ -1325,22 +1324,35 @@ public void showViews() throws NoSuchTableException {
 
   @Test
   public void showViewsWithoutNamespace() {
-    sql("CREATE VIEW view_without_ns AS SELECT * from %s", tableName);
-    assertThatThrownBy(() -> sql("SHOW VIEWS"))
-        .isInstanceOf(NoSuchNamespaceException.class)
-        .hasMessageContaining("Namespace does not exist");
-
-    assertThatThrownBy(() -> sql("SHOW VIEWS IN %s", catalogName))
-        .isInstanceOf(NoSuchNamespaceException.class)
-        .hasMessageContaining("Namespace does not exist");
-
-    assertThatThrownBy(() -> sql("SHOW VIEWS LIKE 'pref*'"))
-        .isInstanceOf(NoSuchNamespaceException.class)
-        .hasMessageContaining("Namespace does not exist");
-
-    assertThatThrownBy(() -> sql("SHOW VIEWS LIKE 'non-existing'"))
-        .isInstanceOf(NoSuchNamespaceException.class)
-        .hasMessageContaining("Namespace does not exist");
+    String sql = String.format("SELECT * from %s", tableName);
+    sql("CREATE VIEW view_without_ns AS %s", sql);
+    sql("CREATE VIEW prefixView2 AS %s", sql);
+    sql("CREATE VIEW prefixView3 AS %s", sql);
+    sql("CREATE TEMPORARY VIEW tempViewWithoutNsForListing AS %s", sql);
+
+    // spark stores temp views case-insensitive by default
+    Object[] tempView = row("", "tempviewwithoutnsforlisting", true);
+
+    assertThat(sql("SHOW VIEWS"))
+        .contains(
+            row(NAMESPACE.toString(), "prefixView2", false),
+            row(NAMESPACE.toString(), "prefixView3", false),
+            row(NAMESPACE.toString(), "view_without_ns", false),
+            tempView);
+
+    assertThat(sql("SHOW VIEWS IN %s", catalogName))
+        .contains(
+            row(NAMESPACE.toString(), "prefixView2", false),
+            row(NAMESPACE.toString(), "prefixView3", false),
+            row(NAMESPACE.toString(), "view_without_ns", false),
+            tempView);
+
+    assertThat(sql("SHOW VIEWS LIKE 'pref*'"))
+        .contains(
+            row(NAMESPACE.toString(), "prefixView2", false),
+            row(NAMESPACE.toString(), "prefixView3", false));
+
+    assertThat(sql("SHOW VIEWS LIKE 'non-existing'")).isEmpty();

Review Comment:
   Where are the tests that use the current namespace?
   
   I think the views should be created through the API, then we need tests of 
different current namespace states. Not setting the current namespace is a red 
flag for these tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to