1717#include " paimon/common/reader/prefetch_file_batch_reader_impl.h"
1818
1919#include < atomic>
20+ #include < limits>
2021#include < set>
2122
2223#include " arrow/compute/api.h"
@@ -283,7 +284,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestSimple) {
283284 /* enable_adaptive_prefetch_strategy=*/ false , executor_,
284285 /* initialize_read_ranges=*/ true , /* prefetch_cache_mode=*/ PrefetchCacheMode::ALWAYS ,
285286 CacheConfig (), GetDefaultPool ()));
286- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
287+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
288+ reader->GetPreviousBatchFirstRowNumber ().value ());
287289 ASSERT_OK_AND_ASSIGN (auto result_array,
288290 ReadResultCollector::CollectResult (
289291 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -605,7 +607,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestReadWithLargeBatchSize) {
605607 prefetch_max_parallel_num * 2 , /* enable_adaptive_prefetch_strategy=*/ false , executor_,
606608 /* initialize_read_ranges=*/ true , /* prefetch_cache_mode=*/ PrefetchCacheMode::ALWAYS ,
607609 CacheConfig (), GetDefaultPool ()));
608- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
610+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
611+ reader->GetPreviousBatchFirstRowNumber ().value ());
609612 ASSERT_OK_AND_ASSIGN (auto result_array,
610613 ReadResultCollector::CollectResult (
611614 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -633,7 +636,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestPartialReaderSuccessRead) {
633636 }
634637
635638 arrow::ArrayVector result_array_vector;
636- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
639+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
640+ reader->GetPreviousBatchFirstRowNumber ().value ());
637641 ASSERT_OK_AND_ASSIGN (auto batch_with_bitmap, reader->NextBatchWithBitmap ());
638642 auto & [batch, bitmap] = batch_with_bitmap;
639643 ASSERT_EQ (batch.first ->length , bitmap.Cardinality ());
@@ -678,9 +682,11 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestAllReaderFailedWithIOError) {
678682 ->SetNextBatchStatus (Status::IOError (" mock error" ));
679683 }
680684
681- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
685+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
686+ reader->GetPreviousBatchFirstRowNumber ().value ());
682687 auto batch_result = reader->NextBatchWithBitmap ();
683- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
688+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
689+ reader->GetPreviousBatchFirstRowNumber ().value ());
684690 ASSERT_FALSE (batch_result.ok ());
685691 ASSERT_TRUE (batch_result.status ().IsIOError ());
686692 ASSERT_FALSE (prefetch_reader->is_shutdown_ );
@@ -689,7 +695,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestAllReaderFailedWithIOError) {
689695
690696 // call NextBatch again, will still return error status
691697 auto batch_result2 = reader->NextBatchWithBitmap ();
692- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
698+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
699+ reader->GetPreviousBatchFirstRowNumber ().value ());
693700 ASSERT_FALSE (batch_result2.ok ());
694701 ASSERT_TRUE (batch_result2.status ().IsIOError ());
695702}
@@ -706,7 +713,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestPrefetchWithEmptyData) {
706713 prefetch_max_parallel_num * 2 , /* enable_adaptive_prefetch_strategy=*/ false , executor_,
707714 /* initialize_read_ranges=*/ true , /* prefetch_cache_mode=*/ PrefetchCacheMode::ALWAYS ,
708715 CacheConfig (), GetDefaultPool ()));
709- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
716+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
717+ reader->GetPreviousBatchFirstRowNumber ().value ());
710718 ASSERT_OK_AND_ASSIGN (auto result_array,
711719 ReadResultCollector::CollectResult (
712720 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -726,7 +734,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestCallNextBatchAfterReadingEof) {
726734 prefetch_max_parallel_num * 2 , /* enable_adaptive_prefetch_strategy=*/ false , executor_,
727735 /* initialize_read_ranges=*/ true , /* prefetch_cache_mode=*/ PrefetchCacheMode::ALWAYS ,
728736 CacheConfig (), GetDefaultPool ()));
729- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
737+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
738+ reader->GetPreviousBatchFirstRowNumber ().value ());
730739 ASSERT_OK_AND_ASSIGN (auto result_array,
731740 ReadResultCollector::CollectResult (
732741 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -832,7 +841,8 @@ TEST_P(PrefetchFileBatchReaderImplTest, TestPrefetchWithPredicatePushdownWithCom
832841 PreparePrefetchReader (file_format, schema.get (), predicate,
833842 /* selection_bitmap=*/ std::nullopt ,
834843 /* batch_size=*/ 10 , /* prefetch_max_parallel_num=*/ 3 , cache_mode);
835- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
844+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
845+ reader->GetPreviousBatchFirstRowNumber ().value ());
836846 ASSERT_OK_AND_ASSIGN (auto result_array,
837847 ReadResultCollector::CollectResult (
838848 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -868,7 +878,8 @@ TEST_P(PrefetchFileBatchReaderImplTest,
868878 /* selection_bitmap=*/ std::nullopt ,
869879 /* batch_size=*/ 10 , /* prefetch_max_parallel_num=*/ 3 , cache_mode);
870880 ASSERT_OK (reader->RefreshReadRanges ());
871- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
881+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
882+ reader->GetPreviousBatchFirstRowNumber ().value ());
872883 ASSERT_OK_AND_ASSIGN (auto result_array,
873884 ReadResultCollector::CollectResult (
874885 reader.get (), /* max simulated data processing time*/ 100 ));
0 commit comments