github-actions[bot] commented on code in PR #45639:
URL: https://github.com/apache/doris/pull/45639#discussion_r1891296876
##########
be/src/http/action/stream_load.cpp:
##########
@@ -443,6 +444,37 @@ Status StreamLoadAction::_process_put(HttpRequest*
http_req,
request.__set_file_size(ctx->body_bytes);
ctx->body_sink = file_sink;
}
+
+ if (config::enable_stream_load_mysql) {
+ std::string table_name = ctx->table;
+ std::string columns, where_clause, column_separator = ",", format =
"csv";
+ std::vector<std::string> sql_parts;
+
+ if (!http_req->header(HTTP_COLUMNS).empty()) {
+ columns = http_req->header(HTTP_COLUMNS);
+ sql_parts.emplace_back("SELECT " + columns);
+ } else {
+ sql_parts.emplace_back("SELECT *");
+ }
+
+ sql_parts.emplace_back("FROM http_stream(\"format\" = \"" + format +
Review Comment:
warning: escaped string literal can be written as a raw string literal
[modernize-raw-string-literal]
```suggestion
sql_parts.emplace_back(R"(FROM http_stream("format" = ")" + format +
```
##########
be/src/http/action/stream_load.cpp:
##########
@@ -443,6 +444,37 @@
request.__set_file_size(ctx->body_bytes);
ctx->body_sink = file_sink;
}
+
+ if (config::enable_stream_load_mysql) {
+ std::string table_name = ctx->table;
+ std::string columns, where_clause, column_separator = ",", format =
"csv";
+ std::vector<std::string> sql_parts;
+
+ if (!http_req->header(HTTP_COLUMNS).empty()) {
+ columns = http_req->header(HTTP_COLUMNS);
+ sql_parts.emplace_back("SELECT " + columns);
+ } else {
+ sql_parts.emplace_back("SELECT *");
+ }
+
+ sql_parts.emplace_back("FROM http_stream(\"format\" = \"" + format +
+ "\", \"column_separator\" = \"" +
column_separator + "\")");
+
+ if (!http_req->header(HTTP_WHERE).empty()) {
+ where_clause = "WHERE " + http_req->header(HTTP_WHERE);
+ }
+
+ std::string full_sql = "INSERT INTO " + table_name + " ";
+ for (size_t i = 0; i < sql_parts.size(); i++) {
+ full_sql += sql_parts[i];
+ if (i != sql_parts.size() - 1) full_sql += ", ";
Review Comment:
warning: statement should be inside braces
[readability-braces-around-statements]
```suggestion
if (i != sql_parts.size() - 1) { full_sql += ", ";
}
```
##########
be/src/http/action/stream_load.cpp:
##########
@@ -443,6 +444,37 @@
request.__set_file_size(ctx->body_bytes);
ctx->body_sink = file_sink;
}
+
+ if (config::enable_stream_load_mysql) {
+ std::string table_name = ctx->table;
+ std::string columns, where_clause, column_separator = ",", format =
"csv";
+ std::vector<std::string> sql_parts;
+
+ if (!http_req->header(HTTP_COLUMNS).empty()) {
+ columns = http_req->header(HTTP_COLUMNS);
+ sql_parts.emplace_back("SELECT " + columns);
+ } else {
+ sql_parts.emplace_back("SELECT *");
+ }
+
+ sql_parts.emplace_back("FROM http_stream(\"format\" = \"" + format +
+ "\", \"column_separator\" = \"" +
column_separator + "\")");
Review Comment:
warning: escaped string literal can be written as a raw string literal
[modernize-raw-string-literal]
```suggestion
R"(", "column_separator" = ")" +
column_separator + "\")");
```
--
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]