88 dump_table_yson , get_gateway_cfg_suffix , do_custom_query_check , normalize_result , \
99 stable_result_file , stable_table_file , is_with_final_result_issues , log
1010
11- from test_utils import get_config , DATA_PATH
11+ from test_utils import get_config
1212from test_file_common import run_file , run_file_no_cache
1313
1414ASTDIFF_PATH = yql_binary_path ('yql/essentials/tools/astdiff/astdiff' )
1515DQRUN_PATH = yql_binary_path ('ydb/library/yql/tools/dqrun/dqrun' )
16+ DATA_PATH = yatest .common .source_path ('yt/yql/tests/sql/suites' )
17+
18+
19+ # TODO move to yql_utils
20+ def is_sorted_table (table ):
21+ import cyson
22+ assert table .attr is not None
23+ for column in cyson .loads (table .attr )[b'schema' ]:
24+ if b'sort_order' in column :
25+ return True
26+ return False
27+
28+
29+ # TODO move to yql_utils
30+ def is_unordered_result (res ):
31+ import cyson
32+ path = res .results_file
33+ assert os .path .exists (path )
34+ with open (path , 'rb' ) as f :
35+ res = f .read ()
36+ res = cyson .loads (res )
37+ for r in res :
38+ for data in r [b'Write' ]:
39+ if b'Unordered' in data :
40+ return True
41+ return False
1642
1743
1844def run_test (suite , case , cfg , tmpdir , what , yql_http_file_server ):
1945 if get_gateway_cfg_suffix () != '' and what != 'Results' :
2046 pytest .skip ('non-trivial gateways.conf' )
47+ if (suite , case ) in [('result_types' ,'containers' )]:
48+ pytest .skip ('TODO make sorted/stable dicts' )
2149
22- config = get_config (suite , case , cfg )
50+ config = get_config (suite , case , cfg , data_path = DATA_PATH )
2351
2452 program_sql = os .path .join (DATA_PATH , suite , '%s.sql' % case )
2553 with codecs .open (program_sql , encoding = 'utf-8' ) as program_file_descr :
@@ -41,17 +69,17 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
4169 if is_with_final_result_issues (config ):
4270 extra_args += ["--with-final-issues" ]
4371
44- (res , tables_res ) = run_file ('dq' , suite , case , cfg , config , yql_http_file_server , DQRUN_PATH , extra_args = extra_args )
72+ (res , tables_res ) = run_file ('dq' , suite , case , cfg , config , yql_http_file_server , DQRUN_PATH , extra_args = extra_args , data_path = DATA_PATH )
4573
4674 if what == 'Results' or force_blocks :
4775 if not xfail :
4876 if force_blocks :
4977 yqlrun_res , yqlrun_tables_res = run_file_no_cache ('dq' , suite , case , cfg , config , yql_http_file_server , DQRUN_PATH , \
50- extra_args = ["--emulate-yt" ], force_blocks = True )
78+ extra_args = ["--emulate-yt" ], force_blocks = True , data_path = DATA_PATH )
5179 dq_result_name = 'Scalar'
5280 yqlrun_result_name = 'Block'
5381 else :
54- yqlrun_res , yqlrun_tables_res = run_file_no_cache ('yt' , suite , case , cfg , config , yql_http_file_server )
82+ yqlrun_res , yqlrun_tables_res = run_file_no_cache ('yt' , suite , case , cfg , config , yql_http_file_server , data_path = DATA_PATH )
5583 dq_result_name = 'DQFILE'
5684 yqlrun_result_name = 'YQLRUN'
5785
@@ -60,8 +88,8 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
6088
6189 if os .path .exists (yqlrun_res .results_file ):
6290 assert os .path .exists (res .results_file )
63- dq_res_yson = normalize_result (stable_result_file (res ), False )
64- yqlrun_res_yson = normalize_result (stable_result_file (yqlrun_res ), False )
91+ dq_res_yson = normalize_result (stable_result_file (res ), is_unordered_result ( res ) )
92+ yqlrun_res_yson = normalize_result (stable_result_file (yqlrun_res ), is_unordered_result ( yqlrun_res ) )
6593
6694 # Compare results
6795 assert dq_res_yson == yqlrun_res_yson , 'RESULTS_DIFFER\n ' \
@@ -73,8 +101,10 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
73101
74102 if os .path .exists (yqlrun_tables_res [table ].file ):
75103 assert os .path .exists (tables_res [table ].file )
76- yqlrun_table_yson = dump_table_yson (stable_table_file (yqlrun_tables_res [table ]), False )
77- dq_table_yson = dump_table_yson (stable_table_file (tables_res [table ]), False )
104+ yqlrun_table_yson = dump_table_yson (stable_table_file (yqlrun_tables_res [table ]), \
105+ not is_sorted_table (yqlrun_tables_res [table ]))
106+ dq_table_yson = dump_table_yson (stable_table_file (tables_res [table ]), \
107+ not is_sorted_table (tables_res [table ]))
78108
79109 assert yqlrun_table_yson == dq_table_yson , \
80110 'OUT_TABLE_DIFFER: %(table)s\n ' \
0 commit comments