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

[cdc] Improve cdc schema change function to remove duplicate execution logic code. #5144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhuangchong
Copy link
Contributor

Purpose

UpdatedDataFieldsProcessFunction#latestDataFieldContain to exclude the latest fields in the schema,But in the parent class UpdatedDataFieldsProcessFunctionBase#extractSchemaChanges method, it has been determined whether the name, type, description attributes except id are equal.

if (oldField.type().copy(true).equalsIgnoreFieldId(newField.type().copy(true))) 

for (DataField newField : updatedDataFields) {
String newFieldName = StringUtils.toLowerCaseIfNeed(newField.name(), caseSensitive);
if (oldFields.containsKey(newFieldName)) {
DataField oldField = oldFields.get(newFieldName);
// 1. we compare by ignoring nullable, because partition keys and primary keys might
// be nullable in source database, but they can't be null in Paimon
// 2. we compare by ignoring field id, the field ID is newly created and may be
// different, we should ignore it
if (oldField.type().copy(true).equalsIgnoreFieldId(newField.type().copy(true))) {
// update column comment
if (newField.description() != null

Tests

API and Format

Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant