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 support for table.each_raw_record.to_a #37562

Closed
otegami opened this issue Sep 5, 2023 · 2 comments · Fixed by #37600
Closed

[Ruby] Add support for table.each_raw_record.to_a #37562

otegami opened this issue Sep 5, 2023 · 2 comments · Fixed by #37600

Comments

@otegami
Copy link
Contributor

otegami commented Sep 5, 2023

Describe the enhancement requested

Currently, the method Arrow::Table#each_raw_record is expected to work with .to_a without a block. However, when attempting to do so, it raises a LocalJumpError indicating "no block given".

Steps to Reproduce

Use the Arrow::Table method to create a new table instance.
Call each_raw_record followed by to_a without providing a block.

Expected

> Arrow::Table.new(number: [1, 2, 3]).each_raw_record.to_a
=> [[1], [2], [3]]

Actual

> Arrow::Table.new(number: [1, 2, 3]).each_raw_record.to_a
(irb):3:in `each_raw_record': no block given (LocalJumpError)
        from (irb):3:in `<main>'                                                                                         
        from /Users/otegami/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'    
        from /Users/otegami/.rbenv/versions/3.2.0/bin/irb:25:in `load'                                                   
        from /Users/otegami/.rbenv/versions/3.2.0/bin/irb:25:in `<main>'

Component(s)

Ruby

@otegami
Copy link
Contributor Author

otegami commented Sep 6, 2023

I will take it!

@otegami
Copy link
Contributor Author

otegami commented Sep 6, 2023

take

kou pushed a commit that referenced this issue Sep 11, 2023
### Rationale for this change

This change aligns the behavior of `each_raw_record` with standard Ruby practices by returning an enumerator when no block is provided

### What changes are included in this PR?

- Made `Arrow::Table#each_raw_record` and `Arrow::RecordBatch#each_raw_record` return Enumerator when it was called without block.
- Added related tests
- Resolved warnings related to duplicate test classes which were caused by #37137

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No

* Closes: #37562

Authored-by: otegami <a.s.takuya1026@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
@kou kou added this to the 14.0.0 milestone Sep 11, 2023
loicalleyne pushed a commit to loicalleyne/arrow that referenced this issue Nov 13, 2023
…ache#37600)

### Rationale for this change

This change aligns the behavior of `each_raw_record` with standard Ruby practices by returning an enumerator when no block is provided

### What changes are included in this PR?

- Made `Arrow::Table#each_raw_record` and `Arrow::RecordBatch#each_raw_record` return Enumerator when it was called without block.
- Added related tests
- Resolved warnings related to duplicate test classes which were caused by apache#37137

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No

* Closes: apache#37562

Authored-by: otegami <a.s.takuya1026@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
…ache#37600)

### Rationale for this change

This change aligns the behavior of `each_raw_record` with standard Ruby practices by returning an enumerator when no block is provided

### What changes are included in this PR?

- Made `Arrow::Table#each_raw_record` and `Arrow::RecordBatch#each_raw_record` return Enumerator when it was called without block.
- Added related tests
- Resolved warnings related to duplicate test classes which were caused by apache#37137

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No

* Closes: apache#37562

Authored-by: otegami <a.s.takuya1026@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment