sql - 由于内部错误,不支持相关子查询模式的类型
问题描述
我遇到了这个错误:
“由于内部错误,不支持这种类型的相关子查询模式”
在 Matillion(Redshift 的 ETL 工具)上执行以下查询时。
SELECT DISTINCT
"sap"."tracking_no" AS "tracking_no",
(select case when len("sap"."order_create_time")=6 and
regexp_instr("sap"."order_create_date",'[a-zA-Z]')=0 and
regexp_instr("sap"."order_create_time",'[a-zA-Z]')=0
then CAST(CONCAT(CONCAT(cast(isnull("sap"."order_create_date",'1900-01-01') as VARCHAR(10)), ' '),
CONCAT(CONCAT(CONCAT(CONCAT(SUBSTRING(isnull("sap"."order_create_time",'000000'), 1,2), ':'),
SUBSTRING(isnull("sap"."order_create_time",'000000'), 3,2)),':'),
SUBSTRING(isnull("sap"."order_create_time",'000000'), 5,2))) as timestamp)
when len("sap"."order_create_time")=5 and regexp_instr("sap"."order_create_date",'[a-zA-Z]')=0 and
regexp_instr("sap"."order_create_time",'[a-zA-Z]')=0
then CAST(CONCAT(CONCAT(cast(isnull("sap"."order_create_date",'1900-01-01') as VARCHAR(10)), ' '),
CONCAT(CONCAT(CONCAT(CONCAT(concat('0',SUBSTRING(isnull("sap"."order_create_time",'000000'), 5,1)), ':'),
SUBSTRING(isnull("sap"."order_create_time",'000000'), 3,2)),':'),
SUBSTRING(isnull("sap"."order_create_time",'000000'), 5,1))) as timestamp)
else cast('1900-01-01 000000' as timestamp)
end) as "order_date_time",
(select case when len("sap"."ship_time")=6 and
regexp_instr("sap"."ship_date",'[a-zA-Z]')=0 and
regexp_instr("sap"."ship_time",'[a-zA-Z]')=0
then CAST(CONCAT(CONCAT(cast(isnull("sap"."ship_date",'1900-01-01') as VARCHAR(10)), ' '),
CONCAT(CONCAT(CONCAT(CONCAT(SUBSTRING(isnull("sap"."ship_time",'000000'), 1,2), ':'),
SUBSTRING(isnull("sap"."ship_time",'000000'), 3,2)),':'),
SUBSTRING(isnull("sap"."ship_time",'000000'), 5,2))) as timestamp)
when len("sap"."ship_time")=5 and regexp_instr("sap"."ship_date",'[a-zA-Z]')=0 and
regexp_instr("sap"."ship_time",'[a-zA-Z]')=0
then CAST(CONCAT(CONCAT(cast(isnull("sap"."ship_date",'1900-01-01') as VARCHAR(10)), ' '),
CONCAT(CONCAT(CONCAT(CONCAT(concat('0',SUBSTRING(isnull("sap"."ship_time",'000000'), 5,1)), ':'),
SUBSTRING(isnull("sap"."ship_time",'000000'), 3,2)),':'),
SUBSTRING(isnull("sap"."ship_time",'000000'), 5,1))) as timestamp)
else cast('1900-01-01 000000' as timestamp)
end) as "ship_date_time",
"fedex"."TRACKING_NUMBER" AS "TRACKING_NUMBER"
FROM fed_ex_feed AS "fedex"
LEFT OUTER JOIN
sap_delivery AS "sap"
ON "fedex"."TRACKING_NUMBER" = "sap"."tracking_no"
WHERE sap.order_create_date is not null and
fedex.DELIVERY_DATE is not null
我尝试搜索分辨率,但在互联网上找不到任何分辨率。
它是否与红移集群有关,因为它暗示为内部错误?
任何帮助,将不胜感激。
解决方案
我特此发布更新后的查询,该查询现在有效。删除select
前面的语句,case
它就可以工作了。
SELECT DISTINCT
"sap"."tracking_no" AS "tracking_no",
case when len("sap"."order_create_time")=6 and
regexp_instr("sap"."order_create_date",'[a-zA-Z]')=0 and
regexp_instr("sap"."order_create_time",'[a-zA-Z]')=0
then CAST(CONCAT(CONCAT(cast(isnull("sap"."order_create_date",'1900-01-01') as VARCHAR(10)), ' '),
CONCAT(CONCAT(CONCAT(CONCAT(SUBSTRING(isnull("sap"."order_create_time",'000000'), 1,2), ':'),
SUBSTRING(isnull("sap"."order_create_time",'000000'), 3,2)),':'),
SUBSTRING(isnull("sap"."order_create_time",'000000'), 5,2))) as timestamp)
when len("sap"."order_create_time")=5 and regexp_instr("sap"."order_create_date",'[a-zA-Z]')=0 and
regexp_instr("sap"."order_create_time",'[a-zA-Z]')=0
then CAST(CONCAT(CONCAT(cast(isnull("sap"."order_create_date",'1900-01-01') as VARCHAR(10)), ' '),
CONCAT(CONCAT(CONCAT(CONCAT(concat('0',SUBSTRING(isnull("sap"."order_create_time",'000000'), 5,1)), ':'),
SUBSTRING(isnull("sap"."order_create_time",'000000'), 3,2)),':'),
SUBSTRING(isnull("sap"."order_create_time",'000000'), 5,1))) as timestamp)
else cast('1900-01-01 000000' as timestamp)
end as "order_date_time"
, case when len("sap"."ship_time")=6 and
regexp_instr("sap"."ship_date",'[a-zA-Z]')=0 and
regexp_instr("sap"."ship_time",'[a-zA-Z]')=0
then CAST(CONCAT(CONCAT(cast(isnull("sap"."ship_date",'1900-01-01') as VARCHAR(10)), ' '),
CONCAT(CONCAT(CONCAT(CONCAT(SUBSTRING(isnull("sap"."ship_time",'000000'), 1,2), ':'),
SUBSTRING(isnull("sap"."ship_time",'000000'), 3,2)),':'),
SUBSTRING(isnull("sap"."ship_time",'000000'), 5,2))) as timestamp)
when len("sap"."ship_time")=5 and regexp_instr("sap"."ship_date",'[a-zA-Z]')=0 and
regexp_instr("sap"."ship_time",'[a-zA-Z]')=0
then CAST(CONCAT(CONCAT(cast(isnull("sap"."ship_date",'1900-01-01') as VARCHAR(10)), ' '),
CONCAT(CONCAT(CONCAT(CONCAT(concat('0',SUBSTRING(isnull("sap"."ship_time",'000000'), 5,1)), ':'),
SUBSTRING(isnull("sap"."ship_time",'000000'), 3,2)),':'),
SUBSTRING(isnull("sap"."ship_time",'000000'), 5,1))) as timestamp)
else cast('1900-01-01 000000' as timestamp)
end as "ship_date_time",
"fedex"."TRACKING_NUMBER" AS "TRACKING_NUMBER"
FROM fed_ex_feed AS "fedex"
LEFT OUTER JOIN
sap_delivery AS "sap"
ON "fedex"."TRACKING_NUMBER" = "sap"."tracking_no"
WHERE sap.order_create_date is not null and
fedex.DELIVERY_DATE is not null
推荐阅读
- documentation - Kubernetes 文档搜索无法正常工作
- vue.js - Vue js嵌入组件的执行方法
- linux - 汇编中单独的 64 位寄存器有什么作用?
- java - Java JDBC SQL 将一个表重写为另一个
- sql - SQL Server BULK INSERT 出错并且没有释放 Sch-M 锁,表不可访问
- python - 我可以让 tensorflow-gpu 与 NVIDIA GeForce MX130 一起工作吗?
- web-crawler - 如何限制stormcrawler中的爬行深度
- python-3.x - Python无法以批处理语言打印变量
- azure - 如何从 ADF 将 json 发布到 REST
- mediawiki - MediaWiki 从 1.15 更新到最新版本