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

GH-38090: [C++][Emscripten] orc: Suppress shorten-64-to-32 warnings #38097

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions cpp/src/arrow/adapters/orc/adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class ORCFileReader::Impl {

Status Init() {
int64_t nstripes = reader_->getNumberOfStripes();
stripes_.resize(nstripes);
stripes_.resize(static_cast<size_t>(nstripes));
std::unique_ptr<liborc::StripeInformation> stripe;
uint64_t first_row_of_stripe = 0;
for (int i = 0; i < nstripes; ++i) {
Expand All @@ -222,7 +222,9 @@ class ORCFileReader::Impl {

int64_t NumberOfRows() { return static_cast<int64_t>(reader_->getNumberOfRows()); }

StripeInformation GetStripeInformation(int64_t stripe) { return stripes_[stripe]; }
StripeInformation GetStripeInformation(int64_t stripe) {
return stripes_[static_cast<size_t>(stripe)];
}

FileVersion GetFileVersion() {
liborc::FileVersion orc_file_version = reader_->getFormatVersion();
Expand Down Expand Up @@ -365,7 +367,7 @@ class ORCFileReader::Impl {
liborc::RowReaderOptions opts = default_row_reader_options();
RETURN_NOT_OK(SelectStripe(&opts, stripe));
ARROW_ASSIGN_OR_RAISE(auto schema, ReadSchema(opts));
return ReadBatch(opts, schema, stripes_[stripe].num_rows);
return ReadBatch(opts, schema, stripes_[static_cast<size_t>(stripe)].num_rows);
}

Result<std::shared_ptr<RecordBatch>> ReadStripe(
Expand All @@ -374,7 +376,7 @@ class ORCFileReader::Impl {
RETURN_NOT_OK(SelectIndices(&opts, include_indices));
RETURN_NOT_OK(SelectStripe(&opts, stripe));
ARROW_ASSIGN_OR_RAISE(auto schema, ReadSchema(opts));
return ReadBatch(opts, schema, stripes_[stripe].num_rows);
return ReadBatch(opts, schema, stripes_[static_cast<size_t>(stripe)].num_rows);
}

Result<std::shared_ptr<RecordBatch>> ReadStripe(
Expand All @@ -383,15 +385,15 @@ class ORCFileReader::Impl {
RETURN_NOT_OK(SelectNames(&opts, include_names));
RETURN_NOT_OK(SelectStripe(&opts, stripe));
ARROW_ASSIGN_OR_RAISE(auto schema, ReadSchema(opts));
return ReadBatch(opts, schema, stripes_[stripe].num_rows);
return ReadBatch(opts, schema, stripes_[static_cast<size_t>(stripe)].num_rows);
}

Status SelectStripe(liborc::RowReaderOptions* opts, int64_t stripe) {
ARROW_RETURN_IF(stripe < 0 || stripe >= NumberOfStripes(),
Status::Invalid("Out of bounds stripe: ", stripe));

opts->range(static_cast<uint64_t>(stripes_[stripe].offset),
static_cast<uint64_t>(stripes_[stripe].length));
opts->range(static_cast<uint64_t>(stripes_[static_cast<size_t>(stripe)].offset),
static_cast<uint64_t>(stripes_[static_cast<size_t>(stripe)].length));
return Status::OK();
}

Expand Down