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

Enormously large query is slow if it is being run from Merge table with huge number of tables. #32465

Open
alexey-milovidov opened this issue Dec 9, 2021 · 0 comments

Comments

@alexey-milovidov
Copy link
Member

SELECT uniqExact(order_customer_id), 
       uniqExact(order_customer_id), 
       sum(toInt64(visit_count)), 
       uniqExact(order_multiorder_id), 
       sum(toInt64(visit_count)), 
       sum(toInt64(visit_count)) AS sum_visit_count_ok, 
       sum(item_price_rub_numeric), 
       uniqExact(order_multiorder_id), 
       uniqExact(order_customer_id)
FROM cubes.cubes_clickhouse__cube_end2end_union 
WHERE (addDays(CAST(date, 'DATE'), -1 * (((7 + if( 
        toDayOfWeek(date) = 7, 1, 
        toDayOfWeek(date) + 1)) - 2) % 7)) >= toDateTime('2021-10-04 00:00:00')) 
  AND (addDays(CAST(date, 'DATE'), -1 * (((7 + if( 
        toDayOfWeek(date) = 7, 1, 
        toDayOfWeek(date) + 1)) - 2) % 7)) < toDateTime('2021-12-13 00:00:00'))
  /* crazy category filtering starts here */
  AND (((multiIf((position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                   cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                   cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                           'ymp_main-cat_dp_auto') > 0) OR (position(multiIf(
                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                     'ymp_cat_dp_auto') > 0) OR (position(multiIf(
                                                                                                                  cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                  cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                  cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                          'ymp_offer_dp_auto') >
                                                                                                 0), 'Авто', (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_main-cat_dp_bt') >
                                                                                                              0) OR
                                                                                                             (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_cat_dp_bt') >
                                                                                                              0) OR
                                                                                                             (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_offer_dp_bt') >
                                                                                                              0),
                 'Бытовая техника', (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                              'ymp_main-cat_dp_dacha') > 0) OR (position(multiIf(
                                                                                                 cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                 cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                 cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                         'ymp_cat_dp_dacha') > 0) OR
                                    (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                              'ymp_offer_dp_dacha') > 0), 'Дача, сад, огород', (position(multiIf(
                                                                                                                 cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                 cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                 cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                         'ymp_main-cat_dp_dety') >
                                                                                                0) OR (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_cat_dp_dety') >
                                                                                                       0) OR (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_offer_dp_dety') >
                                                                                                              0),
                 'Детские товары', (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                     cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                     cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                             'ymp_main-cat_dp_dom') > 0) OR (position(multiIf(
                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                      'ymp_cat_dp_dom') > 0) OR
                                   (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                     cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                     cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                             'ymp_offer_dp_dom') > 0), 'Товары для дома', (position(multiIf(
                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                    'ymp_main-cat_dp_dosug') >
                                                                                           0) OR (position(multiIf(
                                                                                                                   cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                   cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                   cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                           'ymp_cat_dp_dosug') >
                                                                                                  0) OR (position(
                                                                                                                 multiIf(
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                 'ymp_offer_dp_dosug') >
                                                                                                         0),
                 'Хобби и развлечения', (position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_main-cat_dp_elektronika') > 0) OR (position(multiIf(
                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                           cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                   'ymp_cat_dp_elektronika') >
                                                                                          0) OR (position(multiIf(
                                                                                                                  cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                  cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                  cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                          'ymp_offer_dp_elektronika') >
                                                                                                 0), 'Электроника',
                 (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                   cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                   cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                           'ymp_main-cat_dp_knigi') > 0) OR (position(multiIf(
                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                      'ymp_cat_dp_knigi') > 0) OR (position(multiIf(
                                                                                                                    cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                    cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                    cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                            'ymp_offer_dp_knigi') >
                                                                                                   0), 'Книги',
                 (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                   cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                   cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                           'ymp_main-cat_dp_komputer') > 0) OR (position(multiIf(
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                 cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                         'ymp_cat_dp_komputer') > 0) OR (position(
                                                                                                                 multiIf(
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                 'ymp_offer_dp_komputer') >
                                                                                                         0),
                 'Компьютерная техника', (position(multiIf(
                                                           cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                           cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                           cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                   'ymp_main-cat_dp_krasota') > 0) OR (position(multiIf(
                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                'ymp_cat_dp_krasota') >
                                                                                       0) OR (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_offer_dp_krasota') >
                                                                                              0), 'Красота', (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_main-cat_dp_oborudovanie') >
                                                                                                              0) OR
                                                                                                             (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_cat_dp_oborudovanie') >
                                                                                                              0) OR
                                                                                                             (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_offer_dp_oborudovanie') >
                                                                                                              0),
                 'Оборудование', (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                   cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                   cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                           'ymp_main-cat_dp_odezhda') > 0) OR (position(multiIf(
                                                                                                cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                        'ymp_cat_dp_odezhda') > 0) OR
                                 (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                   cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                   cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                           'ymp_offer_dp_odezhda') > 0), 'Одежда, аксессуары, обувь', (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_main-cat_dp_produkti') >
                                                                                                       0) OR (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_cat_dp_produkti') >
                                                                                                              0) OR
                                                                                                      (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_offer_dp_produkti') >
                                                                                                       0),
                 'Продукты и напитки', (position(multiIf(
                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                 'ymp_main-cat_dp_sport') > 0) OR (position(multiIf(
                                                                                                    cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                    cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                    cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                            'ymp_cat_dp_sport') > 0) OR
                                       (position(multiIf(
                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                 'ymp_offer_dp_sport') > 0), 'Спорт и отдых', (position(multiIf(
                                                                                                                cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                        'ymp_main-cat_dp_stroika') >
                                                                                               0) OR (position(multiIf(
                                                                                                                       cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                       cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                       cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                               'ymp_cat_dp_stroika') >
                                                                                                      0) OR (position(
                                                                                                                     multiIf(
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                     'ymp_offer_dp_stroika') >
                                                                                                             0),
                 'Строительство и ремонт', (position(multiIf(
                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                     'ymp_main-cat_dp_zdorovie') > 0) OR (position(multiIf(
                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                           cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                   'ymp_cat_dp_zdorovie') >
                                                                                          0) OR (position(multiIf(
                                                                                                                  cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                  cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                  cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                          'ymp_offer_dp_zdorovie') >
                                                                                                 0), 'Здоровье',
                 (position(multiIf(cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                   cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                   cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                           'ymp_main-cat_dp_zootovary') > 0) OR (position(multiIf(
                                                                                  cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                  cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                  cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                          'ymp_cat_dp_zootovary') > 0) OR (position(
                                                                                                                   multiIf(
                                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                           cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                   'ymp_offer_dp_zootovary') >
                                                                                                           0),
                 'Товары для животных', (position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_main-cat_dp_cvety') > 0) OR (position(multiIf(
                                                                                                     cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                     cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                     cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                             'ymp_cat_dp_cvety') > 0) OR
                                        (position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_offer_dp_cvety') > 0), 'Цветы', ' Нет категории') >=
         ' Нет категории') AND (multiIf((position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_main-cat_dp_auto') > 0) OR (position(multiIf(
                                                                                                    cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                    cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                    cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                            'ymp_cat_dp_auto') > 0) OR
                                        (position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_offer_dp_auto') > 0), 'Авто', (position(multiIf(
                                                                                                       cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                       cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                       cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                               'ymp_main-cat_dp_bt') >
                                                                                      0) OR (position(multiIf(
                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                      'ymp_cat_dp_bt') >
                                                                                             0) OR (position(multiIf(
                                                                                                                     cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                     cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                     cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                             'ymp_offer_dp_bt') >
                                                                                                    0),
                                        'Бытовая техника', (position(multiIf(
                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                     'ymp_main-cat_dp_dacha') > 0) OR (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_cat_dp_dacha') >
                                                                                                       0) OR (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_offer_dp_dacha') >
                                                                                                              0),
                                        'Дача, сад, огород', (position(multiIf(
                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                       'ymp_main-cat_dp_dety') > 0) OR (position(
                                                                                                                multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_cat_dp_dety') >
                                                                                                        0) OR (position(
                                                                                                                       multiIf(
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                       'ymp_offer_dp_dety') >
                                                                                                               0),
                                        'Детские товары', (position(multiIf(
                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                    'ymp_main-cat_dp_dom') > 0) OR (position(multiIf(
                                                                                                                     cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                     cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                     cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                             'ymp_cat_dp_dom') >
                                                                                                    0) OR (position(
                                                                                                                   multiIf(
                                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                           cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                   'ymp_offer_dp_dom') >
                                                                                                           0),
                                        'Товары для дома', (position(multiIf(
                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                     'ymp_main-cat_dp_dosug') > 0) OR (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_cat_dp_dosug') >
                                                                                                       0) OR (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_offer_dp_dosug') >
                                                                                                              0),
                                        'Хобби и развлечения', (position(multiIf(
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                 cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                         'ymp_main-cat_dp_elektronika') > 0) OR
                                                               (position(multiIf(
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                 cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                         'ymp_cat_dp_elektronika') > 0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_elektronika') >
                                                                                                            0),
                                        'Электроника', (position(multiIf(
                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                 'ymp_main-cat_dp_knigi') > 0) OR (position(multiIf(
                                                                                                                    cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                    cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                    cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                            'ymp_cat_dp_knigi') >
                                                                                                   0) OR (position(
                                                                                                                  multiIf(
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                  'ymp_offer_dp_knigi') >
                                                                                                          0), 'Книги',
                                        (position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_main-cat_dp_komputer') > 0) OR (position(multiIf(
                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                'ymp_cat_dp_komputer') >
                                                                                       0) OR (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_offer_dp_komputer') >
                                                                                              0),
                                        'Компьютерная техника', (position(multiIf(
                                                                                  cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                  cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                  cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                          'ymp_main-cat_dp_krasota') > 0) OR (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_cat_dp_krasota') >
                                                                                                              0) OR
                                                                (position(multiIf(
                                                                                  cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                  cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                  cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                          'ymp_offer_dp_krasota') > 0), 'Красота',
                                        (position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_main-cat_dp_oborudovanie') > 0) OR (position(multiIf(
                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                    'ymp_cat_dp_oborudovanie') >
                                                                                           0) OR (position(multiIf(
                                                                                                                   cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                   cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                   cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                           'ymp_offer_dp_oborudovanie') >
                                                                                                  0), 'Оборудование',
                                        (position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_main-cat_dp_odezhda') > 0) OR (position(multiIf(
                                                                                                       cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                       cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                       cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                               'ymp_cat_dp_odezhda') >
                                                                                      0) OR (position(multiIf(
                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                      'ymp_offer_dp_odezhda') >
                                                                                             0),
                                        'Одежда, аксессуары, обувь', (position(multiIf(
                                                                                       cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                       cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                       cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                               'ymp_main-cat_dp_produkti') > 0) OR
                                                                     (position(multiIf(
                                                                                       cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                       cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                       cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                               'ymp_cat_dp_produkti') > 0) OR (position(
                                                                                                                       multiIf(
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                       'ymp_offer_dp_produkti') >
                                                                                                               0),
                                        'Продукты и напитки', (position(multiIf(
                                                                                cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                        'ymp_main-cat_dp_sport') > 0) OR (position(
                                                                                                                  multiIf(
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                  'ymp_cat_dp_sport') >
                                                                                                          0) OR
                                                              (position(multiIf(
                                                                                cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                        'ymp_offer_dp_sport') > 0), 'Спорт и отдых',
                                        (position(multiIf(
                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                  'ymp_main-cat_dp_stroika') > 0) OR (position(multiIf(
                                                                                                       cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                       cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                       cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                               'ymp_cat_dp_stroika') >
                                                                                      0) OR (position(multiIf(
                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                      'ymp_offer_dp_stroika') >
                                                                                             0),
                                        'Строительство и ремонт', (position(multiIf(
                                                                                    cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                    cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                    cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                            'ymp_main-cat_dp_zdorovie') > 0) OR
                                                                  (position(multiIf(
                                                                                    cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                    cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                    cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                            'ymp_cat_dp_zdorovie') > 0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_zdorovie') >
                                                                                                            0),
                                        'Здоровье', (position(multiIf(
                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                              'ymp_main-cat_dp_zootovary') > 0) OR (position(multiIf(
                                                                                                                     cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                     cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                     cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                             'ymp_cat_dp_zootovary') >
                                                                                                    0) OR (position(
                                                                                                                   multiIf(
                                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                           cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                   'ymp_offer_dp_zootovary') >
                                                                                                           0),
                                        'Товары для животных', (position(multiIf(
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                 cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                         'ymp_main-cat_dp_cvety') > 0) OR (position(
                                                                                                                   multiIf(
                                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                           cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                           cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                   'ymp_cat_dp_cvety') >
                                                                                                           0) OR
                                                               (position(multiIf(
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                 cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                 cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                         'ymp_offer_dp_cvety') > 0), 'Цветы',
                                        ' Нет категории') <= 'Детские товары')) OR ((multiIf((position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_auto') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_auto') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_auto') >
                                                                                                            0), 'Авто',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_bt') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_bt') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_bt') >
                                                                                                            0),
                                                                                             'Бытовая техника',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_dacha') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_dacha') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_dacha') >
                                                                                                            0),
                                                                                             'Дача, сад, огород',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_dety') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_dety') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_dety') >
                                                                                                            0),
                                                                                             'Детские товары',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_dom') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_dom') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_dom') >
                                                                                                            0),
                                                                                             'Товары для дома',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_dosug') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_dosug') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_dosug') >
                                                                                                            0),
                                                                                             'Хобби и развлечения',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_elektronika') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_elektronika') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_elektronika') >
                                                                                                            0),
                                                                                             'Электроника', (position(
                                                                                                                     multiIf(
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                     'ymp_main-cat_dp_knigi') >
                                                                                                             0) OR
                                                                                                            (position(
                                                                                                                     multiIf(
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                     'ymp_cat_dp_knigi') >
                                                                                                             0) OR
                                                                                                            (position(
                                                                                                                     multiIf(
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                     'ymp_offer_dp_knigi') >
                                                                                                             0),
                                                                                             'Книги', (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_main-cat_dp_komputer') >
                                                                                                       0) OR (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_cat_dp_komputer') >
                                                                                                              0) OR
                                                                                                      (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_offer_dp_komputer') >
                                                                                                       0),
                                                                                             'Компьютерная техника',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_krasota') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_krasota') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_krasota') >
                                                                                                            0),
                                                                                             'Красота', (position(
                                                                                                                 multiIf(
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                 'ymp_main-cat_dp_oborudovanie') >
                                                                                                         0) OR
                                                                                                        (position(
                                                                                                                 multiIf(
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                 'ymp_cat_dp_oborudovanie') >
                                                                                                         0) OR
                                                                                                        (position(
                                                                                                                 multiIf(
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                 'ymp_offer_dp_oborudovanie') >
                                                                                                         0),
                                                                                             'Оборудование', (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_main-cat_dp_odezhda') >
                                                                                                              0) OR
                                                                                                             (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_cat_dp_odezhda') >
                                                                                                              0) OR
                                                                                                             (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_offer_dp_odezhda') >
                                                                                                              0),
                                                                                             'Одежда, аксессуары, обувь',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_produkti') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_produkti') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_produkti') >
                                                                                                            0),
                                                                                             'Продукты и напитки',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_sport') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_sport') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_sport') >
                                                                                                            0),
                                                                                             'Спорт и отдых', (position(
                                                                                                                       multiIf(
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                       'ymp_main-cat_dp_stroika') >
                                                                                                               0) OR
                                                                                                              (position(
                                                                                                                       multiIf(
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                       'ymp_cat_dp_stroika') >
                                                                                                               0) OR
                                                                                                              (position(
                                                                                                                       multiIf(
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                       'ymp_offer_dp_stroika') >
                                                                                                               0),
                                                                                             'Строительство и ремонт',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_zdorovie') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_zdorovie') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_zdorovie') >
                                                                                                            0),
                                                                                             'Здоровье', (position(
                                                                                                                  multiIf(
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                  'ymp_main-cat_dp_zootovary') >
                                                                                                          0) OR
                                                                                                         (position(
                                                                                                                  multiIf(
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                  'ymp_cat_dp_zootovary') >
                                                                                                          0) OR
                                                                                                         (position(
                                                                                                                  multiIf(
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                  'ymp_offer_dp_zootovary') >
                                                                                                          0),
                                                                                             'Товары для животных',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_cvety') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_cvety') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_cvety') >
                                                                                                            0), 'Цветы',
                                                                                             ' Нет категории') >=
                                                                                     'Компьютерная техника') AND
                                                                                    (multiIf((position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_auto') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_auto') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_auto') >
                                                                                                            0), 'Авто',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_bt') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_bt') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_bt') >
                                                                                                            0),
                                                                                             'Бытовая техника',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_dacha') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_dacha') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_dacha') >
                                                                                                            0),
                                                                                             'Дача, сад, огород',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_dety') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_dety') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_dety') >
                                                                                                            0),
                                                                                             'Детские товары',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_dom') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_dom') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_dom') >
                                                                                                            0),
                                                                                             'Товары для дома',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_dosug') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_dosug') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_dosug') >
                                                                                                            0),
                                                                                             'Хобби и развлечения',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_elektronika') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_elektronika') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_elektronika') >
                                                                                                            0),
                                                                                             'Электроника', (position(
                                                                                                                     multiIf(
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                     'ymp_main-cat_dp_knigi') >
                                                                                                             0) OR
                                                                                                            (position(
                                                                                                                     multiIf(
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                     'ymp_cat_dp_knigi') >
                                                                                                             0) OR
                                                                                                            (position(
                                                                                                                     multiIf(
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                             cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                             cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                     'ymp_offer_dp_knigi') >
                                                                                                             0),
                                                                                             'Книги', (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_main-cat_dp_komputer') >
                                                                                                       0) OR (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_cat_dp_komputer') >
                                                                                                              0) OR
                                                                                                      (position(multiIf(
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                        cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                        cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                'ymp_offer_dp_komputer') >
                                                                                                       0),
                                                                                             'Компьютерная техника',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_krasota') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_krasota') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_krasota') >
                                                                                                            0),
                                                                                             'Красота', (position(
                                                                                                                 multiIf(
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                 'ymp_main-cat_dp_oborudovanie') >
                                                                                                         0) OR
                                                                                                        (position(
                                                                                                                 multiIf(
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                 'ymp_cat_dp_oborudovanie') >
                                                                                                         0) OR
                                                                                                        (position(
                                                                                                                 multiIf(
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                         cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                         cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                 'ymp_offer_dp_oborudovanie') >
                                                                                                         0),
                                                                                             'Оборудование', (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_main-cat_dp_odezhda') >
                                                                                                              0) OR
                                                                                                             (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_cat_dp_odezhda') >
                                                                                                              0) OR
                                                                                                             (position(
                                                                                                                      multiIf(
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                              cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                              cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                      'ymp_offer_dp_odezhda') >
                                                                                                              0),
                                                                                             'Одежда, аксессуары, обувь',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_produkti') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_produkti') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_produkti') >
                                                                                                            0),
                                                                                             'Продукты и напитки',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_sport') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_sport') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_sport') >
                                                                                                            0),
                                                                                             'Спорт и отдых', (position(
                                                                                                                       multiIf(
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                       'ymp_main-cat_dp_stroika') >
                                                                                                               0) OR
                                                                                                              (position(
                                                                                                                       multiIf(
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                       'ymp_cat_dp_stroika') >
                                                                                                               0) OR
                                                                                                              (position(
                                                                                                                       multiIf(
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                       'ymp_offer_dp_stroika') >
                                                                                                               0),
                                                                                             'Строительство и ремонт',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_zdorovie') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_zdorovie') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_zdorovie') >
                                                                                                            0),
                                                                                             'Здоровье', (position(
                                                                                                                  multiIf(
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                  'ymp_main-cat_dp_zootovary') >
                                                                                                          0) OR
                                                                                                         (position(
                                                                                                                  multiIf(
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                  'ymp_cat_dp_zootovary') >
                                                                                                          0) OR
                                                                                                         (position(
                                                                                                                  multiIf(
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                          cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                          cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                  'ymp_offer_dp_zootovary') >
                                                                                                          0),
                                                                                             'Товары для животных',
                                                                                             (position(multiIf(
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                               cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                               cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                       'ymp_main-cat_dp_cvety') >
                                                                                              0) OR (position(multiIf(
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                      cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                      cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                              'ymp_cat_dp_cvety') >
                                                                                                     0) OR (position(
                                                                                                                    multiIf(
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_record_type = 'install',
                                                                                                                            cubes_clickhouse__cube_end2end_union.installation_source_path_new_tree_5,
                                                                                                                            cubes_clickhouse__cube_end2end_union.e2e_lsc_source_path_new_tree_5),
                                                                                                                    'ymp_offer_dp_cvety') >
                                                                                                            0), 'Цветы',
                                                                                             ' Нет категории') <=
                                                                                     'Электроника')))
  /* crazy category filtering ends here */
GROUP BY addDays(CAST(date, 'DATE'), -1 * (((7 + if( 
        toDayOfWeek(date) = 7, 1, 
        toDayOfWeek(date) + 1)) - 2) % 7));

(we have permission to publish this query)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant