You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "kou (via GitHub)" <gi...@apache.org> on 2023/03/03 21:40:59 UTC
[GitHub] [arrow] kou opened a new pull request, #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` withotu block
kou opened a new pull request, #34441:
URL: https://github.com/apache/arrow/pull/34441
### Rationale for this change
`#each` must support this.
### What changes are included in this PR?
`to_enum` and tests for this.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
Yes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] heronshoes commented on a diff in pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "heronshoes (via GitHub)" <gi...@apache.org>.
heronshoes commented on code in PR #34441:
URL: https://github.com/apache/arrow/pull/34441#discussion_r1125135206
##########
ruby/red-arrow/lib/arrow/record-batch-file-reader.rb:
##########
@@ -20,6 +20,8 @@ class RecordBatchFileReader
include Enumerable
def each
+ return to_enum(__method__) unless block_given?
Review Comment:
How about to supply the size of Enumerator?
```suggestion
return to_enum(__method__) {n_record_batches} unless block_given?
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` withotu block
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34441:
URL: https://github.com/apache/arrow/pull/34441#issuecomment-1454163890
* Closes: #34440
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] kou commented on a diff in pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` withotu block
Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #34441:
URL: https://github.com/apache/arrow/pull/34441#discussion_r1125039318
##########
ruby/red-arrow/test/test-record-batch-stream-reader.rb:
##########
@@ -0,0 +1,129 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class RecordBatchStreamReaderTest < Test::Unit::TestCase
Review Comment:
This is based on existing `RecordBatchFileReaderTest`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] heronshoes commented on a diff in pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "heronshoes (via GitHub)" <gi...@apache.org>.
heronshoes commented on code in PR #34441:
URL: https://github.com/apache/arrow/pull/34441#discussion_r1125109788
##########
ruby/red-arrow/test/test-record-batch-stream-reader.rb:
##########
@@ -0,0 +1,129 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class RecordBatchStreamReaderTest < Test::Unit::TestCase
Review Comment:
Yes I will!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] ursabot commented on pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #34441:
URL: https://github.com/apache/arrow/pull/34441#issuecomment-1455041834
Benchmark runs are scheduled for baseline = f465c345e50afeaf82accfa72e3f2216f64f72e2 and contender = 237705bf17486cfc35ab7d1ddfe59dd60f042ab8. 237705bf17486cfc35ab7d1ddfe59dd60f042ab8 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/9e84da99774c4fe9a521bd74a14d119b...4bd8f1ae5865440dac16c9c143f87eba/)
[Failed :arrow_down:0.43% :arrow_up:0.0%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/d3f5bd4e44f748e39382262c4f770394...9c7f053b118d4d9c8c23472e4ca0e127/)
[Finished :arrow_down:5.1% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/efc4c20f15034e26ad314d5a92c40109...ea34888cf7bf48a49486f858a8149ae5/)
[Finished :arrow_down:0.35% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/9d45c854fc344adaa14a08b4e0313283...8aa1a88954ae46a0bca4354e47204c9e/)
Buildkite builds:
[Finished] [`237705bf` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2478)
[Failed] [`237705bf` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2508)
[Finished] [`237705bf` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2476)
[Finished] [`237705bf` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2499)
[Finished] [`f465c345` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2477)
[Failed] [`f465c345` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2507)
[Finished] [`f465c345` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2475)
[Finished] [`f465c345` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2498)
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] kou commented on pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #34441:
URL: https://github.com/apache/arrow/pull/34441#issuecomment-1454910853
+1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] kou merged pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "kou (via GitHub)" <gi...@apache.org>.
kou merged PR #34441:
URL: https://github.com/apache/arrow/pull/34441
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` withotu block
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34441:
URL: https://github.com/apache/arrow/pull/34441#issuecomment-1454163938
:warning: GitHub issue #34440 **has been automatically assigned in GitHub** to PR creator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] heronshoes commented on a diff in pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "heronshoes (via GitHub)" <gi...@apache.org>.
heronshoes commented on code in PR #34441:
URL: https://github.com/apache/arrow/pull/34441#discussion_r1125135206
##########
ruby/red-arrow/lib/arrow/record-batch-file-reader.rb:
##########
@@ -20,6 +20,8 @@ class RecordBatchFileReader
include Enumerable
def each
+ return to_enum(__method__) unless block_given?
Review Comment:
How about to supply the size of Enumerator?
```suggestion
return to_enum(__method__) { n_record_batches } unless block_given?
```
##########
ruby/red-arrow/test/test-record-batch-file-reader.rb:
##########
@@ -112,4 +112,18 @@ class RecordBatchFileReaderTest < Test::Unit::TestCase
end
end
end
+
+ sub_test_case("#each") do
+ test("without block") do
+ buffer = Arrow::ResizableBuffer.new(1024)
+ Arrow::Table.new(number: [1, 2, 3]).save(buffer)
+ Arrow::BufferInputStream.open(buffer) do |input|
+ reader = Arrow::RecordBatchFileReader.new(input)
+ assert_equal([
+ Arrow::RecordBatch.new(number: [1, 2, 3]),
+ ],
+ reader.each.to_a)
+ end
+ end
Review Comment:
```suggestion
test("without block") do
buffer = Arrow::ResizableBuffer.new(1024)
Arrow::Table.new(number: [1, 2, 3]).save(buffer)
Arrow::BufferInputStream.open(buffer) do |input|
reader = Arrow::RecordBatchFileReader.new(input)
assert_equal([
Arrow::RecordBatch.new(number: [1, 2, 3]),
],
reader.each.to_a)
end
end
test("without block, test size") do
buffer = Arrow::ResizableBuffer.new(1024)
Arrow::Table.new(number: [1, 2, 3]).save(buffer)
Arrow::BufferInputStream.open(buffer) do |input|
reader = Arrow::RecordBatchFileReader.new(input)
assert_equal 1, reader.each.size
end
end
```
Added test "without block, test size".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] kou commented on a diff in pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #34441:
URL: https://github.com/apache/arrow/pull/34441#discussion_r1125290614
##########
ruby/red-arrow/test/test-record-batch-file-reader.rb:
##########
@@ -112,4 +112,18 @@ class RecordBatchFileReaderTest < Test::Unit::TestCase
end
end
end
+
+ sub_test_case("#each") do
+ test("without block") do
+ buffer = Arrow::ResizableBuffer.new(1024)
+ Arrow::Table.new(number: [1, 2, 3]).save(buffer)
+ Arrow::BufferInputStream.open(buffer) do |input|
+ reader = Arrow::RecordBatchFileReader.new(input)
+ assert_equal([
+ Arrow::RecordBatch.new(number: [1, 2, 3]),
+ ],
+ reader.each.to_a)
Review Comment:
```suggestion
each = reader.each
assert_equal({
size: 1,
to_a: [
Arrow::RecordBatch.new(number: [1, 2, 3]),
],
}.
{
size: each.size,
to_a: each.to_a,
})
```
##########
ruby/red-arrow/test/test-record-batch-file-reader.rb:
##########
@@ -112,4 +112,18 @@ class RecordBatchFileReaderTest < Test::Unit::TestCase
end
end
end
+
+ sub_test_case("#each") do
+ test("without block") do
+ buffer = Arrow::ResizableBuffer.new(1024)
+ Arrow::Table.new(number: [1, 2, 3]).save(buffer)
+ Arrow::BufferInputStream.open(buffer) do |input|
+ reader = Arrow::RecordBatchFileReader.new(input)
+ assert_equal([
+ Arrow::RecordBatch.new(number: [1, 2, 3]),
+ ],
+ reader.each.to_a)
+ end
+ end
Review Comment:
I'll test them at once for easy to debug.
##########
ruby/red-arrow/lib/arrow/record-batch-file-reader.rb:
##########
@@ -20,6 +20,8 @@ class RecordBatchFileReader
include Enumerable
def each
+ return to_enum(__method__) unless block_given?
Review Comment:
It's a good idea!
I don't know any useful use-case of this (and `Enumerator#size`) but this doesn't have a performance penalty. So it's acceptable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] ursabot commented on pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #34441:
URL: https://github.com/apache/arrow/pull/34441#issuecomment-1455042263
['Python', 'R'] benchmarks have high level of regressions.
[ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/efc4c20f15034e26ad314d5a92c40109...ea34888cf7bf48a49486f858a8149ae5/)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] heronshoes commented on pull request #34441: GH-34440: [Ruby] Add support for `RecordBatch{File,Stream}Reader#each` without block
Posted by "heronshoes (via GitHub)" <gi...@apache.org>.
heronshoes commented on PR #34441:
URL: https://github.com/apache/arrow/pull/34441#issuecomment-1454969137
:+1:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org