Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持自定义StarRocksGenericRowTransformer 清洗数据 #325

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public void setRuntimeContext(RuntimeContext ctx) {}
public Object[] transform(T record, boolean supportUpsertDelete) {
Object[] rowData = new Object[fieldNames.length + (supportUpsertDelete ? 1 : 0)];
consumer.accept(rowData, record);
if (rowData == null) {
return null;
}
if (supportUpsertDelete && (record instanceof RowData)) {
// set `__op` column
rowData[rowData.length - 1] = StarRocksSinkOP.parse(((RowData)record).getRowKind()).ordinal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ public synchronized void invoke(T value, Context context) throws Exception {
return;
}
}
String serializedValue = serializer.serialize(rowTransformer.transform(value, sinkOptions.supportUpsertDelete()));
Object[] rowData = rowTransformer.transform(value, sinkOptions.supportUpsertDelete());
if (rowData == null) {
return;
}
String serializedValue = serializer.serialize(rowData);
sinkManager.writeRecords(
sinkOptions.getDatabaseName(),
sinkOptions.getTableName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ public void invoke(T value, Context context) throws Exception {
}
}
flushLegacyData();
String serializedValue = serializer.serialize(rowTransformer.transform(value, sinkOptions.supportUpsertDelete()));
Object[] rowData = rowTransformer.transform(value, sinkOptions.supportUpsertDelete());
if (rowData == null) {
return;
}
String serializedValue = serializer.serialize(rowData);
sinkManager.write(
null,
sinkOptions.getDatabaseName(),
Expand Down