ANCESTOR Query Parse Error: Using DISTINCT

∥☆過路亽.° 提交于 2019-12-24 00:16:00

问题


Not this question: Ancestor query parse error

I structured it with "IS" properly:

SELECT DISTINCT batch_no FROM Entry WHERE ANCESTOR IS KEY('ag1kZXZ-dHRiLXRhbWVychkLEgdCcmV3ZXJ5IgxCUi1USEVSRURQRUEM')

But still I got the error:

Why is that?


回答1:


In this case, DISTINCT was causing the problem. Remove it and this Query functions no prob.

I think it is somehow implicitly projecting, you cannot access the key, only that property you DISTINCT on; even if you use "*"

Though I think it's fair to say the error message was not obvious on this point.

Google says this in db.Query documentation:

This will only return the first result for entities which have the same values for the properties that are being projected.

And in the GQL documentation

that only completely unique results will be returned in a result set. This will only return the first result for entities which have the same values for the properties that are being projected.

Please moderate this self-answered question if it's duplicative or facile. Thanks.



来源:https://stackoverflow.com/questions/25225368/ancestor-query-parse-error-using-distinct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!