CONVERT TO DELTA parquet.`path/to/table` [NO STATISTICS] [PARTITIONED BY (col_name1 col_type1, col_name2 col_type2, ...)]
Convert an existing Parquet table to a Delta table in-place. This command lists all the files in the directory, creates a Databricks Delta transaction log that tracks these files, and automatically infers the data schema by reading the footers of all Parquet files. The conversion process collects statistics to improve query performance on the converted Delta table.
- Bypass statistics collection during the conversion process and finish conversion faster. After the table is converted to Delta, you can use
OPTIMIZE … ZORDER BYto reorganize the data layout and generate statistics.
- Partition the created table by the specified columns. Required if the data is partitioned. The conversion process aborts and throw an exception if the directory structure does not conform to the
PARTITIONED BYspecification. If you do not provide the
PARTITIONED BYclause, the command assumes that the table is not partitioned.
Any file not tracked by Delta is invisible and can be deleted when you run
VACUUM. You should avoid updating or appending data files during the conversion process. After the table is converted, make sure all writes go through Delta.