Skip to content

Commit 545dcf7

Browse files
authored
Add query_prefix to query params and switch off grace join in tpcds s10 q72 (#12764)
1 parent 986dd0f commit 545dcf7

File tree

5 files changed

+41
-22
lines changed

5 files changed

+41
-22
lines changed

ydb/apps/ydb/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
* Replaced option `--query-settings` by `--query-prefix` one in `ydb workload <workload> run`.
22
* Added new options to `ydb workload topic`: --tx-commit-interval and --tx-commit-messages, allowing you to specify commit interval either in milliseconds or in number of messages written.
33
Also now you can load test YDB topics, using wide transactions that span over all partitions in the topic. This works both in write and in end-to-end workload scenarios.
44

ydb/public/lib/ydb_cli/commands/ydb_benchmark.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ void TWorkloadCommandBenchmark::Config(TConfig& config) {
3737
config.Opts->AddLongOption("plan", "Query plans report file name")
3838
.DefaultValue("")
3939
.StoreResult(&PlanFileName);
40-
config.Opts->AddLongOption("query-settings", "Query settings.\nEvery setting is a line that will be added to the beginning of each query. For multiple settings lines use this option several times.")
41-
.DefaultValue("")
40+
config.Opts->AddLongOption("query-settings")
41+
.AppendTo(&QuerySettings).Hidden();
42+
config.Opts->AddLongOption("query-prefix", "Query prefix.\nEvery prefix is a line that will be added to the beginning of each query. For multiple prefixes lines use this option several times.")
4243
.AppendTo(&QuerySettings);
44+
config.Opts->MutuallyExclusive("query-prefix", "query-settings");
4345
auto fillTestCases = [](TStringBuf line, std::function<void(ui32)>&& op) {
4446
for (const auto& token : StringSplitter(line).Split(',').SkipEmpty()) {
4547
TStringBuf part = token.Token();

ydb/tests/olap/lib/ydb_cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def __init__(self,
7272
timeout: float,
7373
check_canonical: CheckCanonicalPolicy,
7474
query_syntax: str,
75-
scale: Optional[int]):
75+
scale: Optional[int],
76+
query_prefix: Optional[str]):
7677
def _get_output_path(ext: str) -> str:
7778
return yatest.common.test_output_path(f'q{query_num}.{ext}')
7879

@@ -85,6 +86,7 @@ def _get_output_path(ext: str) -> str:
8586
self.check_canonical = check_canonical
8687
self.query_syntax = query_syntax
8788
self.scale = scale
89+
self.query_prefix = query_prefix
8890
self._nodes_info: dict[str, dict[str, int]] = {}
8991
self._plan_path = _get_output_path('plan')
9092
self._query_output_path = _get_output_path('out')
@@ -210,9 +212,8 @@ def _get_cmd(self) -> list[str]:
210212
'--global-timeout', f'{self.timeout}s',
211213
'--verbose'
212214
]
213-
query_preffix = get_external_param('query-prefix', '')
214-
if query_preffix:
215-
cmd += ['--query-settings', query_preffix]
215+
if self.query_prefix:
216+
cmd += ['--query-prefix', self.query_prefix]
216217
if self.check_canonical != CheckCanonicalPolicy.NO:
217218
cmd.append('--check-canonical')
218219
if self.query_syntax:
@@ -248,7 +249,7 @@ def process(self) -> YdbCliHelper.WorkloadRunResult:
248249
@staticmethod
249250
def workload_run(workload_type: WorkloadType, path: str, query_num: int, iterations: int = 5,
250251
timeout: float = 100., check_canonical: CheckCanonicalPolicy = CheckCanonicalPolicy.NO, query_syntax: str = '',
251-
scale: Optional[int] = None) -> YdbCliHelper.WorkloadRunResult:
252+
scale: Optional[int] = None, query_prefix=None) -> YdbCliHelper.WorkloadRunResult:
252253
return YdbCliHelper.WorkloadProcessor(
253254
workload_type,
254255
path,
@@ -257,5 +258,6 @@ def workload_run(workload_type: WorkloadType, path: str, query_num: int, iterati
257258
timeout,
258259
check_canonical,
259260
query_syntax,
260-
scale
261+
scale,
262+
query_prefix=query_prefix
261263
).process()

ydb/tests/olap/load/lib/conftest.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ydb.tests.olap.lib.ydb_cluster import YdbCluster
77
from ydb.tests.olap.lib.allure_utils import allure_test_description
88
from ydb.tests.olap.lib.results_processor import ResultsProcessor
9+
from ydb.tests.olap.lib.utils import get_external_param
910
from ydb.tests.olap.scenario.helpers.scenario_tests_helper import ScenarioTestHelper
1011
from time import time
1112
from typing import Optional
@@ -15,9 +16,10 @@
1516

1617
class LoadSuiteBase:
1718
class QuerySettings:
18-
def __init__(self, iterations: Optional[int] = None, timeout: Optional[float] = None) -> None:
19+
def __init__(self, iterations: Optional[int] = None, timeout: Optional[float] = None, query_prefix: Optional[str] = None) -> None:
1920
self.iterations = iterations
2021
self.timeout = timeout
22+
self.query_prefix = query_prefix
2123

2224
iterations: int = 5
2325
workload_type: WorkloadType = None
@@ -27,6 +29,7 @@ def __init__(self, iterations: Optional[int] = None, timeout: Optional[float] =
2729
query_syntax: str = ''
2830
query_settings: dict[int, LoadSuiteBase.QuerySettings] = {}
2931
scale: Optional[int] = None
32+
query_prefix: str = get_external_param('query-prefix', '')
3033

3134
@classmethod
3235
def suite(cls) -> str:
@@ -36,14 +39,20 @@ def suite(cls) -> str:
3639
return result
3740

3841
@classmethod
39-
def _get_iterations(cls, query_num: int) -> int:
40-
q = cls.query_settings.get(query_num, None)
41-
return q.iterations if q is not None and q.iterations is not None else cls.iterations
42-
43-
@classmethod
44-
def _get_timeout(cls, query_num: int) -> float:
45-
q = cls.query_settings.get(query_num, None)
46-
return q.timeout if q is not None and q.timeout is not None else cls.timeout
42+
def _get_query_settings(cls, query_num: int) -> QuerySettings:
43+
result = LoadSuiteBase.QuerySettings(
44+
iterations=cls.iterations,
45+
timeout=cls.timeout,
46+
query_prefix=cls.query_prefix
47+
)
48+
q = cls.query_settings.get(query_num, LoadSuiteBase.QuerySettings())
49+
if q.iterations is not None:
50+
result.iterations = q.iterations
51+
if q.timeout is not None:
52+
result.timeout = q.timeout
53+
if q.query_prefix is not None:
54+
result.query_prefix = q.query_prefix
55+
return result
4756

4857
@classmethod
4958
def _test_name(cls, query_num: int) -> str:
@@ -204,16 +213,18 @@ def run_workload_test(self, path: str, query_num: int) -> None:
204213
for param in allure_test_result.parameters:
205214
if param.name == 'query_num':
206215
param.mode = allure.parameter_mode.HIDDEN.value
216+
qparams = self._get_query_settings(query_num)
207217
start_time = time()
208218
result = YdbCliHelper.workload_run(
209219
path=path,
210220
query_num=query_num,
211-
iterations=self._get_iterations(query_num),
221+
iterations=qparams.iterations,
212222
workload_type=self.workload_type,
213-
timeout=self._get_timeout(query_num),
223+
timeout=qparams.timeout,
214224
check_canonical=self.check_canonical,
215225
query_syntax=self.query_syntax,
216-
scale=self.scale
226+
scale=self.scale,
227+
query_prefix=qparams.query_prefix
217228
)
218229
allure_test_description(self.suite(), self._test_name(query_num), refference_set=self.refference, start_time=start_time, end_time=time())
219-
self.process_query_result(result, query_num, self._get_iterations(query_num), True)
230+
self.process_query_result(result, query_num, qparams.iterations, True)

ydb/tests/olap/load/lib/tpcds.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class TestTpcds10(TpcdsSuiteBase):
7373
scale: int = 10
7474
check_canonical: bool = CheckCanonicalPolicy.WARNING
7575
timeout = max(TpcdsSuiteBase.timeout, 300.)
76+
query_settings = {
77+
# temporary, https://github.com/ydb-platform/ydb/issues/11767#issuecomment-2553353146
78+
72: LoadSuiteBase.QuerySettings(query_prefix='pragma ydb.UseGraceJoinCoreForMap = "false";'),
79+
}
7680
tables_size: dict[str, int] = {
7781
'call_center': 24,
7882
'catalog_page': 12000,

0 commit comments

Comments
 (0)