Introduction to Common SQL Statements
- To run Hudi-related SQL statements on the MRS background client, you must source the component_env of Hudi.
- When executing Hudi-related SQL statements on DataArts Studio, if the API connection is used, --conf spark.support.hudi=true must be added to the job running parameter.
| Function | SQL Syntax | Notes |
|---|---|---|
| Update write |
| It is used to integrate and process Hudi tables and update SinkTable data based on the primary key. |
| Overwrite |
|
|
| Overwrite |
|
|
| bulk_insert write | For details, see Common Parameters and Application Scenarios. | This method applies only to the first migration of Hudi tables. |
| Update write |
| It is usually used to quickly correct a small batch of data in Hudi and is not suitable for integrated processing. |
| merge into Syntax |
| Not recommended. |
| Deleting row-level data |
| The DELETE operation writes data. The larger the amount of data to be deleted, the slower the DELETE operation. This operation is applicable to deleting a small amount of data. |
| Querying the Hudi table structure | desc formatted SinkTable | Query all information about the Hudi table. This method is recommended. |
| Querying the Hudi table structure | show create table SinkTable | Query all information about the Hudi table. This method is not recommended because the readability is poor. |
| Deleting a partition |
| |
| Deleting a table |
|
|
| Viewing the compaction plan of the Hudi table | show compaction on SinkTable | Check the value of action in the second column of the returned result. If the value is commit, the plan has been executed. If the value is compaction, the plan has not been executed. |
| Changing the schema |
| |
| Performing a compaction | run compaction on SinkTable | You cannot run a single command. For details, see Selecting a Proper Table Service Execution Mode and Common Parameters and Application Scenarios. |
| Performing the clean operation | run clean on SinkTable | You cannot run a single command. For details, see Selecting a Proper Table Service Execution Mode and Common Parameters and Application Scenarios. |
| Performing the archive operation | run archivelog on SinkTable | You cannot run a single command. For details, see Selecting a Proper Table Service Execution Mode and Common Parameters and Application Scenarios. |
What is your overall rating for this page?
Thank 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