Skip to content

[common][python] Support SUBSTRING and TRIM in column masking - #9212

Open
plusplusjiajia wants to merge 2 commits into
apache:masterfrom
plusplusjiajia:core-transform-substring-trim-json-serde
Open

[common][python] Support SUBSTRING and TRIM in column masking#9212
plusplusjiajia wants to merge 2 commits into
apache:masterfrom
plusplusjiajia:core-transform-substring-trim-json-serde

Conversation

@plusplusjiajia

Copy link
Copy Markdown
Member

Purpose

SubstringTransform and TrimTransform are not listed in Transform's @JsonSubTypes, so Jackson writes the class simple name as the type id and reading it back fails with InvalidTypeIdException. Both are therefore unusable for column masking, where a rule is stored as JSON and replayed later — the only usable masks today are NULL and CONCAT of a constant, so keeping the last four characters of a value cannot be expressed.

Registering them needs three more things:

  • SubstringTransform had no Jackson annotations, so its inputs were dropped. It gets a @JsonCreator and a deserializer extending StringTransform's with a number branch, since its positions may be integers.
  • TrimTransform's trimFlag was not serialized, and name() returns TRIM for all three flags, so LTRIM/RTRIM would silently degrade into TRIM. It becomes its own property, and part of equals/hashCode.
  • pypaimon executes the same rules and raised Unknown transform type for both. It gains them, following the Java semantics rather than the nearest Arrow kernel — a one-input TRIM trims spaces only, and its character argument is a set.

@plusplusjiajia
plusplusjiajia force-pushed the core-transform-substring-trim-json-serde branch 4 times, most recently from 614bd53 to ee0ec60 Compare August 13, 2026 17:49
@plusplusjiajia
plusplusjiajia force-pushed the core-transform-substring-trim-json-serde branch from ee0ec60 to 8d2fc91 Compare August 20, 2026 14:31
@plusplusjiajia
plusplusjiajia force-pushed the core-transform-substring-trim-json-serde branch from 8d2fc91 to 9f4a53e Compare August 20, 2026 16:03
@plusplusjiajia
plusplusjiajia marked this pull request as ready for review August 20, 2026 16:04
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