Skip to content

Commit

Permalink
Init vectors once
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcdonald3 committed May 21, 2024
1 parent f65b440 commit 19153b0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ArrowFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,12 +846,11 @@ int cpp_readColumnByName(const char* filename, void* chpl_arr, bool* where_null_
static_cast<parquet::ByteArrayReader*>(column_reader.get());

int totalProcessed = 0;

std::vector<parquet::ByteArray> values(batchSize);
std::vector<int16_t> definition_levels(batchSize);
while (reader->HasNext()) {
if((numElems - totalProcessed) < batchSize) // adjust batchSize if needed
batchSize = numElems - totalProcessed;
std::vector<parquet::ByteArray> values(batchSize);
std::vector<int16_t> definition_levels(batchSize);

(void)reader->ReadBatch(batchSize, definition_levels.data(), nullptr, values.data(), &values_read);
totalProcessed += values_read;
Expand Down

0 comments on commit 19153b0

Please sign in to comment.