doris icon indicating copy to clipboard operation
doris copied to clipboard

[Bug] 使用 stream load 方式 导入内存中的json数据,group_commit=async_mode 没有生效

Open xumingxiang opened this issue 2 years ago • 1 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Version

2.1.0

What's Wrong?

使用 stream load 方式 导入内存中的json数据,设置group_commit=async_mode 没有生效,返回的结果中没有包含groupCommit字段,label字段值也没有以“group_commit”为前缀, 代码如下,烦请指正:

private static async Task StreamLoadDataAsync(string loadUrl ,string tableName, List<LogEntity> logs)
       {
           using var content = new StringContent(JsonSerializer.Serialize(logs));
           using var httpReq = new HttpRequestMessage(HttpMethod.Put, loadUrl);
           httpReq.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", DORIS_LOAD_AUTH);
           httpReq.Headers.Add("format", "json");
           httpReq.Headers.Add("strip_outer_array", "true");
           httpReq.Headers.Add("fuzzy_parse", "true");
           httpReq.Headers.Add("jsonpaths", jsonpaths);
           httpReq.Headers.Add("Keep-Alive", "true");
           httpReq.Headers.Add("group_commit", "async_mode");
           httpReq.Headers.Add("two_phase_commit", "false");
           httpReq.Headers.Add("memtable_on_sink_node", "true");
           httpReq.Headers.Add("partitions", $"{startPartition},{endPartition}");
           httpReq.Headers.ExpectContinue = true;
           httpReq.Content = content;

           IHttpClientFactory httpClientFactory = ServiceLocator.Instance.GetRequiredService<IHttpClientFactory>();
           var httpClient = httpClientFactory.CreateClient("DorisHttpClient");
           httpClient.Timeout = TimeSpan.FromSeconds(30);//30s超时
           var httpResp = await httpClient.SendAsync(httpReq);
           string respContent = await httpResp.Content.ReadAsStringAsync();
           if (httpResp.IsSuccessStatusCode)
           {
                   Console.WriteLine(respContent);
           }
       }

What You Expected?

返回结果中包含“groupCommit”字段

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

xumingxiang avatar Mar 09 '24 13:03 xumingxiang

我找到原因了,是导入数据的时候指定了分区,文档中没有写,翻看be源代码才发现的

xumingxiang avatar Mar 10 '24 15:03 xumingxiang