Support column comments#43
Open
BenoitRanque wants to merge 10 commits intomainfrom
Open
Conversation
introduce MaybeClickHouseDataType to catch serialization errors and report useful error messages support comments in configuration files
caf9e7a to
ba2b781
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for column comments
This required a change in configuration files, because we used to store column defintions as a
Map<Name, DataType>We add a new enum so we can store both data type and optional comment. This a not a breaking change because we still support parsing the older, shorthand format.
When introspecting, we still generate the shorthand format if the comment is empty.
Additionally, we derive deserialize and serialize for
ClickHouseDataType, so we can include it directly in configuration file types.However this introduces a problem: when unable to parse a datatype, the serde json error is very unhelpful.
The issue is that if serde is unable to parse the
ClickHouseDataType, it reports it was unable to match any of the untagged variants. So the error is very unhelpful to users.The solution is the
MaybeClickHouseDataTypeenum:The
Invalidvariant is the result of being unable to parse the datatype. We can then handle this gracefully and tell the user exactly what the problem is, and where.