xiaokangguo commented on a change in pull request #6892:
URL: https://github.com/apache/incubator-doris/pull/6892#discussion_r733564650



##########
File path: 
extension/flink-doris-connector/src/main/java/org/apache/doris/flink/table/DorisDynamicOutputFormat.java
##########
@@ -136,30 +140,37 @@ private void checkFlushException() {
     }
 
     @Override
-    public synchronized void writeRecord(RowData row) throws IOException {
+    public synchronized void writeRecord(T row) throws IOException {
         checkFlushException();
-
         addBatch(row);
         if (executionOptions.getBatchSize() > 0 && batch.size() >= 
executionOptions.getBatchSize()) {
             flush();
         }
     }
 
-    private void addBatch(RowData row) {
-        Map<String, String> valueMap = new HashMap<>();
-        StringJoiner value = new StringJoiner(this.fieldDelimiter);
-        for (int i = 0; i < row.getArity() && i < fieldGetters.length; ++i) {
-            Object field = fieldGetters[i].getFieldOrNull(row);
-            if (jsonFormat) {
-                String data = field != null ? field.toString() : null;
-                valueMap.put(this.fieldNames[i], data);
-            } else {
-                String data = field != null ? field.toString() : NULL_VALUE;
-                value.add(data);
+    // 添加json字符串 本地测试
+    private void addBatch(T row) {
+        if (row instanceof RowData) {
+            RowData rowData = (RowData) row;
+            Map<String, String> valueMap = new HashMap<>();
+            StringJoiner value = new StringJoiner(this.fieldDelimiter);
+            for (int i = 0; i < rowData.getArity() && i < fieldGetters.length; 
++i) {
+                Object field = fieldGetters[i].getFieldOrNull(rowData);
+                if (jsonFormat) {
+                    String data = field != null ? field.toString() : null;
+                    valueMap.put(this.fieldNames[i], data);
+                } else {
+                    String data = field != null ? field.toString() : 
NULL_VALUE;
+                    value.add(data);
+                }
             }
+            Object data = jsonFormat ? valueMap : value.toString();
+            batch.add(data);
+
+        }
+        if (row instanceof String) {
+            batch.add(row);

Review comment:
       I would like to throw some notes to tell RowData or String only,is it 
good for that ?




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

Reply via email to