У меня есть таблицы кустов и представления поверх этих таблиц. При выполнении запроса к таблице с использованием условия where для столбцов разделов, я вижу из простого объяснения, что запрос использует столбец разделов. Но тот же запрос при запуске в представлении показывает, что из плана объяснения не используется ключ раздела.
Пожалуйста, предложите
Пример кода здесь, представления создаются в таблице со всеми столбцами, отфильтрованными по коду страны в предложении where (выберите *, где country_code = 'XX')
Запрос для таблицы
SELECT a.unique_id,
a.country_code,
a.rpt_prd,
a.abv_cut_off_scor_flag,
a.acct_und_promo_flag,
.
.
b.arrg_cob_dt,
b.arrg_id
from
a
inner join
b
on a.country_code = b.country_code
and a.product_code = b.product_code
and a.rpt_prd =b.rpt_prd
and a.unique_id =b.unique_id
and a.arrg_id = b.arrg_id
WHERE a.country_code='XX'
AND a.product_code = 'YYYYY'
AND a.rpt_prd ='20171231' ;
a
======================================
Partition Key for - a
PARTITIONED BY ( |
| `country_code` string, |
| `product_code` string, |
| `rpt_prd` string, |
| `unique_id` string)
b
=======================================
PARTITIONED BY ( |
| `country_code` string, |
| `product_code` string, |
| `rpt_prd` string, |
| `unique_id` string)
Query using Views:
===================
SELECT a.unique_id,
a.country_code,
a.rpt_prd,
a.abv_cut_off_scor_flag,
a.acct_und_promo_flag,
.
.
b.arrg_cob_dt,
b.arrg_id
from
a
inner join
b
on a.country_code = b.country_code
and a.product_code = b.product_code
and a.rpt_prd =b.rpt_prd
and a.unique_id =b.unique_id
and a.arrg_id = b.arrg_id
WHERE a.country_code='XX'
AND a.product_code = 'YYYYY'
AND a.rpt_prd ='20171231' ;