SaintBacchus commented on code in PR #16483: URL: https://github.com/apache/doris/pull/16483#discussion_r1102437099
########## docs/zh-CN/docs/data-operate/import/import-way/mysql-load-manual.md: ########## @@ -0,0 +1,119 @@ +--- +{ + "title": "MySql load", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<version since="dev"></version> + +# MySql load + +MySql load 是SQL交互的导入方式,用户通过SQL命令将客户端本地或者服务端本地的数据导入Doris 中。 + +MySql load 同步执行导入并返回导入结果。用户可直接通过SQL返回信息判断本次导入是否成功。 + +MySql load 主要适用于导入客户端本地文件,或通过程序导入数据流中的数据。 + +## 基本原理 + +MySql Load和Stream Load功能相似, 都是导入本地文件到Doris集群中, 因此MySQL Load实现复用了StreamLoad的基础导入能力: + +1. FE接收到客户端执行的MySQL Load请求, 完成SQL解析工作 + +2. FE将Load请求拆解,并封装为StreamLoad的请求. + +3. FE选择一个BE节点发送StreamLoad请求 + +4. 发送请求的同时, FE会异步且流式的从MySQL客户端读取本地文件数据, 并实时的发送到StreamLoad的HTTP请求中. + +5. MySQL客户端数据传输完毕, FE等待StreamLoad完成, 并展示导入成功或者失败的信息给客户端. + + +## 支持数据格式 + +MySQL Load 支持数据格式:CSV(文本)。 + +## 基本操作举例 + +### 创建测试表 +```sql +CREATE TABLE testdb.t1 (pk INT, v1 INT SUM) AGGREGATE KEY (pk) DISTRIBUTED BY hash (pk) PROPERTIES ('replication_num' = '1'); +``` + +### 导入客户端文件 +假设在客户端本地当前路径上有一个CSV文件, 名为`client_local.csv`, 使用MySQL LOAD语法讲表导入到测试表`testdb.t1`中. Review Comment: OK -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org