Inceptor [Code: 40000, SQL State: 42000] COMPILE FAILED: Internal error NullPointerException: [Erro
Posted 勤奋的园
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Inceptor [Code: 40000, SQL State: 42000] COMPILE FAILED: Internal error NullPointerException: [Erro相关的知识,希望对你有一定的参考价值。
下面代码报空指针
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: [Erro的主要内容,如果未能解决你的问题,请参考以下文章
如何快速将40000条记录插入iPad中的sqlite数据库
怎么实现在inceptor或者hive环境下编写 merge into