Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/src/main/sphinx/connector/delta-lake.md
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,51 @@ The output of the query has the following history columns:
- Whether or not the operation appended data
:::

(delta-lake-partitions-table)=

##### `$partitions` table

The `$partitions` table provides a detailed overview of the partitions of the
Delta Lake table.

You can retrieve the information about the partitions of the Delta Lake table
`test_table` by using the following query:

```
SELECT * FROM "test_table$partitions"
```

```text
partition | file_count | total_size | data |
-------------------------------+------------+------------+----------------------------------------------+
{_bigint=1, _date=2021-01-12} | 2 | 884 | {_decimal={min=1.0, max=2.0, null_count=0}} |
{_bigint=1, _date=2021-01-13} | 1 | 442 | {_decimal={min=1.0, max=1.0, null_count=0}} |
```

The output of the query has the following columns:

:::{list-table} Partitions columns
:widths: 20, 30, 50
:header-rows: 1

* - Name
- Type
- Description
* - `partition`
- `ROW(...)`
- A row that contains the mapping of the partition column names to the
partition column values.
* - `file_count`
- `BIGINT`
- The number of files mapped in the partition.
* - `total_size`
- `BIGINT`
- The size of all the files in the partition.
* - `data`
- `ROW(... ROW (min ..., max ... , null_count BIGINT))`
- Partition range and null counts.
:::

##### `$properties` table

The `$properties` table provides access to Delta Lake table configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3690,10 +3690,10 @@ private static boolean isFileCreatedByQuery(Location file, String queryId)
@Override
public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTableName tableName)
{
return getRawSystemTable(tableName).map(systemTable -> new ClassLoaderSafeSystemTable(systemTable, getClass().getClassLoader()));
return getRawSystemTable(session, tableName).map(systemTable -> new ClassLoaderSafeSystemTable(systemTable, getClass().getClassLoader()));
}

private Optional<SystemTable> getRawSystemTable(SchemaTableName systemTableName)
private Optional<SystemTable> getRawSystemTable(ConnectorSession session, SchemaTableName systemTableName)
{
Optional<DeltaLakeTableType> tableType = DeltaLakeTableName.tableTypeFrom(systemTableName.getTableName());
if (tableType.isEmpty() || tableType.get() == DeltaLakeTableType.DATA) {
Expand Down Expand Up @@ -3723,6 +3723,7 @@ private Optional<SystemTable> getRawSystemTable(SchemaTableName systemTableName)
transactionLogAccess,
typeManager));
case PROPERTIES -> Optional.of(new DeltaLakePropertiesTable(systemTableName, tableLocation, transactionLogAccess));
case PARTITIONS -> Optional.of(new DeltaLakePartitionsTable(session, systemTableName, tableLocation, transactionLogAccess, typeManager));
};
}

Expand Down
Loading