如何在Cloudera中的create语句中重命名变量的属性?
CREATE TABLE new
STORED AS PARQUET AS
SELECT DISTINCT
customer_number,
created_at,
service
From old;
我想在变量' service'中重命名。 : 打电话给我=电话 给我发电子邮件=电子邮件
答案 0 :(得分:0)
您可以使用case
:
CREATE TABLE new STORED AS PARQUET AS
select distinct customer_number, created_at,
(case when service = 'Call me' then 'phone'
when service = 'Email me' then 'email'
else service
end) as service
from old;