Skip to content

Conversation

@thisisnic
Copy link
Member

Follow up to #13482 after this one was missed.

@github-actions
Copy link

github-actions bot commented Jul 5, 2022

@github-actions
Copy link

github-actions bot commented Jul 5, 2022

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

@thisisnic thisisnic requested a review from nealrichardson July 5, 2022 13:36
Copy link
Member

@nealrichardson nealrichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Two questions:

  • I don't see a test of the r_vec_size() behavior in this PR or the other one. What is our assurance that it behaves as we want?
  • I noticed that this function previously returned int64_t, so I wondered whether cpp11 just automatically handled that in the way we wanted. [Turns out someone 🤦 already found out that this doesn't behave nicely], and that we need to handle it ourselves like you have done here. Unfortunately, we have about 20 other functions that return int64_t that would be subject to the same overflow problem. (I searched ^int64_t in r/src/ to find them.) Would you mind fixing them all in this PR too?

@nealrichardson
Copy link
Member

Also, it looks like you need to install the package/run the codegen script so that arrowExports.cpp gets updated.

@thisisnic
Copy link
Member Author

I don't see a test of the r_vec_size() behavior in this PR or the other one. What is our assurance that it behaves as we want?

I added some in an earlier version of the previous PR, but they took ages to run locally (though were successful), and on CI just crashed it entirely. I removed them, but couldn't think of an alternative. Do you have any suggestions?

...Would you mind fixing them all in this PR too?

Done.

@thisisnic thisisnic requested a review from nealrichardson July 7, 2022 13:54
@nealrichardson
Copy link
Member

I don't see a test of the r_vec_size() behavior in this PR or the other one. What is our assurance that it behaves as we want?

I added some in an earlier version of the previous PR, but they took ages to run locally (though were successful), and on CI just crashed it entirely. I removed them, but couldn't think of an alternative. Do you have any suggestions?

You could tack onto one of the tests that is guarded by ARROW_LARGE_MEMORY_TESTS. Those create buffers that are >2GB and require Large types, which means their size exceeds MAX_INT32 bytes. So check that the buffer size doesn't overflow and is double? I think buffer size was one of the other cases that returned int64_t that you would have find/replaced here.

)
})

