forked from apache/doris-flink-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wudi
committed
Nov 21, 2023
1 parent
5449864
commit 16d37f6
Showing
16 changed files
with
94 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...-connector/src/main/java/org/apache/doris/flink/sink/writer/RecordWithMetaSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.apache.doris.flink.sink.writer; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.doris.flink.sink.batch.RecordWithMeta; | ||
import org.apache.flink.api.java.tuple.Tuple2; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
public class RecordWithMetaSerializer implements DorisRecordSerializer<RecordWithMeta>{ | ||
private static final Logger LOG = LoggerFactory.getLogger(RecordWithMetaSerializer.class); | ||
|
||
@Override | ||
public Tuple2<String, byte[]> serialize(RecordWithMeta record) throws IOException { | ||
if(StringUtils.isBlank(record.getTable()) | ||
|| StringUtils.isBlank(record.getDatabase()) | ||
|| record.getRecord() == null){ | ||
LOG.warn("Record or meta format is incorrect, ignore record db:{}, table:{}, row:{}", | ||
record.getDatabase(), record.getTable(), record.getRecord()); | ||
return null; | ||
} | ||
String tableKey = record.getDatabase() + "." + record.getTable(); | ||
return Tuple2.of(tableKey, record.getRecord().getBytes(StandardCharsets.UTF_8)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.