]> git.apps.os.sepia.ceph.com Git - s3-tests.git/commitdiff
a fix for empty results.for some of the queries 678/head
authorgal salomon <gal.salomon@gmail.com>
Tue, 29 Jul 2025 13:38:14 +0000 (16:38 +0300)
committergal salomon <gal.salomon@gmail.com>
Wed, 30 Jul 2025 05:35:53 +0000 (08:35 +0300)
an empty result that may rarely happen, could cause an assertion.
the fix handle that cases.

Signed-off-by: gal salomon <gal.salomon@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
s3tests_boto3/functional/test_s3select.py

index 1c0587adf894373f901c09718cdf4c7b9ab8025a..fdfb87c220560af94a3dfd40ce35442a7d6b486b 100644 (file)
@@ -506,11 +506,21 @@ def test_json_column_sum_min_max():
     res_s3select = remove_xml_tags_from_result(  run_s3select_json(bucket_name_2,json_obj_name_2,"select count(0),sum(_1.c1),sum(_1.c2) from s3object[*].root where (_1.c1-_1.c2) = 2;" ) )
     count,sum1,sum2 = res_s3select.split(",")
 
+    if int(count) == 0:
+        # it means that the where clause condition is not satisfied, so the sum should be 0(otherwise the null value will cause an error)
+          sum1 = 0
+          sum2 = 0
+
     s3select_assert_result( int(count)*2 , int(sum1)-int(sum2 ) )
 
     res_s3select = remove_xml_tags_from_result(  run_s3select_json(bucket_name,json_obj_name,"select count(0),sum(_1.c1),sum(_1.c2) from s3object[*].root where (_1.c1-_1.c2) = 4;" ) ) 
     count,sum1,sum2 = res_s3select.split(",")
 
+    if int(count) == 0:
+        # it means that the where clause condition is not satisfied, so the sum should be 0(otherwise the null value will cause an error)
+        sum1 = 0
+        sum2 = 0
+
     s3select_assert_result( int(count)*4 , int(sum1)-int(sum2) )
 
 @pytest.mark.s3select
@@ -613,11 +623,21 @@ def test_column_sum_min_max():
     res_s3select = remove_xml_tags_from_result(  run_s3select(bucket_name_2,csv_obj_name_2,"select count(0),sum(int(_1)),sum(int(_2)) from s3object where (int(_1)-int(_2)) = 2;" ) )
     count,sum1,sum2 = res_s3select.split(",")
 
+    if int(count) == 0:
+        # it could happen that the condition is not met, so the count is 0, thus the sums are 0
+        sum1 = 0
+        sum2 = 0
+
     s3select_assert_result( int(count)*2 , int(sum1)-int(sum2 ) )
 
     res_s3select = remove_xml_tags_from_result(  run_s3select(bucket_name,csv_obj_name,"select count(0),sum(int(_1)),sum(int(_2)) from s3object where (int(_1)-int(_2)) = 4;" ) ) 
     count,sum1,sum2 = res_s3select.split(",")
 
+    if int(count) == 0:
+        # it could happen that the condition is not met, so the count is 0, thus the sums are 0
+        sum1 = 0
+        sum2 = 0
+
     s3select_assert_result( int(count)*4 , int(sum1)-int(sum2) )
 
 @pytest.mark.s3select