Skip to content

Delta SQL

Delta Lake registers custom SQL statements (using DeltaSparkSessionExtension to inject DeltaSqlParser with DeltaSqlAstBuilder).

The SQL statements support table of the format delta.`path` (with backticks), e.g. delta.`/tmp/delta/t1` while path is between single quotes, e.g. '/tmp/delta/t1'.

The SQL statements can also refer to a table registered in a metastore.

Note

SQL grammar is described using ANTLR in DeltaSqlBase.g4.

CONVERT TO DELTA

CONVERT TO DELTA table
  (PARTITIONED BY '(' colTypeList ')')?

Runs a ConvertToDeltaCommand

DESCRIBE DETAIL

(DESC | DESCRIBE) DETAIL (path | table)

Runs a DescribeDeltaDetailCommand

DESCRIBE HISTORY

(DESC | DESCRIBE) HISTORY (path | table)
  (LIMIT limit)?

Runs a DescribeDeltaHistoryCommand

GENERATE

GENERATE modeName FOR TABLE table

Runs a DeltaGenerateCommand

VACUUM

VACUUM (path | table)
  (RETAIN number HOURS)? (DRY RUN)?

Runs a VacuumTableCommand


Last update: 2020-10-05