-
Notifications
You must be signed in to change notification settings - Fork 76
feat: Add UpdateSchema interface skeleton #460
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
Open
gty404
wants to merge
2
commits into
apache:main
Choose a base branch
from
gty404:update-schema
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+658
−0
Conversation
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
- Define `UpdateSchema` class interface with full API documentation
wgtmac
reviewed
Dec 31, 2025
wgtmac
reviewed
Dec 31, 2025
wgtmac
requested changes
Dec 31, 2025
Comment on lines
+115
to
+155
| /// \brief Add a new required top-level column. | ||
| /// | ||
| /// Adding a required column without a default is an incompatible change that can | ||
| /// break reading older data. To suppress exceptions thrown when an incompatible | ||
| /// change is detected, call AllowIncompatibleChanges(). | ||
| /// | ||
| /// Because "." may be interpreted as a column path separator or may be used in | ||
| /// field names, it is not allowed in names passed to this method. To add to nested | ||
| /// structures or to add fields with names that contain ".", use | ||
| /// AddRequiredColumn(parent, name, type). | ||
| /// | ||
| /// If type is a nested type, its field IDs are reassigned when added to the | ||
| /// existing schema. | ||
| /// | ||
| /// \param name Name for the new column. | ||
| /// \param type Type for the new column. | ||
| /// \return Reference to this for method chaining. | ||
| /// \note InvalidArgument will be reported if name contains ".". | ||
| UpdateSchema& AddRequiredColumn(std::string_view name, std::shared_ptr<Type> type); | ||
|
|
||
| /// \brief Add a new required top-level column with documentation. | ||
| /// | ||
| /// Adding a required column without a default is an incompatible change that can | ||
| /// break reading older data. To suppress exceptions thrown when an incompatible | ||
| /// change is detected, call AllowIncompatibleChanges(). | ||
| /// | ||
| /// Because "." may be interpreted as a column path separator or may be used in | ||
| /// field names, it is not allowed in names passed to this method. To add to nested | ||
| /// structures or to add fields with names that contain ".", use | ||
| /// AddRequiredColumn(parent, name, type, doc). | ||
| /// | ||
| /// If type is a nested type, its field IDs are reassigned when added to the | ||
| /// existing schema. | ||
| /// | ||
| /// \param name Name for the new column. | ||
| /// \param type Type for the new column. | ||
| /// \param doc Documentation string for the new column. | ||
| /// \return Reference to this for method chaining. | ||
| /// \note InvalidArgument will be reported if name contains ".". | ||
| UpdateSchema& AddRequiredColumn(std::string_view name, std::shared_ptr<Type> type, | ||
| std::string_view doc); |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
| /// \brief Add a new required top-level column. | |
| /// | |
| /// Adding a required column without a default is an incompatible change that can | |
| /// break reading older data. To suppress exceptions thrown when an incompatible | |
| /// change is detected, call AllowIncompatibleChanges(). | |
| /// | |
| /// Because "." may be interpreted as a column path separator or may be used in | |
| /// field names, it is not allowed in names passed to this method. To add to nested | |
| /// structures or to add fields with names that contain ".", use | |
| /// AddRequiredColumn(parent, name, type). | |
| /// | |
| /// If type is a nested type, its field IDs are reassigned when added to the | |
| /// existing schema. | |
| /// | |
| /// \param name Name for the new column. | |
| /// \param type Type for the new column. | |
| /// \return Reference to this for method chaining. | |
| /// \note InvalidArgument will be reported if name contains ".". | |
| UpdateSchema& AddRequiredColumn(std::string_view name, std::shared_ptr<Type> type); | |
| /// \brief Add a new required top-level column with documentation. | |
| /// | |
| /// Adding a required column without a default is an incompatible change that can | |
| /// break reading older data. To suppress exceptions thrown when an incompatible | |
| /// change is detected, call AllowIncompatibleChanges(). | |
| /// | |
| /// Because "." may be interpreted as a column path separator or may be used in | |
| /// field names, it is not allowed in names passed to this method. To add to nested | |
| /// structures or to add fields with names that contain ".", use | |
| /// AddRequiredColumn(parent, name, type, doc). | |
| /// | |
| /// If type is a nested type, its field IDs are reassigned when added to the | |
| /// existing schema. | |
| /// | |
| /// \param name Name for the new column. | |
| /// \param type Type for the new column. | |
| /// \param doc Documentation string for the new column. | |
| /// \return Reference to this for method chaining. | |
| /// \note InvalidArgument will be reported if name contains ".". | |
| UpdateSchema& AddRequiredColumn(std::string_view name, std::shared_ptr<Type> type, | |
| std::string_view doc); | |
| /// \brief Add a new required top-level column with documentation. | |
| /// | |
| /// Adding a required column without a default is an incompatible change that can | |
| /// break reading older data. To suppress exceptions thrown when an incompatible | |
| /// change is detected, call AllowIncompatibleChanges(). | |
| /// | |
| /// Because "." may be interpreted as a column path separator or may be used in | |
| /// field names, it is not allowed in names passed to this method. To add to nested | |
| /// structures or to add fields with names that contain ".", use | |
| /// AddRequiredColumn(parent, name, type, doc). | |
| /// | |
| /// If type is a nested type, its field IDs are reassigned when added to the | |
| /// existing schema. | |
| /// | |
| /// \param name Name for the new column. | |
| /// \param type Type for the new column. | |
| /// \param doc Documentation string for the new column. | |
| /// \return Reference to this for method chaining. | |
| /// \note InvalidArgument will be reported if name contains ".". | |
| UpdateSchema& AddRequiredColumn(std::string_view name, std::shared_ptr<Type> type, | |
| std::string_view doc = ""); |
Comment on lines
+157
to
+209
| /// \brief Add a new required column to a nested struct. | ||
| /// | ||
| /// Adding a required column without a default is an incompatible change that can | ||
| /// break reading older data. To suppress exceptions thrown when an incompatible | ||
| /// change is detected, call AllowIncompatibleChanges(). | ||
| /// | ||
| /// The parent name is used to find the parent using Schema::FindFieldByName(). If | ||
| /// the parent name is null or empty, the new column will be added to the root as a | ||
| /// top-level column. If parent identifies a struct, a new column is added to that | ||
| /// struct. If it identifies a list, the column is added to the list element struct, | ||
| /// and if it identifies a map, the new column is added to the map's value struct. | ||
| /// | ||
| /// The given name is used to name the new column and names containing "." are not | ||
| /// handled differently. | ||
| /// | ||
| /// If type is a nested type, its field IDs are reassigned when added to the | ||
| /// existing schema. | ||
| /// | ||
| /// \param parent Name of the parent struct to which the column will be added. | ||
| /// \param name Name for the new column. | ||
| /// \param type Type for the new column. | ||
| /// \return Reference to this for method chaining. | ||
| /// \note InvalidArgument will be reported if parent doesn't identify a struct. | ||
| UpdateSchema& AddRequiredColumn(std::optional<std::string_view> parent, | ||
| std::string_view name, std::shared_ptr<Type> type); | ||
|
|
||
| /// \brief Add a new required column to a nested struct with documentation. | ||
| /// | ||
| /// Adding a required column without a default is an incompatible change that can | ||
| /// break reading older data. To suppress exceptions thrown when an incompatible | ||
| /// change is detected, call AllowIncompatibleChanges(). | ||
| /// | ||
| /// The parent name is used to find the parent using Schema::FindFieldByName(). If | ||
| /// the parent name is null or empty, the new column will be added to the root as a | ||
| /// top-level column. If parent identifies a struct, a new column is added to that | ||
| /// struct. If it identifies a list, the column is added to the list element struct, | ||
| /// and if it identifies a map, the new column is added to the map's value struct. | ||
| /// | ||
| /// The given name is used to name the new column and names containing "." are not | ||
| /// handled differently. | ||
| /// | ||
| /// If type is a nested type, its field IDs are reassigned when added to the | ||
| /// existing schema. | ||
| /// | ||
| /// \param parent Name of the parent struct to which the column will be added. | ||
| /// \param name Name for the new column. | ||
| /// \param type Type for the new column. | ||
| /// \param doc Documentation string for the new column. | ||
| /// \return Reference to this for method chaining. | ||
| /// \note InvalidArgument will be reported if parent doesn't identify a struct. | ||
| UpdateSchema& AddRequiredColumn(std::optional<std::string_view> parent, | ||
| std::string_view name, std::shared_ptr<Type> type, | ||
| std::string_view doc); |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
| /// \brief Add a new required column to a nested struct. | |
| /// | |
| /// Adding a required column without a default is an incompatible change that can | |
| /// break reading older data. To suppress exceptions thrown when an incompatible | |
| /// change is detected, call AllowIncompatibleChanges(). | |
| /// | |
| /// The parent name is used to find the parent using Schema::FindFieldByName(). If | |
| /// the parent name is null or empty, the new column will be added to the root as a | |
| /// top-level column. If parent identifies a struct, a new column is added to that | |
| /// struct. If it identifies a list, the column is added to the list element struct, | |
| /// and if it identifies a map, the new column is added to the map's value struct. | |
| /// | |
| /// The given name is used to name the new column and names containing "." are not | |
| /// handled differently. | |
| /// | |
| /// If type is a nested type, its field IDs are reassigned when added to the | |
| /// existing schema. | |
| /// | |
| /// \param parent Name of the parent struct to which the column will be added. | |
| /// \param name Name for the new column. | |
| /// \param type Type for the new column. | |
| /// \return Reference to this for method chaining. | |
| /// \note InvalidArgument will be reported if parent doesn't identify a struct. | |
| UpdateSchema& AddRequiredColumn(std::optional<std::string_view> parent, | |
| std::string_view name, std::shared_ptr<Type> type); | |
| /// \brief Add a new required column to a nested struct with documentation. | |
| /// | |
| /// Adding a required column without a default is an incompatible change that can | |
| /// break reading older data. To suppress exceptions thrown when an incompatible | |
| /// change is detected, call AllowIncompatibleChanges(). | |
| /// | |
| /// The parent name is used to find the parent using Schema::FindFieldByName(). If | |
| /// the parent name is null or empty, the new column will be added to the root as a | |
| /// top-level column. If parent identifies a struct, a new column is added to that | |
| /// struct. If it identifies a list, the column is added to the list element struct, | |
| /// and if it identifies a map, the new column is added to the map's value struct. | |
| /// | |
| /// The given name is used to name the new column and names containing "." are not | |
| /// handled differently. | |
| /// | |
| /// If type is a nested type, its field IDs are reassigned when added to the | |
| /// existing schema. | |
| /// | |
| /// \param parent Name of the parent struct to which the column will be added. | |
| /// \param name Name for the new column. | |
| /// \param type Type for the new column. | |
| /// \param doc Documentation string for the new column. | |
| /// \return Reference to this for method chaining. | |
| /// \note InvalidArgument will be reported if parent doesn't identify a struct. | |
| UpdateSchema& AddRequiredColumn(std::optional<std::string_view> parent, | |
| std::string_view name, std::shared_ptr<Type> type, | |
| std::string_view doc); | |
| /// \brief Add a new required column to a nested struct with documentation. | |
| /// | |
| /// Adding a required column without a default is an incompatible change that can | |
| /// break reading older data. To suppress exceptions thrown when an incompatible | |
| /// change is detected, call AllowIncompatibleChanges(). | |
| /// | |
| /// The parent name is used to find the parent using Schema::FindFieldByName(). If | |
| /// the parent name is null or empty, the new column will be added to the root as a | |
| /// top-level column. If parent identifies a struct, a new column is added to that | |
| /// struct. If it identifies a list, the column is added to the list element struct, | |
| /// and if it identifies a map, the new column is added to the map's value struct. | |
| /// | |
| /// The given name is used to name the new column and names containing "." are not | |
| /// handled differently. | |
| /// | |
| /// If type is a nested type, its field IDs are reassigned when added to the | |
| /// existing schema. | |
| /// | |
| /// \param parent Name of the parent struct to which the column will be added. | |
| /// \param name Name for the new column. | |
| /// \param type Type for the new column. | |
| /// \param doc Documentation string for the new column. | |
| /// \return Reference to this for method chaining. | |
| /// \note InvalidArgument will be reported if parent doesn't identify a struct. | |
| UpdateSchema& AddRequiredColumn(std::optional<std::string_view> parent, | |
| std::string_view name, std::shared_ptr<Type> type, | |
| std::string_view doc = ""); |
Comment on lines
+113
to
+119
| UpdateSchema& UpdateSchema::AddRequiredColumn(std::optional<std::string_view> parent, | ||
| std::string_view name, | ||
| std::shared_ptr<Type> type) { | ||
| return AddColumnInternal(std::move(parent), name, /*is_optional=*/false, | ||
| std::move(type), ""); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
| UpdateSchema& UpdateSchema::AddRequiredColumn(std::optional<std::string_view> parent, | |
| std::string_view name, | |
| std::shared_ptr<Type> type) { | |
| return AddColumnInternal(std::move(parent), name, /*is_optional=*/false, | |
| std::move(type), ""); | |
| } |
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.
UpdateSchemaclass interface with full API documentation