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

Implement LC of Nullable #182

Merged
merged 5 commits into from
May 24, 2022

Conversation

arthurpassos
Copy link
Contributor

Context

LC of nullable is not implemented. LC of nullable requires a null item at the first position of the collection, moving the default item to the second position. Since there is a null item at the beginning and all null items point to it, there is no need for a null map. Hence, the null map is not serialized.

The null map currently maintained by the Nullable column becomes invalid when it's inside a LC column. Because of that, the nulls.size() == nested.size() assertions were removed.

The above was implemented by adding branching logic in multiple places inside LC column, which is complicated/ messy and error prone. This could be avoided by having a proper inheritance chain or using the pimpl idiom. The former was not implemented because we want to minimize the changes to the public API. The latter was not implemented because we have more important things on the roadmap and will be considered again in the near future.

Changes

  1. Remove nulls.size() == nested.size() assertions inside ColumnNullable.
  2. Prevent null map from being serialized/deserialized when it's inside LC columns.

Testing

Added unit tests and ran against a local instance.

Closes #76

@Enmk Enmk merged commit b4f016b into ClickHouse:master May 24, 2022
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.

Exception on inserting LowCardinality(Nullable(String))
2 participants