jackye1995 commented on a change in pull request #3482:
URL: https://github.com/apache/iceberg/pull/3482#discussion_r744154647



##########
File path: site/docs/spark-queries.md
##########
@@ -243,6 +264,89 @@ Note:
 2. `contains_nan` could return null, which indicates that this information is 
not available from files' metadata. 
    This usually occurs when reading from V1 table, where `contains_nan` is not 
populated. 
 
+### All Manifests
+
+To show a table's valid file manifests and each file's metadata, run:
+> tip: a valid manifest file is one that is referenced from any snapshot 
currently tracked by the table.
+
+```sql
+SELECT * FROM prod.db.table.all_manifests
+```
+
+```text
++------------------------------------------+------+-----------------+-------------------+----------------------+-------------------------+------------------------+------------------------------------------------------------+
+|                                      path|length|partition_spec_id|  
added_snapshot_id|added_data_files_count|existing_data_files_count|deleted_data_files_count|
                                         partition_summaries|
++------------------------------------------+------+-----------------+-------------------+----------------------+-------------------------+------------------------+------------------------------------------------------------+
+|s3:/.../table/data/dt=20210102/xxx.parquet|  6376|                
0|6272782676904868561|                     2|                        0|         
              0|[{false, false, 10, 11}, {false, false, 20210101, 20210101}]|
++------------------------------------------+------+-----------------+-------------------+----------------------+-------------------------+------------------------+------------------------------------------------------------+
+```
+
+Note:
+1. Fields within `partition_summaries` column of the manifests table 
correspond to `field_summary` structs within [manifest 
list](./spec.md#manifest-lists), with the following order:
+    - `contains_null`
+    - `contains_nan`
+    - `lower_bound`
+    - `upper_bound`
+2. `contains_nan` could return null, which indicates that this information is 
not available from files' metadata.
+   This usually occurs when reading from V1 table, where `contains_nan` is not 
populated.
+
+### Partitions
+
+To show a table's current partitions
+
+```sql
+SELECT * FROM prod.db.table.partitions
+```
+
+```text
++----------------+------------+----------+
+|       partition|record_count|file_count|
++----------------+------------+----------+
+|  {20211001, 11}|           1|         1|
+|  {20211002, 11}|           1|         1|
+|  {20211001, 10}|           1|         1|
+|  {20211002, 10}|           1|         1|
++----------------+------------+----------+
+```
+
+### Entries
+
+To show a table's current manifest entries as rows, for both delete and data 
files, run:
+> tip: this table exposes internal details, like files that have been deleted.
+
+```sql
+SELECT * FROM prod.db.table.entries
+```
+
+```text
++------+-------------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|status|snapshot_id        |sequence_number|data_file                          
                                                                                
                                                                                
                                                                                
                                                                                
                               |
++------+-------------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|0     |7462238160765527919|0              |{0, 
s3://.../dt=20211001/age=10/00000-0-38e4b886-b445-40a9-8db0-58653a331aba-00001.parquet,
 PARQUET, {20211001, 10}, 1, 1132, {1 -> 47, 2 -> 52, 3 -> 47, 4 -> 55}, {1 -> 
1, 2 -> 1, 3 -> 1, 4 -> 1}, {1 -> 0, 2 -> 0, 3 -> 0, 4 -> 0}, {}, {1 -> 

Reply via email to