Skip to content

Conversation

@sadikovi
Copy link
Contributor

What changes were proposed in this pull request?

This PR enhances stable ids functionality in Avro by allowing users to configure a custom prefix for Union type member fields when enableStableIdentifiersForUnionType is enabled.

Without the patch, the fields are generated with member_ prefix, e.g. member_int, member_string. This could become difficult to change for complex schemas.

The solution is to add a new option stableIdentifierPrefixForUnionType which defaults to member_ and allows users to configure whatever prefix they require, e.g. member, tmp_, or even an empty string.

Why are the changes needed?

Allows to customise the prefix of stable ids in Avro without the need to rename all of the columns which could be cumbersome for complex schemas.

Does this PR introduce any user-facing change?

Yes. The PR adds a new option in Avro: stableIdentifierPrefixForUnionType.

How was this patch tested?

Existing tests + a new unit test to verify different prefixes.

Was this patch authored or co-authored using generative AI tooling?

No.

@sadikovi
Copy link
Contributor Author

sadikovi commented Jan 31, 2024

cc @dongjoon-hyun @HyukjinKwon @siying @cloud-fan
I decided to drop config value validation given that users should be able to configure an empty string as a prefix.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, the proposal looks safe and reasonable to me. Pending CIs.

Thank you for this improvement, @sadikovi .

@dongjoon-hyun
Copy link
Member

Merged to master. Thank you, @sadikovi and @cloud-fan .

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.

3 participants