test_that("num_rows method not susceptible to integer overflow", {
Copy link
Member

@nealrichardson nealrichardson Jul 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These large memory tests are slow, so I don't think you need two versions, I think you can keep just the Table version.

If you want to test more places r_vec_size is used, you can get $nbytes() on the arrays/chunkedarrays, as well as length(). You can also get array$data() and check its length (that one might not be covered yet...) and get $buffers from that, and check them too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the RecordBatch test, added in tests for a few more fields, as well as updating a couple of utility functions that these changes broke. The one thing I didn't do is getting array$data() and actually, I'm wondering if overflow is possible with that? From my understanding, an array's maximum size would be the maximum integer value, or am I getting mixed up there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LargeString/Binary at least have a buffer size that can go up to MAX_INT64, that's why they exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nealrichardson Would you mind expanding on that a bit? There's something I'm missing here or misunderstanding.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the format, see https://github.com/apache/arrow/blob/master/format/Schema.fbs#L155-L171 and https://arrow.apache.org/docs/format/Columnar.html.

In R:

# Here's a simple integer array
> a <- Array$create(1:5)
> a$data()
ArrayData
> a$data()$buffers
[[1]]
NULL

[[2]]
Buffer
# the first buffer is for the null bitmask, but it's empty because there are no NAs

> a$data()$buffers[[2]]
Buffer
> a$data()$buffers[[2]]$size
[1] 20
> a$data()$buffers[[2]]$capacity
[1] 20

# here's a string array
> strings <- Array$create(letters)
# note it has 3 buffers, one for the data and one for the offsets
> strings$data()$buffers
[[1]]
NULL

[[2]]
Buffer

[[3]]
Buffer

> strings$data()$buffers[[2]]$size
[1] 108
> strings$data()$buffers[[3]]$size
[1] 26

# let's make a LargeString array using the helper from the test suite
> make_big_string <- function() {
+   # This creates a character vector that would exceed the capacity of BinaryArray
+   rep(purrr::map_chr(2047:2050, ~ paste(sample(letters, ., replace = TRUE), collapse = "")), 2^18)
+ }
> big <- Array$create(make_big_string())
> big$type
LargeUtf8
large_string
> big$data()$buffers
[[1]]
NULL

[[2]]
Buffer

[[3]]
Buffer

> big$data()$buffers[[2]]$size
[1] 8388616
# the data buffer is > MAX_INT32 so it overflows (on master)
> big$data()$buffers[[3]]$size
[1] -2146959360

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for that! Worked out what it was - I'd completely forgotten R's issues with 64 bit integers for a moment there.

@nealrichardson nealrichardson merged commit 87d1889 into apache:master Jul 14, 2022
@ursabot
Copy link

ursabot commented Jul 15, 2022

Benchmark runs are scheduled for baseline = 5d86e9f and contender = 87d1889. 87d1889 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.73% ⬆️0.49%] test-mac-arm
[Failed ⬇️1.27% ⬆️3.17%] ursa-i9-9960x
[Finished ⬇️0.25% ⬆️0.04%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 87d18890 ec2-t3-xlarge-us-east-2
[Failed] 87d18890 test-mac-arm
[Failed] 87d18890 ursa-i9-9960x
[Finished] 87d18890 ursa-thinkcentre-m75q
[Finished] 5d86e9fc ec2-t3-xlarge-us-east-2
[Failed] 5d86e9fc test-mac-arm
[Failed] 5d86e9fc ursa-i9-9960x
[Finished] 5d86e9fc ursa-thinkcentre-m75q
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

kou pushed a commit that referenced this pull request Feb 20, 2023
…Hub issue numbers (#34260)

Rewrite the Jira issue numbers to the GitHub issue numbers, so that the GitHub issue numbers are automatically linked to the issues by pkgdown's auto-linking feature.

Issue numbers have been rewritten based on the following correspondence.
Also, the pkgdown settings have been changed and updated to link to GitHub.

I generated the Changelog page using the `pkgdown::build_news()` function and verified that the links work correctly.

---
ARROW-6338	#5198
ARROW-6364	#5201
ARROW-6323	#5169
ARROW-6278	#5141
ARROW-6360	#5329
ARROW-6533	#5450
ARROW-6348	#5223
ARROW-6337	#5399
ARROW-10850	#9128
ARROW-10624	#9092
ARROW-10386	#8549
ARROW-6994	#23308
ARROW-12774	#10320
ARROW-12670	#10287
ARROW-16828	#13484
ARROW-14989	#13482
ARROW-16977	#13514
ARROW-13404	#10999
ARROW-16887	#13601
ARROW-15906	#13206
ARROW-15280	#13171
ARROW-16144	#13183
ARROW-16511	#13105
ARROW-16085	#13088
ARROW-16715	#13555
ARROW-16268	#13550
ARROW-16700	#13518
ARROW-16807	#13583
ARROW-16871	#13517
ARROW-16415	#13190
ARROW-14821	#12154
ARROW-16439	#13174
ARROW-16394	#13118
ARROW-16516	#13163
ARROW-16395	#13627
ARROW-14848	#12589
ARROW-16407	#13196
ARROW-16653	#13506
ARROW-14575	#13160
ARROW-15271	#13170
ARROW-16703	#13650
ARROW-16444	#13397
ARROW-15016	#13541
ARROW-16776	#13563
ARROW-15622	#13090
ARROW-18131	#14484
ARROW-18305	#14581
ARROW-18285	#14615
* Closes: #33631

Authored-by: SHIMA Tatsuya <[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 this pull request may close these issues.

3 participants