nastra commented on code in PR #11751:
URL: https://github.com/apache/iceberg/pull/11751#discussion_r1886968667


##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java:
##########
@@ -1414,7 +1414,42 @@ public void describeExtendedView() {
                 String.format(
                     "['format-version' = '1', 'location' = '%s', 'provider' = 
'iceberg']",
                     location),
-                ""));
+                ""),
+            row("View Text", sql, ""));
+  }
+
+  @TestTemplate
+  public void describeExtendedViewWithoutCurrentNamespace() {

Review Comment:
   Sorry, I actually confused myself and that's exactly the part I had to 
double-check. So you're right about how the current namespace is being used.
   Can you please update the tests to this?
   
   ```
   +
   +  @TestTemplate
   +  public void createAndDescribeViewInDefaultNamespace() {
   +    String viewName = viewName("createViewInDefaultNamespace");
   +    String sql = String.format("SELECT id, data FROM %s WHERE id <= 3", 
tableName);
   +
   +    sql("CREATE VIEW %s (id, data) AS %s", viewName, sql);
   +    TableIdentifier identifier = TableIdentifier.of(NAMESPACE, viewName);
   +    View view = viewCatalog().loadView(identifier);
   +    assertThat(view.currentVersion().defaultCatalog()).isNull();
   +    assertThat(view.name()).isEqualTo(ViewUtil.fullViewName(catalogName, 
identifier));
   +    
assertThat(view.currentVersion().defaultNamespace()).isEqualTo(NAMESPACE);
   +
   +    String location = viewCatalog().loadView(identifier).location();
   +    assertThat(sql("DESCRIBE EXTENDED %s.%s", NAMESPACE, viewName))
   +        .contains(
   +            row("id", "int", ""),
   +            row("data", "string", ""),
   +            row("", "", ""),
   +            row("# Detailed View Information", "", ""),
   +            row("Comment", "", ""),
   +            row("View Catalog and Namespace", String.format("%s.%s", 
catalogName, NAMESPACE), ""),
   +            row("View Query Output Columns", "[id, data]", ""),
   +            row(
   +                "View Properties",
   +                String.format(
   +                    "['format-version' = '1', 'location' = '%s', 'provider' 
= 'iceberg']",
   +                    location),
   +                ""));
   +  }
   +
   +  @TestTemplate
   +  public void createAndDescribeViewWithoutCurrentNamespace() {
   +    String viewName = viewName("createViewWithoutCurrentNamespace");
   +    Namespace namespace = Namespace.of("test_namespace");
   +    String sql = String.format("SELECT id, data FROM %s WHERE id <= 3", 
tableName);
   +
   +    sql("CREATE NAMESPACE IF NOT EXISTS %s", namespace);
   +    sql("CREATE VIEW %s.%s (id, data) AS %s", namespace, viewName, sql);
   +    TableIdentifier identifier = TableIdentifier.of(namespace, viewName);
   +    View view = viewCatalog().loadView(identifier);
   +    assertThat(view.currentVersion().defaultCatalog()).isNull();
   +    assertThat(view.name()).isEqualTo(ViewUtil.fullViewName(catalogName, 
identifier));
   +    
assertThat(view.currentVersion().defaultNamespace()).isEqualTo(NAMESPACE);
   +
   +    String location = viewCatalog().loadView(identifier).location();
   +    assertThat(sql("DESCRIBE EXTENDED %s.%s", namespace, viewName))
   +        .contains(
   +            row("id", "int", ""),
   +            row("data", "string", ""),
   +            row("", "", ""),
   +            row("# Detailed View Information", "", ""),
   +            row("Comment", "", ""),
   +            row("View Catalog and Namespace", String.format("%s.%s", 
catalogName, namespace), ""),
   +            row("View Query Output Columns", "[id, data]", ""),
   +            row(
   +                "View Properties",
   +                String.format(
   +                    "['format-version' = '1', 'location' = '%s', 'provider' 
= 'iceberg']",
   +                    location),
   +                ""));
   +  }
   ```



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