-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[C++] Add a struct_
overload taking a vector of (name, type) pairs
#36867
Comments
I can take this issue if no one has started working on it yet. |
@jsjtxietian Yes, you can submit a PR if you want. |
@pitrou Hi,I have a question regarding this issue and I want to ask for your advice. In this code, because field is a function with default parameters, one can pass not only name and type to this function, but also nullable and metadata but in the following form, I can use std::initializer_list<std::pair<std::string, std::shared_ptr>> as the input parameter, but in this way it's hard to add support for passing in nullable and metadata conveniently like the field function. std::tuple doesn't support default parameters too. I guess there is a better way to write this overload function or shall we just support (name, type) pairs for now? |
hi @jsjtxietian
We can just support (name, type) pairs since that's the common case anyway. |
…(name, type) pairs (#36915) ### Rationale for this change Mostly for convenience. It would be nice to be able to write: ```struct_({{"a", int8()}, {"b", utf8()}});``` instead of: ```struct_({field("a", int8()), field("b", utf8())});``` Same with the schema factory. ### What changes are included in this PR? Add a struct_ overload and two schema overload taking a vector of (name, type) pairs to construct a vector of fields. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. Add three ARROW_EXPORT functions. * Closes: #36867 Authored-by: jsjtxietian <jsjtxietian@outlook.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
…or of (name, type) pairs (apache#36915) ### Rationale for this change Mostly for convenience. It would be nice to be able to write: ```struct_({{"a", int8()}, {"b", utf8()}});``` instead of: ```struct_({field("a", int8()), field("b", utf8())});``` Same with the schema factory. ### What changes are included in this PR? Add a struct_ overload and two schema overload taking a vector of (name, type) pairs to construct a vector of fields. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. Add three ARROW_EXPORT functions. * Closes: apache#36867 Authored-by: jsjtxietian <jsjtxietian@outlook.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
Describe the enhancement requested
It would be nice to be able to write:
instead of:
Same with the
schema
factory.Component(s)
C++
The text was updated successfully, but these errors were encountered: