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

Swith dq_file/hybrid_file to yt suites #13153

Merged
merged 3 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ydb/library/yql/tests/sql/dq_file.make
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DEPENDS(
)
DATA(
arcadia/ydb/library/yql/tests/sql # python files
arcadia/yql/essentials/tests/sql/suites
arcadia/yt/yql/tests/sql/suites
arcadia/yql/essentials/mount
arcadia/yql/essentials/cfg/tests
)
Expand Down
48 changes: 39 additions & 9 deletions ydb/library/yql/tests/sql/dq_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,46 @@
dump_table_yson, get_gateway_cfg_suffix, do_custom_query_check, normalize_result, \
stable_result_file, stable_table_file, is_with_final_result_issues, log

from test_utils import get_config, DATA_PATH
from test_utils import get_config
from test_file_common import run_file, run_file_no_cache

ASTDIFF_PATH = yql_binary_path('yql/essentials/tools/astdiff/astdiff')
DQRUN_PATH = yql_binary_path('ydb/library/yql/tools/dqrun/dqrun')
DATA_PATH = yatest.common.source_path('yt/yql/tests/sql/suites')


# TODO move to yql_utils
def is_sorted_table(table):
import cyson
assert table.attr is not None
for column in cyson.loads(table.attr)[b'schema']:
if b'sort_order' in column:
return True
return False


# TODO move to yql_utils
def is_unordered_result(res):
import cyson
path = res.results_file
assert os.path.exists(path)
with open(path, 'rb') as f:
res = f.read()
res = cyson.loads(res)
for r in res:
for data in r[b'Write']:
if b'Unordered' in data:
return True
return False


def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
if get_gateway_cfg_suffix() != '' and what != 'Results':
pytest.skip('non-trivial gateways.conf')
if (suite, case) in [('result_types','containers')]:
pytest.skip('TODO make sorted/stable dicts')

config = get_config(suite, case, cfg)
config = get_config(suite, case, cfg, data_path=DATA_PATH)

program_sql = os.path.join(DATA_PATH, suite, '%s.sql' % case)
with codecs.open(program_sql, encoding='utf-8') as program_file_descr:
Expand All @@ -41,17 +69,17 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
if is_with_final_result_issues(config):
extra_args += ["--with-final-issues"]

(res, tables_res) = run_file('dq', suite, case, cfg, config, yql_http_file_server, DQRUN_PATH, extra_args=extra_args)
(res, tables_res) = run_file('dq', suite, case, cfg, config, yql_http_file_server, DQRUN_PATH, extra_args=extra_args, data_path=DATA_PATH)

if what == 'Results' or force_blocks:
if not xfail:
if force_blocks:
yqlrun_res, yqlrun_tables_res = run_file_no_cache('dq', suite, case, cfg, config, yql_http_file_server, DQRUN_PATH, \
extra_args=["--emulate-yt"], force_blocks=True)
extra_args=["--emulate-yt"], force_blocks=True, data_path=DATA_PATH)
dq_result_name = 'Scalar'
yqlrun_result_name = 'Block'
else:
yqlrun_res, yqlrun_tables_res = run_file_no_cache('yt', suite, case, cfg, config, yql_http_file_server)
yqlrun_res, yqlrun_tables_res = run_file_no_cache('yt', suite, case, cfg, config, yql_http_file_server, data_path=DATA_PATH)
dq_result_name = 'DQFILE'
yqlrun_result_name = 'YQLRUN'

Expand All @@ -60,8 +88,8 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):

if os.path.exists(yqlrun_res.results_file):
assert os.path.exists(res.results_file)
dq_res_yson = normalize_result(stable_result_file(res), False)
yqlrun_res_yson = normalize_result(stable_result_file(yqlrun_res), False)
dq_res_yson = normalize_result(stable_result_file(res), is_unordered_result(res))
yqlrun_res_yson = normalize_result(stable_result_file(yqlrun_res), is_unordered_result(yqlrun_res))

# Compare results
assert dq_res_yson == yqlrun_res_yson, 'RESULTS_DIFFER\n' \
Expand All @@ -73,8 +101,10 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):

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)
dq_table_yson = dump_table_yson(stable_table_file(tables_res[table]), False)
yqlrun_table_yson = dump_table_yson(stable_table_file(yqlrun_tables_res[table]), \
not is_sorted_table(yqlrun_tables_res[table]))
dq_table_yson = dump_table_yson(stable_table_file(tables_res[table]), \
not is_sorted_table(tables_res[table]))

assert yqlrun_table_yson == dq_table_yson, \
'OUT_TABLE_DIFFER: %(table)s\n' \
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part0/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part1/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part10/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part11/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part12/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part13/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part14/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part15/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part16/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part17/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part18/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part19/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part2/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part3/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part4/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part5/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/tests/sql/dq_file/part6/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest
import yatest

from dq_file import run_test
from dq_file import run_test, DATA_PATH
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part


def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
return pytest_generate_tests_for_part(metafunc, current_part, part_count)
return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)


@pytest.mark.parametrize('what', ['Results', 'ForceBlocks'])
Expand Down
Loading
Loading