freemandealer commented on code in PR #22509:
URL: https://github.com/apache/doris/pull/22509#discussion_r1283110858
##########
docs/zh-CN/docs/data-operate/import/import-way/stream-load-manual.md:
##########
@@ -242,6 +242,31 @@ Stream Load 由于使用的是 HTTP 协议,所以所有导入任务有关的
}
```
+### 使用SQL表达Stream Load的参数
+
+可以在Header中添加一个`sql`的参数,去替代之前参数中的`column_separator`、`line_delimiter`、`where`、`columns`参数,方便使用。
+
+```
+curl --location-trusted -u user:passwd [-H "sql: ${load_sql}"...] -T data.file
-XPUT http://fe_host:http_port/api/{db}/{table}/_stream_load_with_sql
+
+
+# -- load_sql
+# insert into db.table (col, ...) select stream_col, ... from
stream("property1"="value1");
+
+# stream
+# (
+# "column_separator" = ",",
+# "format" = "CSV",
+# ...
+# )
+```
+
+示例:
+
+```
+curl --location-trusted -u root: -T test.csv -H "sql:insert into
demo.example_tbl_1(user_id, age, cost) select c1, c4, c7 * 2 from
stream("format" = "CSV", "column_separator" = "," ) where age >= 30"
http://127.0.0.1:28030/api/demo/example_tbl_1/_stream_load_with_sql
+```
Review Comment:
是不是再加一个直接请求 be 的 example? since they have different URI pattern.
##########
docs/zh-CN/docs/data-operate/import/import-way/stream-load-manual.md:
##########
@@ -242,6 +242,31 @@ Stream Load 由于使用的是 HTTP 协议,所以所有导入任务有关的
}
```
+### 使用SQL表达Stream Load的参数
+
+可以在Header中添加一个`sql`的参数,去替代之前参数中的`column_separator`、`line_delimiter`、`where`、`columns`参数,方便使用。
+
+```
+curl --location-trusted -u user:passwd [-H "sql: ${load_sql}"...] -T data.file
-XPUT http://fe_host:http_port/api/{db}/{table}/_stream_load_with_sql
+
+
+# -- load_sql
+# insert into db.table (col, ...) select stream_col, ... from
stream("property1"="value1");
+
+# stream
+# (
+# "column_separator" = ",",
+# "format" = "CSV",
+# ...
+# )
+```
+
+示例:
+
+```
+curl --location-trusted -u root: -T test.csv -H "sql:insert into
demo.example_tbl_1(user_id, age, cost) select c1, c4, c7 * 2 from
stream("format" = "CSV", "column_separator" = "," ) where age >= 30"
http://127.0.0.1:28030/api/demo/example_tbl_1/_stream_load_with_sql
Review Comment:
转义是怎么处理的?
##########
be/src/vec/exec/format/csv/csv_reader.cpp:
##########
@@ -651,8 +651,7 @@ Status CsvReader::_prepare_parse(size_t* read_line, bool*
is_parse_name) {
return Status::InvalidArgument(
"start offset of TFileRangeDesc must be zero in get parsered
schema");
}
- if (_params.file_type == TFileType::FILE_STREAM ||
- _params.file_type == TFileType::FILE_BROKER) {
+ if (_params.file_type == TFileType::FILE_BROKER) {
return Status::InternalError(
"Getting parsered schema from csv file do not support stream
load and broker "
Review Comment:
Now that we support stream load, we should also update the err msg.
##########
docs/zh-CN/docs/data-operate/import/import-way/stream-load-manual.md:
##########
@@ -242,6 +242,31 @@ Stream Load 由于使用的是 HTTP 协议,所以所有导入任务有关的
}
```
+### 使用SQL表达Stream Load的参数
+
+可以在Header中添加一个`sql`的参数,去替代之前参数中的`column_separator`、`line_delimiter`、`where`、`columns`参数,方便使用。
+
+```
+curl --location-trusted -u user:passwd [-H "sql: ${load_sql}"...] -T data.file
-XPUT http://fe_host:http_port/api/{db}/{table}/_stream_load_with_sql
+
+
+# -- load_sql
+# insert into db.table (col, ...) select stream_col, ... from
stream("property1"="value1");
+
+# stream
+# (
+# "column_separator" = ",",
+# "format" = "CSV",
+# ...
+# )
+```
+
+示例:
+
+```
+curl --location-trusted -u root: -T test.csv -H "sql:insert into
demo.example_tbl_1(user_id, age, cost) select c1, c4, c7 * 2 from
stream("format" = "CSV", "column_separator" = "," ) where age >= 30"
http://127.0.0.1:28030/api/demo/example_tbl_1/_stream_load_with_sql
Review Comment:
转义是怎么处理的?
##########
docs/zh-CN/docs/data-operate/import/import-way/stream-load-manual.md:
##########
@@ -242,6 +242,31 @@ Stream Load 由于使用的是 HTTP 协议,所以所有导入任务有关的
}
```
+### 使用SQL表达Stream Load的参数
+
+可以在Header中添加一个`sql`的参数,去替代之前参数中的`column_separator`、`line_delimiter`、`where`、`columns`参数,方便使用。
+
+```
+curl --location-trusted -u user:passwd [-H "sql: ${load_sql}"...] -T data.file
-XPUT http://fe_host:http_port/api/{db}/{table}/_stream_load_with_sql
+
+
+# -- load_sql
+# insert into db.table (col, ...) select stream_col, ... from
stream("property1"="value1");
+
+# stream
+# (
+# "column_separator" = ",",
+# "format" = "CSV",
+# ...
+# )
+```
+
+示例:
+
+```
+curl --location-trusted -u root: -T test.csv -H "sql:insert into
demo.example_tbl_1(user_id, age, cost) select c1, c4, c7 * 2 from
stream("format" = "CSV", "column_separator" = "," ) where age >= 30"
http://127.0.0.1:28030/api/demo/example_tbl_1/_stream_load_with_sql
+```
Review Comment:
是不是再加一个直接请求 be 的 example? since they have different URI pattern.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]