|
| 1 | +from runner import AbstractRunner |
| 2 | + |
| 3 | +# not clean but working way to remove argument from parser |
| 4 | +def remove_argunemt(parser, argument): |
| 5 | + for action in parser._actions: |
| 6 | + if argument in vars(action)['option_strings']: |
| 7 | + parser._handle_conflict_resolve(None, [(argument, action)]) |
| 8 | + break |
| 9 | + |
| 10 | + |
| 11 | +class Runner(AbstractRunner): |
| 12 | + def __init__(self, enable_spilling): |
| 13 | + self._enable_spilling = enable_spilling |
| 14 | + super().__init__() |
| 15 | + self.name = 'test' |
| 16 | + |
| 17 | + def init_args_parser(self): |
| 18 | + parser = super().init_args_parser() |
| 19 | + remove_argunemt(parser, "--enable-spilling") |
| 20 | + return parser |
| 21 | + |
| 22 | + @property |
| 23 | + def modes(self): |
| 24 | + return [ |
| 25 | + 'ds_1_scalar', 'ds_1_block', 'ds_1_scalar_pg', |
| 26 | + 'ds_10_scalar', 'ds_10_block', 'ds_10_scalar_pg', |
| 27 | + 'ds_100_scalar', 'ds_100_block', 'ds_100_scalar_pg', |
| 28 | + 'h_1_scalar', 'h_1_block', 'h_1_scalar_pg', 'h_10_scalar', 'h_10_block', 'h_10_scalar_pg', |
| 29 | + 'h_100_scalar', 'h_100_block', 'h_100_scalar_pg' |
| 30 | + ] |
| 31 | + |
| 32 | + @property |
| 33 | + def timeout_seconds(self): |
| 34 | + return 30000 |
| 35 | + |
| 36 | + @property |
| 37 | + def udfs(self): |
| 38 | + return ['set', 'datetime2', 'url_base', 're2', 'math', 'unicode_base'] |
| 39 | + |
| 40 | + @property |
| 41 | + def files(self): |
| 42 | + return super().files + [ |
| 43 | + 'contrib/ydb/library/yql/udfs/common/set/libset_udf.so', |
| 44 | + 'contrib/ydb/library/yql/udfs/common/datetime2/libdatetime2_udf.so', |
| 45 | + 'contrib/ydb/library/yql/udfs/common/url_base/liburl_udf.so', |
| 46 | + 'contrib/ydb/library/yql/udfs/common/re2/libre2_udf.so', |
| 47 | + 'contrib/ydb/library/yql/udfs/common/math/libmath_udf.so', |
| 48 | + 'contrib/ydb/library/yql/udfs/common/unicode_base/libunicode_udf.so', |
| 49 | + f'yql/queries/tpc_benchmark/{self.download_file}', |
| 50 | + 'yql/queries/tpc_benchmark/download_lib.sh', |
| 51 | + 'yql/queries/tpc_benchmark/download_tables.sh', |
| 52 | + 'yql/queries/tpc_benchmark/download_tpcds_tables.sh', |
| 53 | + ] |
| 54 | + |
| 55 | + @property |
| 56 | + def dirs(self): |
| 57 | + return [] |
| 58 | + |
| 59 | + @property |
| 60 | + def download_file(self): |
| 61 | + if self.scale == '100': |
| 62 | + name = f"download_files_{self.test}_100.sh" |
| 63 | + elif self.scale == '10': |
| 64 | + name = f"download_files_{self.test}_10.sh" |
| 65 | + elif self.scale == '1': |
| 66 | + name = f"download_files_{self.test}_1.sh" |
| 67 | + else: |
| 68 | + raise ValueError(f'Unknown scale: {self.scale}') |
| 69 | + return name |
| 70 | + |
| 71 | + @property |
| 72 | + def arcadia_run_dir(self): |
| 73 | + return 'yql/queries/tpc_benchmark' |
| 74 | + |
| 75 | + @property |
| 76 | + def enable_spilling(self): |
| 77 | + return self._enable_spilling |
| 78 | + |
| 79 | + def get_nums(self): |
| 80 | + if self.test == 'h': |
| 81 | + return list(range(1, 23)) |
| 82 | + elif self.test == 'ds': |
| 83 | + if self.name.endswith("_pg"): |
| 84 | + black_list = { |
| 85 | + 57, # ERROR: invalid digit in external "numeric" value |
| 86 | + 58, # Bad packed data. Invalid embedded size |
| 87 | + 72, # Execution timeout |
| 88 | + 83, # Bad packed data. Invalid embedded size |
| 89 | + } |
| 90 | + else: |
| 91 | + black_list = { |
| 92 | + 14, # OOM |
| 93 | + 23, # OOM |
| 94 | + 32, # timeout |
| 95 | + 72, # OOM |
| 96 | + } |
| 97 | + return list(set(range(1, 100)).difference(black_list)) |
| 98 | + else: |
| 99 | + raise ValueError(f'Unknown test: {self.test}') |
| 100 | + |
| 101 | + def decode_mode(self, mode): |
| 102 | + self.syntax = "yql" |
| 103 | + self.test = "h" |
| 104 | + if mode.startswith('h_'): |
| 105 | + self.cases_dir = 'h/yql' |
| 106 | + self.bindings_file = 'bindings.json' |
| 107 | + elif mode.startswith('ds_'): |
| 108 | + self.cases_dir = 'ds/yql' |
| 109 | + if self.args.decimal: |
| 110 | + self.bindings_file = 'bindings_tpcds_decimal.json' |
| 111 | + else: |
| 112 | + self.bindings_file = 'bindings_tpcds.json' |
| 113 | + self.test = "ds" |
| 114 | + else: |
| 115 | + raise ValueError(f'Unknown mode: {mode}') |
| 116 | + |
| 117 | + if mode.startswith(('ds_1', 'h_1', 'h_10', 'h_100')): |
| 118 | + name, scale, mode = mode.split('_', 2) |
| 119 | + self.name = f'{name}_{scale}' |
| 120 | + self.scale = scale |
| 121 | + self.mode = mode |
| 122 | + else: |
| 123 | + raise ValueError('Unknown mode: {mode}') |
| 124 | + |
| 125 | + if mode == 'scalar': |
| 126 | + self.pragmas_path = "pragmas_scalar.yql" |
| 127 | + self.name += '_yql' |
| 128 | + elif mode == 'scalar_pg': |
| 129 | + self.syntax = "pg" |
| 130 | + self.pragmas_path = "pragmas_scalar_pg.yql" |
| 131 | + self.name += "_yql_pg" |
| 132 | + self.cases_dir = f"{self.test}/pg" |
| 133 | + if self.test == 'h': |
| 134 | + self.bindings_file = 'bindings_pg.json' |
| 135 | + else: |
| 136 | + self.bindings_file = 'bindings_tpcds_pg.json' |
| 137 | + elif mode == 'block': |
| 138 | + self.pragmas_path = "pragmas_block.yql" |
| 139 | + self.name += '_yql_blocks' |
| 140 | + |
| 141 | + if self.enable_spilling: |
| 142 | + self.name += "_spilling" |
| 143 | + |
| 144 | + self.data_path = f"{self.test}/{self.scale}" |
| 145 | + |
| 146 | + |
| 147 | +def main(): |
| 148 | + print("With spilling") |
| 149 | + Runner(True).run() |
| 150 | + print("No spilling") |
| 151 | + Runner(False).run() |
| 152 | + |
| 153 | + |
| 154 | + # run compare_results |
0 commit comments