aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Stoyan <vvvv@ydb.tech>2024-04-13 19:17:43 +0300
committerGitHub <noreply@github.com>2024-04-13 19:17:43 +0300
commit0fd0d2a08bdae35d02f9bd71ef6a077841401394 (patch)
treeeb498391ecd7acdaab2fe15aa3515517af857c16
parent63210cb50e842832abf05dd2781da85f318265de (diff)
downloadydb-0fd0d2a08bdae35d02f9bd71ef6a077841401394.tar.gz
Check hybrid tables (#3713)
-rw-r--r--ydb/library/yql/tests/sql/hybrid_file.py50
-rw-r--r--ydb/library/yql/tests/sql/sql2yql/canondata/result.json6
-rw-r--r--ydb/library/yql/tests/sql/suites/produce/reduce_with_assume.sql1
3 files changed, 38 insertions, 19 deletions
diff --git a/ydb/library/yql/tests/sql/hybrid_file.py b/ydb/library/yql/tests/sql/hybrid_file.py
index e4af97b9f6e..f2120af4685 100644
--- a/ydb/library/yql/tests/sql/hybrid_file.py
+++ b/ydb/library/yql/tests/sql/hybrid_file.py
@@ -6,7 +6,8 @@ import re
import yatest.common
from yql_utils import replace_vals, yql_binary_path, is_xfail, get_param, \
- get_gateway_cfg_suffix, normalize_result, stable_result_file
+ get_gateway_cfg_suffix, normalize_result, stable_result_file, stable_table_file, \
+ dump_table_yson, normalize_source_code_path
from utils import get_config, DATA_PATH
from file_common import run_file, run_file_no_cache
@@ -32,26 +33,43 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
to_canonize = []
if what == 'Results':
+ if not xfail:
+ program_sql = os.path.join(DATA_PATH, suite, '%s.sql' % case)
+ with codecs.open(program_sql, encoding='utf-8') as program_file_descr:
+ sql_query = program_file_descr.read()
- program_sql = os.path.join(DATA_PATH, suite, '%s.sql' % case)
- with codecs.open(program_sql, encoding='utf-8') as program_file_descr:
- sql_query = program_file_descr.read()
+ # yqlrun run
+ yqlrun_res, yqlrun_tables_res = run_file_no_cache('yt', suite, case, cfg, config, yql_http_file_server)
+ hybrid_result_name = 'HYBRIDFILE'
+ yqlrun_result_name = 'YQLRUN'
- # yqlrun run
- yqlrun_res, yqlrun_tables_res = run_file_no_cache('yt', suite, case, cfg, config, yql_http_file_server)
- hybrid_result_name = 'HYBRIDFILE'
- yqlrun_result_name = 'YQLRUN'
+ if os.path.exists(yqlrun_res.results_file):
+ assert os.path.exists(res.results_file)
- if os.path.exists(yqlrun_res.results_file):
- assert os.path.exists(res.results_file)
+ hybrid_res_yson = normalize_result(stable_result_file(res), False)
+ yqlrun_res_yson = normalize_result(stable_result_file(yqlrun_res), False)
- hybrid_res_yson = normalize_result(stable_result_file(res), False)
- yqlrun_res_yson = normalize_result(stable_result_file(yqlrun_res), False)
+ # Compare results
+ assert hybrid_res_yson == yqlrun_res_yson, 'RESULTS_DIFFER\n' \
+ '%(hybrid_result_name)s result:\n %(hybrid_res_yson)s\n\n' \
+ '%(yqlrun_result_name)s result:\n %(yqlrun_res_yson)s\n' % locals()
+
+ for table in yqlrun_tables_res:
+ assert table in tables_res
+
+ if os.path.exists(yqlrun_tables_res[table].file):
+ assert os.path.exists(tables_res[table].file)
+ yqlrun_table_yson = dump_table_yson(stable_table_file(yqlrun_tables_res[table]), False)
+ hybrid_table_yson = dump_table_yson(stable_table_file(tables_res[table]), False)
+
+ assert yqlrun_table_yson == hybrid_table_yson, \
+ 'OUT_TABLE_DIFFER: %(table)s\n' \
+ '%(hybrid_result_name)s table:\n %(hybrid_table_yson)s\n\n' \
+ '%(yqlrun_result_name)s table:\n %(yqlrun_table_yson)s\n' % locals()
+
+ if res.std_err:
+ to_canonize.append(normalize_source_code_path(res.std_err))
- # Compare results
- assert hybrid_res_yson == yqlrun_res_yson, 'RESULTS_DIFFER\n' \
- '%(hybrid_result_name)s result:\n %(hybrid_res_yson)s\n\n' \
- '%(yqlrun_result_name)s result:\n %(yqlrun_res_yson)s\n' % locals()
return
if what == 'Plan':
diff --git a/ydb/library/yql/tests/sql/sql2yql/canondata/result.json b/ydb/library/yql/tests/sql/sql2yql/canondata/result.json
index c8a67dbedef..d8edcec11c1 100644
--- a/ydb/library/yql/tests/sql/sql2yql/canondata/result.json
+++ b/ydb/library/yql/tests/sql/sql2yql/canondata/result.json
@@ -29912,9 +29912,9 @@
],
"test_sql_format.test[produce-reduce_with_assume]": [
{
- "checksum": "f66b71a12b26ca4bc97619a3b43cbd5e",
- "size": 378,
- "uri": "https://{canondata_backend}/1880306/64654158d6bfb1289c66c626a8162239289559d0/resource.tar.gz#test_sql_format.test_produce-reduce_with_assume_/formatted.sql"
+ "checksum": "4daf2f046eb660f2a56a1f84928ee6c4",
+ "size": 412,
+ "uri": "https://{canondata_backend}/1917492/ff234d5884581cc297a96d70a1828b0d89366fd5/resource.tar.gz#test_sql_format.test_produce-reduce_with_assume_/formatted.sql"
}
],
"test_sql_format.test[produce-reduce_with_assume_in_subquery]": [
diff --git a/ydb/library/yql/tests/sql/suites/produce/reduce_with_assume.sql b/ydb/library/yql/tests/sql/suites/produce/reduce_with_assume.sql
index 3f51be0d124..b05403414c5 100644
--- a/ydb/library/yql/tests/sql/suites/produce/reduce_with_assume.sql
+++ b/ydb/library/yql/tests/sql/suites/produce/reduce_with_assume.sql
@@ -1,5 +1,6 @@
/* postgres can not */
/* multirun can not */
+/* hybridfile can not YQL-18225 */
/* syntax version 1 */
USE plato;