PartitionKey extracted from document doesn't match the one specified in the header

佐手、 提交于 2019-12-12 03:58:47

问题


I have created a partitioned collection on a long field (playerId) and also added a hash index on that field (DataType.Number). When I insert records most of the time it works, but sometimes it gives me a PartitionKey extracted from document doesn't match the one specified in the header.

After I tested this in the Azure Data Explorer I found out there's a rounding problem with long numbers. If I insert 183548146777950021 through Data Explorer it will save it, but then return that same record to me as 183548146777950000. Is this a known issue?

I'm using the latest 1.23.2 of the .NET client, in Direct/TCP mode.


回答1:


If I insert 183548146777950021 through Data Explorer it will save it, but then return that same record to me as 183548146777950000. Is this a known issue?

As far as I know, Azure DocumentDB uses IEEE754 standard for numbers, which could cause the truncation or loss of precision for large integers or higher precision decimal numbers. If possible, you could try to modify and store the playerId field as string "183548146777950021".

And you could refer to this similar issue: Azure DocumentDB decimal truncation.



来源:https://stackoverflow.com/questions/43764755/partitionkey-extracted-from-document-doesnt-match-the-one-specified-in-the-head

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