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

[C++] Add CanReferenceFieldsByNames method to arrow::StructArray #37782

Closed
sgilmore10 opened this issue Sep 18, 2023 · 1 comment · Fixed by #37823
Closed

[C++] Add CanReferenceFieldsByNames method to arrow::StructArray #37782

sgilmore10 opened this issue Sep 18, 2023 · 1 comment · Fixed by #37823

Comments

@sgilmore10
Copy link
Member

sgilmore10 commented Sep 18, 2023

Describe the enhancement requested

arrow::Schema has a method called CanReferenceFieldsByNames which callers can use prior to calling GetFieldByName. It would be nice if arrow::StructArray also had CanReferenceFieldsByNames as a method.

I also think it would be nice to add a CanReferenceFieldByName method that accepts a std::string instead of a std::vector<std::string>. That way, users wouldn't have to create a std::vector containing one std::string when they just have one field name.

Component(s)

C++

@sgilmore10
Copy link
Member Author

take

@sgilmore10 sgilmore10 changed the title [C++] Add CanReferenceFieldsByName method to arrow::StructArray [C++] Add CanReferenceFieldsByNames method to arrow::StructArray Sep 21, 2023
kou pushed a commit that referenced this issue Sep 25, 2023
…uctArray` (#37823)

### Rationale for this change

`arrow::Schema` has a method called `CanReferenceFieldsByNames` which callers can use prior to calling `GetFieldByName`. It would be nice if `arrow::StructArray` also had `CanReferenceFieldsByNames` as a method. 

I also think it would be nice to add a `CanReferenceFieldByName` method that accepts a `std::string` instead of a `std::vector<std::string>` to `StructArray` and `Schema`. That way, users wouldn't have to create a `std::vector` containing one `std::string` when they just have one field name.

### What changes are included in this PR?

1. Added `CanReferenceFieldsByNames` method to `StructArray`
2. Added `CanReferenceFieldByName` method to `StructArray` 
3. Added `CanReferenceFieldsByName` method to `Schema`

### Are these changes tested?

Yes. I added unit tests for `CanReferenceFieldsByNames` and `CanReferenceFieldByName` to `array_struct_test.cc` and `type_test.cc`. 

### Are there any user-facing changes?

Yes. `CanReferenceFieldsByNames` and `CanReferenceFieldByName` can be called on a `StructArray`. Users can also call `CanReferenceFieldByName` on a `Schema`.

* Closes: #37782

Authored-by: Sarah Gilmore <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
@kou kou added this to the 14.0.0 milestone Sep 25, 2023
etseidl pushed a commit to etseidl/arrow that referenced this issue Sep 28, 2023
…w::StructArray` (apache#37823)

### Rationale for this change

`arrow::Schema` has a method called `CanReferenceFieldsByNames` which callers can use prior to calling `GetFieldByName`. It would be nice if `arrow::StructArray` also had `CanReferenceFieldsByNames` as a method. 

I also think it would be nice to add a `CanReferenceFieldByName` method that accepts a `std::string` instead of a `std::vector<std::string>` to `StructArray` and `Schema`. That way, users wouldn't have to create a `std::vector` containing one `std::string` when they just have one field name.

### What changes are included in this PR?

1. Added `CanReferenceFieldsByNames` method to `StructArray`
2. Added `CanReferenceFieldByName` method to `StructArray` 
3. Added `CanReferenceFieldsByName` method to `Schema`

### Are these changes tested?

Yes. I added unit tests for `CanReferenceFieldsByNames` and `CanReferenceFieldByName` to `array_struct_test.cc` and `type_test.cc`. 

### Are there any user-facing changes?

Yes. `CanReferenceFieldsByNames` and `CanReferenceFieldByName` can be called on a `StructArray`. Users can also call `CanReferenceFieldByName` on a `Schema`.

* Closes: apache#37782

Authored-by: Sarah Gilmore <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
JerAguilon pushed a commit to JerAguilon/arrow that referenced this issue Oct 23, 2023
…w::StructArray` (apache#37823)

### Rationale for this change

`arrow::Schema` has a method called `CanReferenceFieldsByNames` which callers can use prior to calling `GetFieldByName`. It would be nice if `arrow::StructArray` also had `CanReferenceFieldsByNames` as a method. 

I also think it would be nice to add a `CanReferenceFieldByName` method that accepts a `std::string` instead of a `std::vector<std::string>` to `StructArray` and `Schema`. That way, users wouldn't have to create a `std::vector` containing one `std::string` when they just have one field name.

### What changes are included in this PR?

1. Added `CanReferenceFieldsByNames` method to `StructArray`
2. Added `CanReferenceFieldByName` method to `StructArray` 
3. Added `CanReferenceFieldsByName` method to `Schema`

### Are these changes tested?

Yes. I added unit tests for `CanReferenceFieldsByNames` and `CanReferenceFieldByName` to `array_struct_test.cc` and `type_test.cc`. 

### Are there any user-facing changes?

Yes. `CanReferenceFieldsByNames` and `CanReferenceFieldByName` can be called on a `StructArray`. Users can also call `CanReferenceFieldByName` on a `Schema`.

* Closes: apache#37782

Authored-by: Sarah Gilmore <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this issue Nov 13, 2023
…w::StructArray` (apache#37823)

### Rationale for this change

`arrow::Schema` has a method called `CanReferenceFieldsByNames` which callers can use prior to calling `GetFieldByName`. It would be nice if `arrow::StructArray` also had `CanReferenceFieldsByNames` as a method. 

I also think it would be nice to add a `CanReferenceFieldByName` method that accepts a `std::string` instead of a `std::vector<std::string>` to `StructArray` and `Schema`. That way, users wouldn't have to create a `std::vector` containing one `std::string` when they just have one field name.

### What changes are included in this PR?

1. Added `CanReferenceFieldsByNames` method to `StructArray`
2. Added `CanReferenceFieldByName` method to `StructArray` 
3. Added `CanReferenceFieldsByName` method to `Schema`

### Are these changes tested?

Yes. I added unit tests for `CanReferenceFieldsByNames` and `CanReferenceFieldByName` to `array_struct_test.cc` and `type_test.cc`. 

### Are there any user-facing changes?

Yes. `CanReferenceFieldsByNames` and `CanReferenceFieldByName` can be called on a `StructArray`. Users can also call `CanReferenceFieldByName` on a `Schema`.

* Closes: apache#37782

Authored-by: Sarah Gilmore <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
…w::StructArray` (apache#37823)

### Rationale for this change

`arrow::Schema` has a method called `CanReferenceFieldsByNames` which callers can use prior to calling `GetFieldByName`. It would be nice if `arrow::StructArray` also had `CanReferenceFieldsByNames` as a method. 

I also think it would be nice to add a `CanReferenceFieldByName` method that accepts a `std::string` instead of a `std::vector<std::string>` to `StructArray` and `Schema`. That way, users wouldn't have to create a `std::vector` containing one `std::string` when they just have one field name.

### What changes are included in this PR?

1. Added `CanReferenceFieldsByNames` method to `StructArray`
2. Added `CanReferenceFieldByName` method to `StructArray` 
3. Added `CanReferenceFieldsByName` method to `Schema`

### Are these changes tested?

Yes. I added unit tests for `CanReferenceFieldsByNames` and `CanReferenceFieldByName` to `array_struct_test.cc` and `type_test.cc`. 

### Are there any user-facing changes?

Yes. `CanReferenceFieldsByNames` and `CanReferenceFieldByName` can be called on a `StructArray`. Users can also call `CanReferenceFieldByName` on a `Schema`.

* Closes: apache#37782

Authored-by: Sarah Gilmore <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants