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

fix(frontend): check data type in column id generator #19828

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Dec 17, 2024

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

What's changed and what's your intention?

When generating column ID for existing columns (by name), also check and reject if the data type changes. Otherwise, the persisted data will be incompatible and lead to undefined behavior.

Note that for struct types, the nested fields are encoded with value-encoding (instead of column-aware encoding) under current implementation. As a result, adding new nested fields cannot be supported and should be rejected as well. Close #19736.

This won't be hit for a regular table as we don't provide syntax support for altering the data type for an existing column. However, schema registries may consider this as a compatible change so it can be hit by ALTER TABLE REFRESH SCHEMA.

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

@BugenZhao BugenZhao force-pushed the bz/col-id-gen-aware-of-type branch from 46ded5b to b0bc757 Compare December 18, 2024 08:01
Copy link
Contributor

@xiangjinwu xiangjinwu left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +2030 to +2033
&Field::with_name(
StructType::new([("f1", DataType::Int32)]).into(),
"nested",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Yet another example of why Field::sub_fields (and ColumnDesc::field_descs) shall be consolidated into StructType. Currently Field::with_name on struct produces incomplete results - and there is a special Field::with_struct.

No need to fix the usage in this PR as the incomplete results are NEVER used except describe #17128

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

Successfully merging this pull request may close these issues.

bug: panic when adding new field in schema registry proto definition
2 participants