Skip to content

Conversation

@yzeng1618
Copy link
Contributor

Purpose of this pull request

Fix FieldRename so replacements_with_regex works as regex by default when is_regex is omitted. Previously is_regex=null was treated as “not regex”, so regex patterns (e.g. lookarounds used for camelCase→snake_case) never applied, leading to unexpected no-op renames and downstream schema/key mismatches (reported in #10317).

Does this PR introduce any user-facing change?

Yes.

  • Before: if replacements_with_regex items omit is_regex, the rule is treated as a literal full-match, so regex patterns don’t take effect.

  • After: is_regex defaults to true, so omitted is_regex will apply regex matching.

  • To keep the old literal behavior, users can explicitly set is_regex = false.

How was this patch tested?

  • Added unit tests in FieldRenameTransformTest.java.
  • Added an e2e regression job config field_rename_regex_default.conf and executed via TestRenameIT.

Check list

@@ -13,7 +13,8 @@ FieldRename 用于批量重命名字段名。
| convert_case | string | 否 | | 字母大小写转换类型,可选 `UPPER`、`LOWER` |
| prefix | string | 否 | | 追加到字段名前的前缀 |
| suffix | string | 否 | | 追加到字段名后的后缀 |
| replacements_with_regex | array | 否 | | 正则替换规则数组,元素为包含 `replace_from`、`replace_to` 的映射,用于批量替换字段名 |
| replacements_with_regex | array | 否 | | 替换规则数组,元素为包含 `replace_from`、`replace_to` 以及可选 `is_regex`(默认 `true`)的映射;当 `is_regex=false` 时,`replace_from` 按字段名精确匹配(全匹配) |
| specific | array | 否 | | 指定字段重命名规则,元素为包含 `field_name` 和 `target_name` 的映射;命中后会直接重命名并跳过其他规则 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this specific missing from the previous document ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this parameter is not included in the document, but it actually exists in the code, so we might as well add it here as well.

@yzeng1618 yzeng1618 requested a review from corgy-w January 14, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants