【发布时间】:2016-11-26 04:10:57
【问题描述】:
我在 Redshift 表上有一个标准的 listings 表,其中包含所有 varchars(由于加载到数据库中)
这个查询(简化)给了我错误:
with AL as (
select
L.price::int as price,
from listings L
where L.price <> 'NULL'
and L.listing_type <> 'NULL'
)
select price from AL
where price < 800
和错误:
-----------------------------------------------
error: Invalid digit, Value 'N', Pos 0, Type: Integer
code: 1207
context: NULL
query: 2422868
location: :0
process: query0_24 [pid=0]
-----------------------------------------------
如果我删除 where price < 800 条件,查询返回就好了...但我需要 where 条件。
我还检查了price 字段的号码有效性,一切正常。
玩了之后,这实际上使它起作用了,我无法解释为什么。
with AL as (
select
L.price::int as price,
from listings L
where L.price <> 'NULL'
and L.listing_type <> 'NULL'
limit 10000000000
)
select price from AL
where price < 800
请注意,该表的记录数远远少于限制中规定的数量。
任何人(可能来自 Redshift 工程师团队)都可以解释为什么会这样吗?可能与查询计划的执行和并行化方式有关?
【问题讨论】:
-
很高兴看到这个问题的答案!
标签: amazon-web-services amazon-redshift