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

[Ruby] Add easy to use API for match_substring and related functions #34819

Closed
collimarco opened this issue Mar 31, 2023 · 8 comments · Fixed by #34902
Closed

[Ruby] Add easy to use API for match_substring and related functions #34819

collimarco opened this issue Mar 31, 2023 · 8 comments · Fixed by #34902

Comments

@collimarco
Copy link

Describe the enhancement requested

It would be useful to have access to the string matching functions using the Ruby gem.

These are the functions:
https://arrow.apache.org/docs/cpp/compute.html#containment-tests

For example:

# Find rows that have a status 200 and contain the string example in the message field
table.slice { |slicer| (slicer['status'] == 200) & (slicer['message'].match_substring 'example') }

Component(s)

Ruby

@kou kou changed the title Add match_substring and related functions to the Ruby gem [Ruby] Add easy to use API for match_substring and related functions Mar 31, 2023
@kou
Copy link
Member

kou commented Mar 31, 2023

FYI: We can implement slicer['message'].match_substring('example') API by improving

class ColumnCondition < Condition

@heronshoes Are you interested in this?

@heronshoes
Copy link
Contributor

OK, I'll give it a try. Thanks!

@kou kou closed this as completed in #34902 Apr 6, 2023
kou added a commit that referenced this issue Apr 6, 2023
### Rationale for this change

C GLib supported `MatchSubstringOptions` in #34725. This PR will use this and will supply an easy to use API in Ruby binding.

### What changes are included in this PR?

- Add a class `Arrow::Slicer::MatchSubstringCondition`
- Add a method `#match_substring` in `Arrow::Slicer::ColumnCondition`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.

* Closes: #34819

Lead-authored-by: Hirokazu SUZUKI <heronshoes877@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
@kou kou added this to the 12.0.0 milestone Apr 6, 2023
@heronshoes
Copy link
Contributor

Thanks!

@collimarco
Copy link
Author

@kou Thanks for adding this. Do you know when the v12 will be available? I cannot find this release on RubyGems

@kou
Copy link
Member

kou commented Apr 27, 2023

We're voting for 12.0.0 RC0: https://lists.apache.org/thread/2cnl1nbr8kfcxxq9s9br9b6f4xpmsqz1
We'll release 12.0.0 after the vote is passed.

@heronshoes
Copy link
Contributor

I'm waiting 12.0.0 too !

In 11.0.0, it took a long time to pass Homebrew 😢. I hope to get through the gates soon !

https://arrow.apache.org/docs/developers/release.html#post-release-tasks

liujiacheng777 pushed a commit to LoongArch-Python/arrow that referenced this issue May 11, 2023
…pache#34902)

### Rationale for this change

C GLib supported `MatchSubstringOptions` in apache#34725. This PR will use this and will supply an easy to use API in Ruby binding.

### What changes are included in this PR?

- Add a class `Arrow::Slicer::MatchSubstringCondition`
- Add a method `#match_substring` in `Arrow::Slicer::ColumnCondition`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.

* Closes: apache#34819

Lead-authored-by: Hirokazu SUZUKI <heronshoes877@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
ArgusLi pushed a commit to Bit-Quill/arrow that referenced this issue May 15, 2023
…pache#34902)

### Rationale for this change

C GLib supported `MatchSubstringOptions` in apache#34725. This PR will use this and will supply an easy to use API in Ruby binding.

### What changes are included in this PR?

- Add a class `Arrow::Slicer::MatchSubstringCondition`
- Add a method `#match_substring` in `Arrow::Slicer::ColumnCondition`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.

* Closes: apache#34819

Lead-authored-by: Hirokazu SUZUKI <heronshoes877@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
rtpsw pushed a commit to rtpsw/arrow that referenced this issue May 16, 2023
…pache#34902)

### Rationale for this change

C GLib supported `MatchSubstringOptions` in apache#34725. This PR will use this and will supply an easy to use API in Ruby binding.

### What changes are included in this PR?

- Add a class `Arrow::Slicer::MatchSubstringCondition`
- Add a method `#match_substring` in `Arrow::Slicer::ColumnCondition`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.

* Closes: apache#34819

Lead-authored-by: Hirokazu SUZUKI <heronshoes877@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
@collimarco
Copy link
Author

@kou I am testing the new release v12, however it seems that the code in my original post still doesn't work.

I get this error:

undefined method `match_substring' for #<Arrow::Slicer::ColumnCondition:... (NoMethodError)

Any ideas?

@collimarco
Copy link
Author

Oh, sorry, it seems to work properly if I add a question mark at the end: match_substring? instead of match_substring.

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.

3 participants