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

refactor(types): remove type_name and sub_fields from Field #20496

Merged
merged 4 commits into from
Feb 20, 2025

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Feb 14, 2025

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

This PR removes type_name and sub_fields from the Field struct.

These two fields are specific to Fields with struct (composite) types.

  • type_name only presents if the composite type is from external schema (like Avro definition) and is only used for debugging purposes (like DESCRIBE)

  • sub_fields is used for fields of composite types. Note that StructType already contains the information of field name and field type, so the only point of sub_fields is to provide type_name for fields of composite types.

  • These 2 fields are poorly maintained in our codebase, because there are multiple constructors and they are not enforced to be initialized.

So I believe deprecating them is a good choice. Ideally, we should embed type_name directly inside StructType (#19538), i.e., the tree structure for the data type, instead of having another tree structure (i.e., sub_fields).

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • My PR contains critical fixes that are necessary to be merged into the latest release.

Documentation

  • My PR needs documentation updates.
Release note

@xxchan
Copy link
Member

xxchan commented Feb 19, 2025

type_name only presents if the composite type is from external schema (like Avro definition) and is only used for debugging purposes (like DESCRIBE)

🤣🥵

#17128
#13104

@xxchan
Copy link
Member

xxchan commented Feb 19, 2025

BTW, what's the current behavior of DESCRIBE after the PR?

@BugenZhao
Copy link
Member Author

BTW, what's the current behavior of DESCRIBE after the PR?

See #20496:

field_descs will be generated on the fly based on the StructType when it's used in DESCRIBE. Resolve #17128.

Base automatically changed from bz/struct-part-1 to main February 20, 2025 07:36
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@BugenZhao BugenZhao enabled auto-merge February 20, 2025 07:47
@BugenZhao BugenZhao added this pull request to the merge queue Feb 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 20, 2025
@BugenZhao BugenZhao added this pull request to the merge queue Feb 20, 2025
Merged via the queue into main with commit 2dbf6fb Feb 20, 2025
29 checks passed
@BugenZhao BugenZhao deleted the bz/struct-part-2 branch February 20, 2025 09:42
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