File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
flinkx-connectors/flinkx-connector-redis/src/main/java/com/dtstack/flinkx/connector/redis/converter Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 2828import com .dtstack .flinkx .element .column .SqlDateColumn ;
2929import com .dtstack .flinkx .element .column .StringColumn ;
3030import com .dtstack .flinkx .element .column .TimestampColumn ;
31+ import com .dtstack .flinkx .util .JsonUtil ;
3132
3233import org .apache .flink .table .data .RowData ;
3334import org .apache .flink .table .types .logical .LogicalType ;
3839
3940import java .text .SimpleDateFormat ;
4041import java .util .ArrayList ;
42+ import java .util .HashMap ;
4143import java .util .List ;
44+ import java .util .Map ;
45+ import java .util .Objects ;
4246
4347import static com .dtstack .flinkx .connector .redis .options .RedisOptions .REDIS_CRITICAL_TIME ;
4448import static com .dtstack .flinkx .connector .redis .options .RedisOptions .REDIS_KEY_VALUE_SIZE ;
@@ -168,7 +172,17 @@ private String[] getValues(ColumnRowData row) {
168172 }
169173
170174 private String concatValues (ColumnRowData row ) {
171- return StringUtils .join (getValues (row ), redisConf .getValueFieldDelimiter ());
175+ List <FieldConf > columns = redisConf .getColumn ();
176+ Map <String , Object > fieldMap = new HashMap <>();
177+ int index = 0 ;
178+
179+ for (FieldConf fieldConf : columns ) {
180+ if (Objects .nonNull (row .getField (index ))) {
181+ fieldMap .put (fieldConf .getName (), row .getField (index ).getData ());
182+ }
183+ index ++;
184+ }
185+ return JsonUtil .toJson (fieldMap );
172186 }
173187
174188 private String concatKey (ColumnRowData row ) {
You can’t perform that action at this time.
0 commit comments