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"
@@ -281,7 +282,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestSimple) {
281282 /* enable_adaptive_prefetch_strategy=*/ false , executor_,
282283 /* initialize_read_ranges=*/ true , /* prefetch_cache_mode=*/ PrefetchCacheMode::ALWAYS ,
283284 CacheConfig (), GetDefaultPool ()));
284- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
285+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
286+ reader->GetPreviousBatchFirstRowNumber ().value ());
285287 ASSERT_OK_AND_ASSIGN (auto result_array,
286288 ReadResultCollector::CollectResult (
287289 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -603,7 +605,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestReadWithLargeBatchSize) {
603605 prefetch_max_parallel_num * 2 , /* enable_adaptive_prefetch_strategy=*/ false , executor_,
604606 /* initialize_read_ranges=*/ true , /* prefetch_cache_mode=*/ PrefetchCacheMode::ALWAYS ,
605607 CacheConfig (), GetDefaultPool ()));
606- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
608+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
609+ reader->GetPreviousBatchFirstRowNumber ().value ());
607610 ASSERT_OK_AND_ASSIGN (auto result_array,
608611 ReadResultCollector::CollectResult (
609612 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -631,7 +634,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestPartialReaderSuccessRead) {
631634 }
632635
633636 arrow::ArrayVector result_array_vector;
634- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
637+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
638+ reader->GetPreviousBatchFirstRowNumber ().value ());
635639 ASSERT_OK_AND_ASSIGN (auto batch_with_bitmap, reader->NextBatchWithBitmap ());
636640 auto & [batch, bitmap] = batch_with_bitmap;
637641 ASSERT_EQ (batch.first ->length , bitmap.Cardinality ());
@@ -676,9 +680,11 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestAllReaderFailedWithIOError) {
676680 ->SetNextBatchStatus (Status::IOError (" mock error" ));
677681 }
678682
679- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
683+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
684+ reader->GetPreviousBatchFirstRowNumber ().value ());
680685 auto batch_result = reader->NextBatchWithBitmap ();
681- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
686+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
687+ reader->GetPreviousBatchFirstRowNumber ().value ());
682688 ASSERT_FALSE (batch_result.ok ());
683689 ASSERT_TRUE (batch_result.status ().IsIOError ());
684690 ASSERT_FALSE (prefetch_reader->is_shutdown_ );
@@ -687,7 +693,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestAllReaderFailedWithIOError) {
687693
688694 // call NextBatch again, will still return error status
689695 auto batch_result2 = reader->NextBatchWithBitmap ();
690- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
696+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
697+ reader->GetPreviousBatchFirstRowNumber ().value ());
691698 ASSERT_FALSE (batch_result2.ok ());
692699 ASSERT_TRUE (batch_result2.status ().IsIOError ());
693700}
@@ -704,7 +711,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestPrefetchWithEmptyData) {
704711 prefetch_max_parallel_num * 2 , /* enable_adaptive_prefetch_strategy=*/ false , executor_,
705712 /* initialize_read_ranges=*/ true , /* prefetch_cache_mode=*/ PrefetchCacheMode::ALWAYS ,
706713 CacheConfig (), GetDefaultPool ()));
707- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
714+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
715+ reader->GetPreviousBatchFirstRowNumber ().value ());
708716 ASSERT_OK_AND_ASSIGN (auto result_array,
709717 ReadResultCollector::CollectResult (
710718 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -724,7 +732,8 @@ TEST_F(PrefetchFileBatchReaderImplTest, TestCallNextBatchAfterReadingEof) {
724732 prefetch_max_parallel_num * 2 , /* enable_adaptive_prefetch_strategy=*/ false , executor_,
725733 /* initialize_read_ranges=*/ true , /* prefetch_cache_mode=*/ PrefetchCacheMode::ALWAYS ,
726734 CacheConfig (), GetDefaultPool ()));
727- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
735+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
736+ reader->GetPreviousBatchFirstRowNumber ().value ());
728737 ASSERT_OK_AND_ASSIGN (auto result_array,
729738 ReadResultCollector::CollectResult (
730739 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -830,7 +839,8 @@ TEST_P(PrefetchFileBatchReaderImplTest, TestPrefetchWithPredicatePushdownWithCom
830839 PreparePrefetchReader (file_format, schema.get (), predicate,
831840 /* selection_bitmap=*/ std::nullopt ,
832841 /* batch_size=*/ 10 , /* prefetch_max_parallel_num=*/ 3 , cache_mode);
833- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
842+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
843+ reader->GetPreviousBatchFirstRowNumber ().value ());
834844 ASSERT_OK_AND_ASSIGN (auto result_array,
835845 ReadResultCollector::CollectResult (
836846 reader.get (), /* max simulated data processing time*/ 100 ));
@@ -866,7 +876,8 @@ TEST_P(PrefetchFileBatchReaderImplTest,
866876 /* selection_bitmap=*/ std::nullopt ,
867877 /* batch_size=*/ 10 , /* prefetch_max_parallel_num=*/ 3 , cache_mode);
868878 ASSERT_OK (reader->RefreshReadRanges ());
869- ASSERT_EQ (reader->GetPreviousBatchFirstRowNumber ().value (), -1 );
879+ ASSERT_EQ (std::numeric_limits<uint64_t >::max (),
880+ reader->GetPreviousBatchFirstRowNumber ().value ());
870881 ASSERT_OK_AND_ASSIGN (auto result_array,
871882 ReadResultCollector::CollectResult (
872883 reader.get (), /* max simulated data processing time*/ 100 ));
0 commit comments