Xudongshan123 opened a new issue, #23588:
URL: https://github.com/apache/doris/issues/23588

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   apache-doris-1.2.4.1
   
   ### What's Wrong?
   
    DorisOptions.Builder builder = DorisOptions.builder()
               .setFenodes("hadoop102:7030")
               .setTableIdentifier("test.table1")
               .setUsername("root")
               .setPassword("aaaaaa");
   
           DorisSource<List<?>> dorisSource = 
DorisSourceBuilder.<List<?>>builder()
               .setDorisOptions(builder.build())
               .setDorisReadOptions(DorisReadOptions.builder().build())
               .setDeserializer(new SimpleListDeserializationSchema())
               .build();
   
           env.fromSource(dorisSource, WatermarkStrategy.noWatermarks(), "doris 
source").print();
   
           DataStreamSource<String> source = env
               .fromElements(
                   "{\"siteid\": \"556\", \"citycode\": \"1001\", \"username\": 
\"ww\",\"pv\": \"100\"}");
           Properties props = new Properties();
           props.setProperty("format", "json");
           props.setProperty("read_json_by_line", "true"); // 每行一条 json 数据
   
           DorisSink<String> sink = DorisSink.<String>builder()
               // .setDorisReadOptions(DorisReadOptions.builder().build())
               .setDorisOptions(DorisOptions.builder() // 设置 doris 的连接参数
                   .setFenodes("hadoop102:7030")
                   .setTableIdentifier("test.table1")
                   .setUsername("root")
                   .setPassword("aaaaaa")
                   .build())
               .setDorisExecutionOptions(DorisExecutionOptions.builder() // 执行参数
                   //.setLabelPrefix("doris-label")  // stream-load 导入的时候的 
label 前缀
                   .disable2PC() // 开启两阶段提交后,labelPrefix 需要全局唯一,为了测试方便禁用两阶段提交
                   .setDeletable(false)
                   .setBufferCount(3) // 批次条数: 默认 3
                   .setBufferSize(8*1024) // 批次大小: 默认 1M
                   .setCheckInterval(3000) // 批次输出间隔   三个对批次的限制是或的关系
                   .setMaxRetries(3)
                   .setStreamLoadProp(props) // 设置 stream load 的数据格式 默认是 
csv,根据需要改成 json
                   .build())
               .setSerializer(new SimpleStringSerializer())
               .build();
           source.sinkTo(sink);
   
     //These codes above have areas for improvement
   
   ### What You Expected?
   
   It is recommended that the Dorisdource object be designed as a standard 
builder pattern, just like DorisSink, and that DorisSourceBuilder be designed 
as a static inner class as well. This would have two advantages: 1. it would be 
easier for the user to use, and 2. the standardization of the code would be the 
same as that designed for DorisSink 
   
   ### How to Reproduce?
   
   It is recommended that DorisSource be written in the same standard builder 
pattern as sink.
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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.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

Reply via email to