Я получаю следующую ошибку при запуске приведенного ниже кода в Hive:
04: 08: 12 [SELECT - 0 строк, 0,096 с] [Код: 40000, состояние SQL: 42000] Ошибка при компиляции оператора: СБОЙ: Строка SemanticException 0: -1 Несоответствие типа аргумента '' 2018-02-14 '': Выражения после WHEN должны иметь тот же тип, что и после CASE: ожидается "date", но найдено "boolean"
Select
case shipped_date
when shipped_date between cast ('2018-02-01' as date) and cast ('2018-02-14' as date) then 1
when shipped_date between cast ('2018-02-18' as date) and cast( '2018-03-03'as date) then 2
when shipped_date between cast ('2017-02-01' as date) and cast ('2017-02-14'as date) then 3
when shipped_date between cast ('2017-03-12' as date) and cast ('2017-03-25' as date) then 4
when shipped_date between cast('2018-04-30' as date) and cast ('2018-05-13'as date) then 5
when shipped_date between cast ('2018-03-27' as date) and cast('2018-04-09'as date) then 6
when shipped_date between cast('2017-04-28'as date) and cast ('2017-05-14'as date) then 7
when shipped_date between cast ('2017-03-26' as date) and cast ('2017-04-11' as date) then
end as test_period,department_name
from my_table;
Кто-нибудь знает, как решить эту ошибку?
Спасибо!