首页 > 解决方案 > Impala:结果查询中的值在错误的列中

问题描述

在我的结果查询中,值在错误的列中。

我的 SQL 查询是这样的:

create table some_database.table name as
select 
     extract(year from t.operation_date) operation_year,
     extract(month from t.operation_date) operation_month,
     extract(day from t.operation_date) operation_day,
     d.status_name,
     sum(t.operation_amount) operation_amt,
     current_timestamp() calculation_moment
from operations t
left join status_dict d on
     d.status_id = t.status_id
group by
     extract(year from t.operation_date) operation_year,
     extract(month from t.operation_date) operation_month,
     extract(day from t.operation_date) operation_day,
     d.status_name

(实际上,它更复杂,但主要思想是我正在聚合源表并进行一些连接。)

我得到的结果是:

# operation_year operation_month 操作日 状态名称 operation_amt
1 2021 1 1 成功 100
2 2021 1 1 成功 150
3 2021 1 2 成功 120
4 无效的 2021-01-01 21:53:00 成功 120 无效的

问题在第 4 行。

当值跳转到其他列时,它看起来与 csv 文件的错误解析非常相似,但显然这里不是这种情况。我无法弄清楚这到底是怎么可能的。我是 Hadoop 的新手,显然我不知道导致问题的一些重要概念。

标签: sqlhadoopimpala

解决方案


推荐阅读