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
1 change: 1 addition & 0 deletions docs/src/main/sphinx/connector/delta-lake.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ TABLE AS </sql/create-table-as>` syntax.

The connector supports the following [](/sql/alter-table) statements.

(delta-lake-alter-table-execute)=
#### ALTER TABLE EXECUTE

The connector supports the following commands for use with {ref}`ALTER TABLE
Expand Down
10 changes: 10 additions & 0 deletions docs/src/main/sphinx/connector/optimize.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ to filter which partitions are optimized:
ALTER TABLE test_partitioned_table EXECUTE optimize
WHERE partition_key = 1
```

You can use a more complex `WHERE` clause to narrow down the scope of the
`optimize` procedure. The following example casts the timestamp values to
dates, and uses a comparison to only optimize partitions with data from the year
2022 or newer:

```
ALTER TABLE test_table EXECUTE optimize
WHERE CAST(timestamp_tz AS DATE) > DATE '2021-12-31'
```
13 changes: 6 additions & 7 deletions docs/src/main/sphinx/sql/alter-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ parameters. `ALTER TABLE EXECUTE` supports different commands on a
per-connector basis.

You can use the `=>` operator for passing named parameter values.
The left side is the name of the parameter, the right side is the value being passed:
The left side is the name of the parameter, the right side is the value being passed.

Collapse files in a table that are over 10 megabytes in size with the `optimize`
procedure from the [Hive](hive-alter-table-execute), [Delta
Lake](delta-lake-alter-table-execute) , and
[Iceberg](iceberg-alter-table-execute) connectors:

```
ALTER TABLE hive.schema.test_table EXECUTE optimize(file_size_threshold => '10MB')
Expand Down Expand Up @@ -144,12 +149,6 @@ Set table property `x` to its default value in table\`\`people\`\`:
ALTER TABLE people SET PROPERTIES x = DEFAULT;
```

Collapse files in a table that are over 10 megabytes in size, as supported by
the Hive connector:

```
ALTER TABLE hive.schema.test_table EXECUTE optimize(file_size_threshold => '10MB')
```

## See also

Expand Down