我从FusionTable API得到了奇怪的结果。具体来说,似乎无法处理对数值具有相等约束的简单select语句。我尝试以下形式的任何查询:
SELECT COUNT() FROM 1Nynh5pPrj1q8JqbalppAm-qzAsgKvL0ZRala7VI WHERE AGE=41
产生零记录:
{
"kind": "fusiontables#sqlresponse",
"columns": [
"count()"
],
"rows": [
[ "0" ]
]
}
相比之下,范围约束可以正常工作:
SELECT COUNT() FROM 1Nynh5pPrj1q8JqbalppAm-qzAsgKvL0ZRala7VI WHERE AGE>40.99 AND AGE<41.01
{
"kind": "fusiontables#sqlresponse",
"columns": [
"count()"
],
"rows": [
[ "362" ]
]
}
也许下面的数字不是整数? SELECT AGE FROM 1Nynh5pPrj1q8JqbalppAm-qzAsgKvL0ZRala7VI WHERE AGE>40.99 AND AGE<41.01返回
{
"kind": "fusiontables#sqlresponse",
"columns": [
"AGE"
],
"rows": [
[ "41" ],
[ "41" ],
[ "41" ],
...359 more...
]}
现在,可能还有一些浮点表示错误?我认为小整数可以完全表示为浮点数(即使一些小数部分,例如0.1,在二进制中重复小数)。
Fusion Table SQL中的错误似乎不可能在没有被其他人发现的情况下通过,所以也许它有this particular FusionTable加载的独特之处?
更新
虽然使用上面的新Fusion Table API查询似乎失败,但它使用旧的Fusion Table SQL API(最近已弃用)成功: www.google.com/fusiontables/api/query?sql=SELECT%20COUNT()%20FROM%204579147%20WHERE%20AGE%20LIKE%2041
返回此JSON响应:
count()
362
此外,新的FusionTable API似乎与数值混淆:
SELECT COUNT() FROM 4579147 WHERE AGE = 41
收益0
(不正确)
SELECT COUNT() FROM 4579147 WHERE AGE = "41"
收益0
(不正确)
SELECT COUNT() FROM 4579147 WHERE AGE MATCHES 41
收益362
SELECT COUNT() FROM 4579147 WHERE AGE LIKE 41
收益362
SELECT COUNT() FROM 4579147 WHERE AGE LIKE "41"
收益362
SELECT COUNT() FROM 4579147 WHERE AGE LIKE "%41%"
收益362
答案 0 :(得分:1)
该表中的AGE = 41没有错: https://www.google.com/fusiontables/DataSource?snapid=S580613IY6U
有关count()的信息导致查询失败
答案 1 :(得分:1)
这是最近推出的错误,很快就会修复。如上所述,它仅影响具有聚合的数字相等性查询。很抱歉给您带来不便!