@@ -508,8 +508,8 @@ def test_sea_result_set_with_multiple_chunks():
508508
509509 # Verify results using row IDs instead of row counts
510510 # Calculate the sum of rows from the manifest chunks
511- manifest_rows_sum = sum (chunk .get ('row_count' , 0 ) for chunk in manifest .get ('chunks' , []))
512- logger .info (f"Expected rows from manifest chunks: { manifest_rows_sum } " )
511+ total_rows_from_manifest = sum (chunk .get ('row_count' , 0 ) for chunk in manifest .get ('chunks' , []))
512+ logger .info (f"Expected rows from manifest chunks: { total_rows_from_manifest } " )
513513
514514 # Collect all row IDs to check for duplicates and completeness
515515 all_row_ids = set ()
@@ -561,7 +561,7 @@ def test_sea_result_set_with_multiple_chunks():
561561 logger .warning ("⚠️ Duplicate row IDs detected" )
562562
563563 # Check if we got all expected rows
564- if max_id == manifest_rows_sum :
564+ if max_id == total_rows_from_manifest :
565565 logger .info ("✅ Last row ID matches expected row count from manifest" )
566566
567567 # Let's try one more time with a fresh cursor to fetch all rows at once
@@ -603,7 +603,7 @@ def test_sea_result_set_with_multiple_chunks():
603603 logger .warning ("⚠️ Arrow results: Duplicate row IDs detected" )
604604
605605 # Compare with manifest row count
606- if arrow_max_id == manifest_rows_sum :
606+ if arrow_max_id == total_rows_from_manifest :
607607 logger .info ("✅ Arrow results: Last row ID matches expected row count from manifest" )
608608
609609 # Compare with sequential fetch results
@@ -619,8 +619,16 @@ def test_sea_result_set_with_multiple_chunks():
619619 logger .warning (f"IDs only in sequential fetch: { len (only_in_sequential )} rows" )
620620
621621 # Check if we got all rows
622- logger .info (f"Expected rows from manifest chunks: { manifest_rows_sum } " )
622+ total_rows_from_manifest = sum (chunk .get ('row_count' , 0 ) for chunk in manifest .get ('chunks' , []))
623+ logger .info (f"Expected rows from manifest chunks: { total_rows_from_manifest } " )
623624 logger .info (f"Actual rows in arrow table: { arrow_table .num_rows } " )
625+
626+ # Note: The server might return more rows than specified in the manifest due to query optimization
627+ # This is expected behavior and not an error
628+ if arrow_table .num_rows >= total_rows_from_manifest :
629+ logger .info ("✅ Retrieved at least as many rows as expected from the manifest" )
630+ else :
631+ logger .warning (f"⚠️ Retrieved fewer rows ({ arrow_table .num_rows } ) than expected from manifest ({ total_rows_from_manifest } )" )
624632 except Exception as e :
625633 logger .error (f"Error fetching all rows as Arrow: { e } " )
626634
0 commit comments