srielau commented on code in PR #56040:
URL: https://github.com/apache/spark/pull/56040#discussion_r3288246652
##########
docs/sql-ref-syntax-aux-describe-table.md:
##########
@@ -272,12 +276,88 @@ DESCRIBE customer salesdb.customer.name;
+---------+----------+
-- Returns the table metadata in JSON format.
+-- (Formatted for readability; the actual output is on a single line.)
DESC FORMATTED customer AS JSON;
-{"table_name":"customer","catalog_name":"spark_catalog","schema_name":"default","namespace":["default"],"columns":[{"name":"cust_id","type":{"name":"integer"},"nullable":true},{"name":"name","type":{"name":"string"},"comment":"Short
name","nullable":true},{"name":"state","type":{"name":"varchar","length":20},"nullable":true}],"location":
"file:/tmp/salesdb.db/custom...","created_time":"2020-04-07T14:05:43Z","last_access":"UNKNOWN","created_by":"None","type":"MANAGED","provider":"parquet","partition_provider":"Catalog","partition_columns":["state"]}
+{
+ "table_name": "customer",
+ "catalog_name": "spark_catalog",
+ "schema_name": "default",
+ "namespace": ["default"],
+ "columns": [
+ {"name": "cust_id", "type": {"name": "integer"}, "nullable": true},
+ {"name": "name", "type": {"name": "string"}, "comment": "Short name",
"nullable": true},
+ {"name": "state", "type": {"name": "varchar", "length": 20}, "nullable":
true}
+ ],
+ "location": "file:/tmp/salesdb.db/custom...",
+ "created_time": "2020-04-07T14:05:43Z",
+ "last_access": "UNKNOWN",
+ "created_by": "None",
+ "type": "MANAGED",
+ "provider": "parquet",
+ "partition_provider": "Catalog",
+ "partition_columns": ["state"]
+}
+
+-- DESCRIBE EXTENDED on a view emits view-specific rows.
+SET PATH = spark_catalog.default, system.builtin;
+CREATE VIEW recent_customers AS
+ SELECT cust_id, name FROM customer WHERE cust_id > 1000;
+
+DESCRIBE EXTENDED recent_customers;
++----------------------------+---------------------------------------+--------+
+| col_name| data_type| comment|
++----------------------------+---------------------------------------+--------+
+| cust_id| int| null|
+| name| string| null|
+| | | |
+|# Detailed Table Information| | |
+| Catalog | spark_catalog| |
+| Database| default| |
+| Table| recent_customers| |
+| Type| VIEW| |
+| View Text|SELECT cust_id, name FROM customer ... | |
+| View Original Text|SELECT cust_id, name FROM customer ... | |
+| View Schema Mode| COMPENSATION| |
+| View Catalog and Namespace| spark_catalog.default | |
+| View Query Output Columns| [`cust_id`, `name`] |
|
+| SQL Path| spark_catalog.default, system.builtin|
|
++----------------------------+---------------------------------------+--------+
+
+-- The same metadata in JSON form.
+-- (Formatted for readability; the actual output is on a single line.)
+DESCRIBE EXTENDED recent_customers AS JSON;
+{
+ "table_name": "recent_customers",
+ "catalog_name": "spark_catalog",
+ "schema_name": "default",
+ "namespace": ["default"],
+ "columns": [
+ {"name": "cust_id", "type": {"name": "int"}, "nullable": true},
Review Comment:
Fixed in d04ce7afb90 — aligned both to `int`. The page's own JSON-schema
table specifies `int` for `IntegerType`, so the legacy `integer` was the wrong
of the two.
##########
docs/sql-ref-name-resolution.md:
##########
@@ -420,4 +435,35 @@ If the function cannot be resolved Spark raises an
`UNRESOLVED_ROUTINE` error.
-- To resolve the persistent function it now needs qualification
> SELECT spark_catalog.default.func(4, 3);
6
+
+-- A built-in can always be reached by qualification, even when shadowed
+> CREATE TEMPORARY FUNCTION abs() RETURNS INT RETURN 999;
+> SELECT abs(-5);
Review Comment:
You're right — the original was a signature mismatch (`abs()` vs `abs(-5)`),
not shadowing. Rewrote in d04ce7afb90 with a matching `abs(x INT)` temp and an
explicit `SET PATH = system.session, system.builtin, spark_catalog.default` so
`abs(-5)` actually resolves to the temp (`-5 + 100 = 95`); the qualified
`system.builtin.abs(-5)` then meaningfully reaches around the shadow.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]