Inceptor [Code: 40000, SQL State: 42000] COMPILE FAILED: Internal error NullPointerException: [Error 40000] java.lang.NullPointerException
下面代码报空指针
with `__all_dim__` as (
select
*
from (
select
from_unixtime(unix_timestamp(`__bts__`) -1,'yyyy-MM-dd HH:mm:ss') as `__bts__`
from (
select
concat_ws(' ', `d`.`date`, `t`.`time_of_day`) as `__bts__`
from `ecmp`.`dim_date` as `d`
left join `ecmp`.`dim_time_of_day` as `t` on 1 = 1
where
`d`.`date` >= '2020-01-12'
and `d`.`date` <= '2020-01-13'
) as `__bts___tp1`
where
`__bts__` > '2020-01-12 00:00:00'
and `__bts__` <= '2020-01-13 00:00:00'
and second(`__bts__`) = 0
and minute(`__bts__`) = 0
and hour(`__bts__`) = 0
and pmod(day(`__bts__`), 1) = 0
) as `__time_model__`
cross join (
select
`dd_59282`.`tenant_pk` as `tenant_pk`,
`dd_59282`.`tenant_id` as `tenant_id`,
`dd_59282`.`tenant_name` as `tenant_name`
from `ecmp`.`dim_tenant` as `dd_59282`
) as `tenant_pk`
cross join (
select
'Fatal' as incident_level from system.dual
union all
select
'Error' as incident_level from system.dual
union all
select
'Warning' as incident_level from system.dual
union all
select
'Info' as incident_level from system.dual
) as `incident_level`
)
,`t` as (
select
`tenant_pk`,
`incident_accept_violation_count`,
`incident_level`,
rank() over( partition by `incident_level` order by `incident_accept_violation_count` DESC) as `incident_accept_violation_count_rank`,
rank() over( partition by `incident_level` order by `incident_accept_violation_count` ASC) as `__inverse_rank__`
from (
select
`__all_dim__`.*,-- 经排查发现表名加单引号再.*就是会报空指针,去掉表名的单引号后该问题解决
CAST(round(nvl(`incident_accept_violation_count`, 0), 0) as INT) as `incident_accept_violation_count`
from `__all_dim__`
left join (
select
`incident_level`,
`tenant_pk`,
count(*) as `incident_accept_violation_count`
from `ecmp`.dwd_incident_accept
where
incident_accept_violation_flag = '违规'
and `incident_accept_time` >= '2020-01-12 00:00:00'
AND `incident_accept_time` <= '2020-01-12 23:59:59'
group by
`incident_level`,
`tenant_pk`
) as `t1` on 1 = 1
and `__all_dim__`.`tenant_pk` = `t1`.`tenant_pk`
and `__all_dim__`.`incident_level` = `t1`.`incident_level`
) as `t0`
) select
`__all_dim__`.`__bts__` as `__bts__`,
CAST(SYSDATE as STRING) as `__cts__`,
CAST(dround(nvl(`incident_accept_violation_count`, 0), 0) as INT) as `incident_accept_violation_count`,
CAST(dround(`incident_accept_violation_count_rank`, 0) as INT) as `incident_accept_violation_count_rank`,
CAST(dround(`incident_accept_violation_count_win_rate`, 1) as DOUBLE) as `incident_accept_violation_count_win_rate`,
`__all_dim__`.`incident_level` as `incident_level`,
`__all_dim__`.`tenant_id` as `tenant_id`,
`__all_dim__`.`tenant_name` as `tenant_name`,
`__all_dim__`.`tenant_pk` as `tenant_pk`
from `__all_dim__`
left join (
select
'2020-01-12 23:59:59' as `__bts__`,
`incident_accept_violation_count`,
`incident_accept_violation_count_rank`,
`incident_accept_violation_count_win_rate`,
CAST(coalesce(`tp1`.`incident_level`) as STRING) as `incident_level`,
CAST(coalesce(`tp1`.`tenant_pk`) as STRING) as `tenant_pk`
from (
select
`t`.`tenant_pk`,
`t`.`incident_level`,
`t`.`incident_accept_violation_count`,
`t`.`incident_accept_violation_count_rank`,
if(`c`.ct = 1,null,(`__inverse_rank__` -1) /(`c`.ct -1) * 100) as `incident_accept_violation_count_win_rate`
from `t`
left join (
select
`incident_level`,
count(*) as `ct`
from `t`
group by
`incident_level`
) as `c` on 1 = 1
and `t`.`incident_level` = `c`.`incident_level`
) as `tp1`
) as `__dws__` on `__all_dim__`.`__bts__` = `__dws__`.`__bts__`
and `__all_dim__`.`tenant_pk` = `__dws__`.`tenant_pk`
and `__all_dim__`.`incident_level` = `__dws__`.`incident_level`;
然后修改后直接SELECT * FROM t;是没有问题的,但是用先有的select报错
[Code: 10009, SQL State: 42000] COMPILE FAILED: Semantic error: [Error 10009] Line 54:8 Invalid table alias. Error encountered near token 'all_dim'
with alldim as (
select
*
from (
select
from_unixtime(unix_timestamp(`__bts__`) -1,'yyyy-MM-dd HH:mm:ss') as `__bts__`
from (
select
concat_ws(' ', `d`.`date`, t.`time_of_day`) as `__bts__`
from `ecmp`.`dim_date` as `d`
left join `ecmp`.`dim_time_of_day` as t on 1 = 1
where
`d`.`date` >= '2020-01-12'
and `d`.`date` <= '2020-01-13'
) as `__bts___tp1`
where
`__bts__` > '2020-01-12 00:00:00'
and `__bts__` <= '2020-01-13 00:00:00'
and second(`__bts__`) = 0
and minute(`__bts__`) = 0
and hour(`__bts__`) = 0
and pmod(day(`__bts__`), 1) = 0
) as `__time_model__`
cross join (
select
`dd_59282`.`tenant_pk` as `tenant_pk`,
`dd_59282`.`tenant_id` as `tenant_id`,
`dd_59282`.`tenant_name` as `tenant_name`
from `ecmp`.`dim_tenant` as `dd_59282`
) as `tenant_pk`
cross join (
select
'Fatal' as incident_level from system.dual
union all
select
'Error' as incident_level from system.dual
union all
select
'Warning' as incident_level from system.dual
union all
select
'Info' as incident_level from system.dual
) as `incident_level`
)
, t as (
select
`tenant_pk`,
`incident_accept_violation_count`,
`incident_level`,
rank() over( partition by `incident_level` order by `incident_accept_violation_count` DESC) as `incident_accept_violation_count_rank`,
rank() over( partition by `incident_level` order by `incident_accept_violation_count` ASC) as `__inverse_rank__`
from (
select
--alldim.*,
alldim.`tenant_pk`,--去掉.*,改用需要几列查询几列的方式
alldim.`incident_level`,
CAST(round(nvl(`incident_accept_violation_count`, 0), 0) as INT) as `incident_accept_violation_count`
from alldim
left join (
select
`incident_level`,
`tenant_pk`,
count(*) as `incident_accept_violation_count`
from `ecmp`.dwd_incident_accept
where
incident_accept_violation_flag = '违规'
and `incident_accept_time` >= '2020-01-12 00:00:00'
AND `incident_accept_time` <= '2020-01-12 23:59:59'
group by
`incident_level`,
`tenant_pk`
) as `t1` on 1 = 1
and alldim.`tenant_pk` = `t1`.`tenant_pk`
and alldim.`incident_level` = `t1`.`incident_level`
) as `t0`) select
alldim.`__bts__` as `__bts__`,
CAST(SYSDATE as STRING) as `__cts__`,
CAST(round(nvl(`incident_accept_violation_count`, 0), 0) as INT) as `incident_accept_violation_count`,--dround改成round,手写错误
CAST(round(`incident_accept_violation_count_rank`, 0) as INT) as `incident_accept_violation_count_rank`,
CAST(round(`incident_accept_violation_count_win_rate`, 1) as DOUBLE) as `incident_accept_violation_count_win_rate`,
alldim.`incident_level` as `incident_level`,
alldim.`tenant_id` as `tenant_id`,
alldim.`tenant_name` as `tenant_name`,
alldim.`tenant_pk` as `tenant_pk`
from alldim
left join (
select
'2020-01-12 23:59:59' as `__bts__`,
`incident_accept_violation_count`,
`incident_accept_violation_count_rank`,
`incident_accept_violation_count_win_rate`,
CAST(coalesce(`tp1`.`incident_level`) as STRING) as `incident_level`,
CAST(coalesce(`tp1`.`tenant_pk`) as STRING) as `tenant_pk`
from (
select
t.`tenant_pk`,
t.`incident_level`,
t.`incident_accept_violation_count`,
t.`incident_accept_violation_count_rank`,
if(`c`.ct = 1,null,(`__inverse_rank__` -1) /(`c`.ct -1) * 100) as `incident_accept_violation_count_win_rate`
from t
left join (
select
`incident_level`,
count(*) as `ct`
from t
group by
`incident_level`
) as `c` on 1 = 1
and t.`incident_level` = `c`.`incident_level`
) as `tp1`
)
as `__dws__` on alldim.`__bts__` = `__dws__`.`__bts__`
and alldim.`tenant_pk` = `__dws__`.`tenant_pk`
and alldim.`incident_level` = `__dws__`.`incident_level`;
Inceptor [Code: 40000, SQL State: 42000] COMPILE FAILED: Internal error NullPointerException: [Error 40000] java.lang.NullPointerException的更多相关文章
- Mybatis批量删除之Error code 1064, SQL state 42000;
(一)小小的一次记载. (二):最近的项目都是使用MyBatis,批量新增自己都会写了,但是一次批量删除可把我给折腾了下,写法网上都有,但是照着做就是不行,最后问公司的人,问网友才得到答案,那就是jd ...
- MySQL 报错:Translating SQLException with SQL state '42000', error code '1064', message
MySQL报错详细日志 2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.support.SQLErr ...
- sql与SQL CODE和SQL State相关报错
操作数据库过程中,遇到许多问题,很多都与SQL CODE和SQL State相关,现在把一个完整的SQLCODE和SQLState错误信息和相关解释作以下说明,一来可以自己参考,对DB2错误自行找出原 ...
- hive分区导致FAILED: Hive Internal Error: java.lang.NullPointerException(null)
写了一条hive sql ,其中条件中存在 dt>=20150101 and dt<=20150228 这样的条件,原来执行没问题,今天就抛出 FAILED: Hive Internal ...
- failed with: java.lang.NullPointerException
failed with: java.lang.NullPointerException 需要在nutch的配置文件 'conf/nutch-site.xml'. 里设置如下,不然就报上面的错误了. 当 ...
- 解决spring mvc 上传报错,Field [] isn't an enum value,Failed to convert value of type 'java.lang.String[]' to required type '
没有选择附件,但是点击上传按钮的时候会报错. 之前不选择文件,直接上传空文件是可以的,后来不知道改了什么就不行了. 错误信息: -- :: [http--] TRACE org.springframe ...
- 异常:failed for object com.sdu.crm.pojo.Customer@136a986 [java.lang.NullPointerException]
异常: failed for object com.sdu.crm.pojo.Customer@136a986 [java.lang.NullPointerException] 大家好,如果大家看到了 ...
- Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Unable to compile class for JSP] with root cause java.lang.IllegalArgumentException: Page directive: inval
严重: Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Una ...
- Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDate';
springboot jdbc查询使用LocalDate报:Failed to convert value of type 'java.lang.String' to required type 'j ...
随机推荐
- 4.5万字手把手教你实现MySQL TB级数据存储!!
写在前面 业界对系统的高可用有着基本的要求,简单的说,这些要求可以总结为如下所示. 系统架构中不存在单点问题. 可以最大限度的保障服务的可用性. 一般情况下系统的高可用可以用几个9来评估.所谓的几个9 ...
- FastApi学习(二)
前言 继续学习 此为第二篇, 还差些知识点就可以结束, 更多的比如用户的身份校验/ swagger 文档修改等以后会单独写 正文 使用枚举来限定参数 可以使用枚举的方式来限定参数为某几个值之内才通过 ...
- JAVA开发手册-Markdown
前言 前 言 <Java 开发手册>是技术团队的集体智慧结晶和经验总结,经历了多次大规模一线实战的检验及不断完善.现代软件行业的高速发展对开发者的综合素质要求越来越高,因为不仅是编程知识点 ...
- 分装button组件引发的内存泄漏问题
这个问题其实一开始在vue里写的时候并没有注意到这一点,也没有报错,直到在react里写的时候给我报了一堆错之后,经各种磨烂之后最终找到是分装button组件的问题,既然找到问题在哪就好办了 直接先上 ...
- LeetCode700 二叉搜索树中搜索
给定二叉搜索树(BST)的根节点和一个值. 你需要在BST中找到节点值等于给定值的节点. 返回以该节点为根的子树. 如果节点不存在,则返回 NULL. 例如, 给定二叉搜索树: 4 / \ 2 7 / ...
- XSS-labs通关挑战(xss challenge)
XSS-labs通关挑战(xss challenge) 0x00 xss-labs 最近在看xss,今天也就来做一下xss-labs通过挑战.找了好久的源码,终于被我给找到了,因为在GitHub上 ...
- 彻底搞懂MySQL为什么要使用B+树索引
目录 MySQL的存储结构 表存储结构 B+树索引结构 B+树页节点结构 为什么要用B+树索引 二叉树 多叉树 B树 B+树 搞懂这个问题之前,我们首先来看一下,MySQL表的存储结构 MySQL的存 ...
- [mysql]ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
转载自:http://www.cnblogs.com/joeblackzqq/p/4526589.html From: http://m.blog.csdn.net/blog/langkeziju/1 ...
- C# url的编码解码,xml和json的序列化和反序列化
参考中国慕课网dot net web编程应用程序实践 using System; using System.Collections.Generic; using System.IO; using Sy ...
- 你这样用过DO循环吗?
DATA: BEGIN OF text, word1(4) TYPE c VALUE 'This', word2(4) TYPE c VALUE 'is', ...