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


##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java:
##########
@@ -1335,6 +1335,43 @@ public void showViews() throws NoSuchTableException {
             row("global_temp", "globalviewforlisting", true), tempView);
   }
 
+  @Test
+  public void showViewsWithCurrentNamespace() {
+    String namespaceOne = "show_views_ns1";
+    String namespaceTwo = "show_views_ns2";
+    String viewOne = viewName("viewOne");
+    String viewTwo = viewName("viewTwo");
+    sql("CREATE NAMESPACE IF NOT EXISTS %s", namespaceOne);
+    sql("CREATE NAMESPACE IF NOT EXISTS %s", namespaceTwo);
+
+    // create one view in each namespace
+    sql("CREATE VIEW %s.%s AS SELECT * FROM %s.%s", namespaceOne, viewOne, 
NAMESPACE, tableName);
+    sql("CREATE VIEW %s.%s AS SELECT * FROM %s.%s", namespaceTwo, viewTwo, 
NAMESPACE, tableName);
+
+    Object[] v1 = row(namespaceOne, viewOne, false);
+    Object[] v2 = row(namespaceTwo, viewTwo, false);
+
+    assertThat(sql("SHOW VIEWS IN %s.%s", catalogName, namespaceOne))
+        .contains(v1)
+        .doesNotContain(v2);
+    sql("USE %s", namespaceOne);
+    assertThat(sql("SHOW VIEWS")).contains(v1).doesNotContain(v2);
+    assertThat(sql("SHOW VIEWS LIKE 
'viewOne*'")).contains(v1).doesNotContain(v2);
+
+    // independently of the currently set namespace, this will contain all 
views in the catalog
+    assertThat(sql("SHOW VIEWS IN %s", catalogName)).contains(v1, v2);

Review Comment:
   @nastra, I don't think that this is correct. These views should not be 
listed when listing a catalog because this should only return views in the root 
namespace and these are not.
   
   I think it's okay (though not great) to release with the `InMemoryCatalog` 
bug that lists all objects when the namespace is empty. But we definitely 
should not add tests that make it appear like that behavior is correct.



-- 
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