diff --git a/src/ArrowFunctions.cpp b/src/ArrowFunctions.cpp index 82b8ddb771..3be8e4e6d2 100644 --- a/src/ArrowFunctions.cpp +++ b/src/ArrowFunctions.cpp @@ -834,7 +834,7 @@ int cpp_readColumnByName(const char* filename, void* chpl_arr, bool* where_null_ int totalProcessed = 0; std::vector values(batchSize); std::vector definition_levels(batchSize); - while (reader->HasNext()) { + while (reader->HasNext() && totalProcessed < numElems) { if((numElems - totalProcessed) < batchSize) // adjust batchSize if needed batchSize = numElems - totalProcessed;