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 stdin where (int(_1)-int(_2)) == 2;"))
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select count(0),sum(int(_1)),sum(int(_2)) from stdin where (int(_1)-int(_2)) == 4;"))
res_s3select_nullif=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select count(0) from stdin where nullif(_1,_2) is null ;")).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select count(0) from stdin where _1 == _2 ;")).replace("\n","")
res_s3select_nullif=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select count(0) from stdin where not nullif(_1,_2) is null ;")).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select count(0) from stdin where _1 != _2 ;")).replace("\n","")
res_s3select_nullif=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select count(0) from stdin where nullif(_1,_2) == _1 ;")).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select count(0) from stdin where _1 != _2 ;")).replace("\n","")
res_s3select_in=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select int(_1) from stdin where int(_1) in(1,0);')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select int(_1) from stdin where int(_1) == 1 or int(_1) == 0;')).replace("\n","")
res_s3select_in=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select int(_2) from stdin where int(_2) in(1,0,2);')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select int(_2) from stdin where int(_2) == 1 or int(_2) == 0 or int(_2) == 2;')).replace("\n","")
res_s3select_in=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select int(_2) from stdin where int(_2)*2 in(int(_3)*2,int(_4)*3,int(_5)*5);')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select int(_2) from stdin where int(_2)*2 == int(_3)*2 or int(_2)*2 == int(_4)*3 or int(_2)*2 == int(_5)*5;')).replace("\n","")
res_s3select_in=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select int(_1) from stdin where character_length(_1) == 2 and substr(_1,2,1) in ("3");')).replace("\n","")
res_s3select_in=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where _1 like "%aeio%";')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where substr(_1,11,4) == "aeio" ;')).replace("\n","")
res_s3select_in=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where _1 like "cbcd%";')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where substr(_1,1,4) == "cbcd";')).replace("\n","")
res_s3select_in=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where _3 like "%y[y-z]";')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where substr(_3,char_length(_3),1) between "y" and "z" and substr(_3,char_length(_3)-1,1) == "y";')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where substr(_2,char_length(_2),1) == "z" and substr(_2,char_length(_2)-1,1) == "y";')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where substr(_3,char_length(_3),1) == "z" and substr(_3,1,1) == "c";')).replace("\n","")
res_s3select_in=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where _2 like "%xy_";')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from stdin where substr(_2,char_length(_2)-1,1) == "y" and substr(_2,char_length(_2)-2,1) == "x";')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select min(int(_1)),max(int(_2)),min(int(_3))+1 from stdin;")).replace("\n","")
# purpose of test that all where conditions create the same group of values, thus same result
res_s3select_substr=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select min(int(_2)),max(int(_2)) from stdin where substr(_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","")
res_s3select_alias=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select int(_1) as a1, int(_2) as a2 , (a1+a2) as a3 from stdin where a3>100 and a3<300;")).replace(",","")
res_s3select_no_alias=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select int(_1),int(_2),int(_1)+int(_2) from stdin where (int(_1)+int(_2))>100 and (int(_1)+int(_2))<300;")).replace(",","")
res_s3select_alias=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select int(_1) as a1,int(_2) as a2, a1+a4 as a3, a5+a1 as a4, int(_3)+a3 as a5 from stdin;"))
res_s3select_date_time=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(0) from stdin where extract("year",timestamp(_1)) > 1950 and extract("year",timestamp(_1)) < 1960;'))
res_s3select_substr=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(0) from stdin where int(substr(_1,1,4))>1950 and int(substr(_1,1,4))<1960;'))
res_s3select_date_time=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(0) from stdin where datediff("month",timestamp(_1),dateadd("month",2,timestamp(_1)) ) == 2;'))
res_s3select_count=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(0) from stdin;'))
# validate that utcnow is integrate correctly with other date-time functions
res_s3select_date_time_utcnow=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(0) from stdin where datediff("hours",utcnow(),dateadd("day",1,utcnow())) == 24 ;'))
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select min(int(_1)),max(int(_2)),min(int(_3))+1 from stdin;","|","\t")).replace("\n","")
res_multiple_defintion=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select c1,c10,int(c11) from stdin;",csv_header_info="USE")).replace("\n","")
assertres_multiple_defintion.find("alias {c11} or column not exist in schema")>0
res_multiple_defintion=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,"select int(c1)+int(c2) as c4,c4 from stdin;",csv_header_info="USE")).replace("\n","")
assertres_multiple_defintion.find("multiple definition of column {c4} as schema-column and alias")>0
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select case when cast(_1 as int)>100 and cast(_1 as int)<200 than "(100-200)" when cast(_1 as int)>200 and cast(_1 as int)<300 than "(200-300)" else "NONE" end from s3object;')).replace("\n","")
count1=res_s3select.count("(100-200)")
count2=res_s3select.count("(200-300)")
count3=res_s3select.count("NONE")
res=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where cast(_1 as int)>100 and cast(_1 as int)<200 ;')).replace("\n","")
res1=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where cast(_1 as int)>200 and cast(_1 as int)<300 ;')).replace("\n","")
res2=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where cast(_1 as int)<=100 or cast(_1 as int)>=300 or cast(_1 as int)==200 ;')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where char_length(_3)>2 and char_length(_4)>2 and cast(substr(_3,1,2) as int) == cast(substr(_4,1,2) as int);')).replace("\n","")
res_null=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where cast(_3 as int)>99 and cast(_4 as int)>99 and coalesce(nullif(cast(substr(_3,1,2) as int),cast(substr(_4,1,2) as int)),7) == 7;')).replace("\n","")
nose.tools.assert_equal(res_s3select,res_null)
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select coalesce(nullif(_5,_5),nullif(_1,_1),_2) from stdin;')).replace("\n","")
res_coalesce=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select coalesce(_2) from stdin;')).replace("\n","")
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where cast(_3 as int)>999;')).replace("\n","")
res=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where char_length(_3)>3;')).replace("\n","")
nose.tools.assert_equal(res_s3select,res)
res_s3select=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where cast(_3 as int)>99 and cast(_3 as int)<1000;')).replace("\n","")
res=remove_xml_tags_from_result(run_s3select(bucket_name,csv_obj_name,'select count(*) from s3object where char_length(_3)==3;')).replace("\n","")