sql - 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 行。
- 字段t.operation_date不可为空,但在列 operation_year 的结果查询中,我们得到 null
- 在 operation_month 我们得到未截断的时间戳
- 在 operation_day 我们从d.status_name获取字符串值
- 在 status_name 我们从t.operation_amount获得数字聚合
- 在 operation_amt 我们得到 null
当值跳转到其他列时,它看起来与 csv 文件的错误解析非常相似,但显然这里不是这种情况。我无法弄清楚这到底是怎么可能的。我是 Hadoop 的新手,显然我不知道导致问题的一些重要概念。
解决方案
推荐阅读
- dashboard - 我如何创建一个合适的金融银行仪表板
- spring-boot - spring boot i 文本错误
- linux - 如何使用 C 可执行文件运行 app_armor 配置文件
- node.js - 在这个 Node.js 反汇编程序库使用代码中,exampleRipHi 和 exampleRipLo 代表什么?
- javascript - 如果存在则更新对象内部的数组,否则将数组推送到对象
- java - 本地通知不显示 CodeNameOne
- java - 来自 Xamarin Android 项目的 JAR API -> Java.Lang.NullPointerException
- c++ - 正确读取 .wav 文件中的样本
- java - setRotation 改变 ImageView 的位置
- python - FileNotFoundError:6 个泄漏的信号量对象在关机时清理