CONVERT TO DELTA
Function
This command converts an existing Parquet table to a Delta table in-place. This command lists all the files in the directory, creates a Delta Lake transaction log to track these files, and automatically infers the data schema by reading the footer of all Parquet files. The conversion process collects statistics to improve the query performance of the resulting Delta table. If a table name is provided, the metastore will also be updated to reflect that the table is now a Delta table.
Precautions
To convert partitioned tables, set spark.sql.forcePartitionPredicatesOnPartitionedTable.enabled to false.
Syntax
CONVERT TO DELTA [database_name.]table_name [NO STATISTICS]
Parameter Description
Parameter |
Description |
---|---|
database_name |
Name of the database, consisting of letters, numbers, and underscores (_) |
table_name |
Name of the table in the database, consisting of letters, numbers, and underscores (_) |
NO STATISTICS |
The collection of statistics is bypassed during the conversion process to achieve faster conversion. |
Required Permissions
- SQL permissions
Permission Description |
---|
CREATE_TABLE permission on the database where the table is |
ALTER permission on a table |
INSERT_INTO_TABLE permission on a table |
DROP_TABLE permission on a table |
- Fine-grained permissions: dli:database:createTable, dli:table:alter, dli:table:insertIntoTable, and dli:table:dropTable
- Metadata services provided by LakeFormation. Refer to the LakeFormation documentation for details on permission configuration.
Example
create table if not exists parquet_table0 (id int,name string,price double) using parquet location 'obs://bucket_name0/db0/parquet_table0'; convert to delta parquet_table0;
System Response
Displays successful execution.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot