mchades commented on code in PR #14637:
URL: https://github.com/apache/gravitino/pull/14637#discussion_r4488183883


##########
clients/client-python/tests/unittests/test_relational_catalog.py:
##########
@@ -565,6 +710,72 @@ def test_alter_view_not_exists(self):
                     ViewChange.rename("new_view"),
                 )
 
+    def test_alter_view_set_property(self):
+        ident = NameIdentifier.of(self.schema_name, "view1")
+        updated = self._new_view_dto(
+            "view1",
+            "comment",
+            self._default_columns(),
+            self._default_representations(),
+            properties={"k1": "v1"},
+        )
+        req = ViewUpdateRequest.SetViewPropertyRequest(_property="k1", 
_value="v1")
+        self._run_alter_view(ident, req, updated, 
ViewChange.set_property("k1", "v1"))
+
+    def test_alter_view_remove_property(self):
+        ident = NameIdentifier.of(self.schema_name, "view1")
+        updated = self._new_view_dto(
+            "view1",
+            "comment",
+            self._default_columns(),
+            self._default_representations(),
+        )
+        req = ViewUpdateRequest.RemoveViewPropertyRequest(_property="k1")
+        self._run_alter_view(ident, req, updated, 
ViewChange.remove_property("k1"))
+
+    def test_alter_view_replace(self):
+        ident = NameIdentifier.of(self.schema_name, "view1")
+        new_rep = SQLRepresentationDTO(
+            _dialect=Dialects.TRINO,
+            _sql="SELECT 3",
+        )
+        new_columns = self._default_columns()
+        new_reps = [new_rep]
+        updated = self._new_view_dto(
+            "view1",
+            "new comment",
+            new_columns,
+            new_reps,
+        )

Review Comment:
   Minor, non-blocking: this replacement sends `None` for `default_catalog` and 
`default_schema`, which clears both defaults, but `_new_view_dto()` returns 
`test_catalog`/`test_schema`. Set both defaults to `None` in this fixture and 
assert them on the returned view so the test covers the cleared-defaults case.



##########
docs/manage-view-metadata-using-gravitino.md:
##########
@@ -72,6 +72,36 @@ View view = views.createView(
     ImmutableMap.of());
 ```
 
+</TabItem>
+<TabItem value="python" label="Python">
+
+```python
+catalog = client.load_catalog("sales")
+views = catalog.as_view_catalog()
+
+columns = [
+    Column.of("id", Types.IntegerType.get(), nullable=False),
+    Column.of("name", Types.VarCharType.of(500)),
+]
+
+representations = [
+    SQLRepresentation(
+        Dialects.SPARK,
+        "SELECT * FROM customers WHERE last_order_at > current_date - interval 
365 day",
+    )
+]
+
+view = views.create_view(
+    NameIdentifier.of("public", "active_customers"),
+    columns=columns,
+    representations=representations,
+    comment="Customers with orders in the last year",
+    default_catalog="sales",
+    default_schema="public",
+    properties={},

Review Comment:
   The linked catalog-setup guide creates `sales` as a Hive catalog. With 
`Dialects.SPARK`, `HiveViewCatalogOperations.validateSQLRepresentation()` 
rejects this empty property map because it requires `spark.sql.create.version`. 
Please add that property with the appropriate Spark version so this example 
succeeds. The existing Java example has the same issue.



##########
docs/manage-view-metadata-using-gravitino.md:
##########
@@ -72,6 +72,36 @@ View view = views.createView(
     ImmutableMap.of());
 ```
 
+</TabItem>
+<TabItem value="python" label="Python">
+
+```python
+catalog = client.load_catalog("sales")

Review Comment:
   Minor, non-blocking: please add the Python imports and `GravitinoClient` 
initialization, or link directly to the setup example. `client`, `Column`, 
`Types`, `SQLRepresentation`, `Dialects`, and `NameIdentifier` are otherwise 
undefined when starting from this guide; the later snippets also need 
`ViewChange` and `Namespace`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to