maropu commented on a change in pull request #28151: [SPARK-31383][SQL][DOC]
Clean up the SQL documents in docs/sql-ref*
URL: https://github.com/apache/spark/pull/28151#discussion_r405893130
##########
File path: docs/sql-ref-syntax-aux-analyze-table.md
##########
@@ -69,41 +70,69 @@ ANALYZE TABLE table_identifier [ partition_spec ]
</dl>
### Examples
-{% highlight sql %}
- ANALYZE TABLE students COMPUTE STATISTICS NOSCAN;
-
- DESC EXTENDED students;
- ......
- Statistics 2820 bytes
- ......
-
- ANALYZE TABLE students COMPUTE STATISTICS;
-
- DESC EXTENDED students;
- ......
- Statistics 2820 bytes, 3 rows
- ......
-
- ANALYZE TABLE students PARTITION (student_id = 111111) COMPUTE STATISTICS;
-
- DESC EXTENDED students PARTITION (student_id = 111111);
- ......
- Partition Statistics 919 bytes, 1 rows
- ......
-
- ANALYZE TABLE students COMPUTE STATISTICS FOR COLUMNS name;
-
- DESC EXTENDED students name;
- =default tbl=students
- col_name name
- data_type string
- comment NULL
- min NULL
- max NULL
- num_nulls 0
- distinct_count 3
- avg_col_len 11
- max_col_len 13
- histogram NULL
+{% highlight sql %}
+CREATE TABLE students (name STRING, student_id INT) PARTITIONED BY
(student_id);
+INSERT INTO students PARTITION (student_id = 111111) VALUES ('Mark');
+INSERT INTO students PARTITION (student_id = 222222) VALUES ('John');
+
+ANALYZE TABLE students COMPUTE STATISTICS NOSCAN;
+
+DESC EXTENDED students;
+ +--------------------+--------------------+-------+
+ | col_name| data_type|comment|
+ +--------------------+--------------------+-------+
+ | name| string| null|
+ | student_id| int| null|
Review comment:
I'm not faimilar with that though, the output format looks
implementation-specific. For example, PostgreSQL uses an empty cell for null by
default. Anyway, I like the simple document rule like `Query output in Examples
should follow the Dataset.showString (right-aligned) format`. Since we can
easily replace it later, I leave it as it is in this PR. If necessary, please
do follow-up later.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]