Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_complex_expressions seems incorrect #388

Open
mailsmail opened this issue Mar 17, 2021 · 0 comments
Open

test_complex_expressions seems incorrect #388

mailsmail opened this issue Mar 17, 2021 · 0 comments

Comments

@mailsmail
Copy link

There are 3 different query inside test_complex_expressions and it said that these 3 query will have the same result.

# purpose of test that all where conditions create the same group of values, thus same result
res_s3select_substring = remove_xml_tags_from_result( run_s3select(bucket_name,csv_obj_name,'select min(int(_2)),max(int(_2)) from stdin where substring(_2,1,1) == "1"')).replace("\n","")
res_s3select_between_numbers = remove_xml_tags_from_result( run_s3select(bucket_name,csv_obj_name,'select min(int(_2)),max(int(_2)) from stdin where int(_2)>=100 and int(_2)<200')).replace("\n","")
res_s3select_eq_modolu = remove_xml_tags_from_result( run_s3select(bucket_name,csv_obj_name,'select min(int(_2)),max(int(_2)) from stdin where int(_2)/100 == 1 or int(_2)/10 == 1 or int(_2) == 1')).replace("\n","")

But, after inspecting it, I found that it will not have the same result. This test will create CSV object with 10,000 rows and 10 columns and random value between 0-1000. Which mean:

  • for the first query:
select min(int(_2)),max(int(_2)) from stdin where substring(_2,1,1) == "1"'

where clause is true for every number with "1" as their first digit such as: 1, 10-19, 100-199, and 1000. Thus, the min. value is 1 and max value is "1000".

  • for the second query:
select min(int(_2)),max(int(_2)) from stdin where int(_2)>=100 and int(_2)<200

where clause is true for numbers 100 - 200. So, the min value is 100 and max value is 199.

  • and for the last one:
select min(int(_2)),max(int(_2)) from stdin where int(_2)/100 == 1 or int(_2)/10 == 1 or int(_2) == 1'

where clause is true for every number that returns 1 when divided (integer division) with 100 or 10, or IS 1 (i.e. 1, 10-19, and 100-199). So, min value is 1 and max value is 199.

Is it a mistakes or maybe I'm missing something here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant