简体   繁体   English

Azure 表存储过滤器错误?

[英]Azure Table Storage filter bug?

I'm sending a query to Azure Table Storage which selects a range of entities with a condition:我正在向 Azure 表存储发送查询,该查询选择具有条件的一系列实体:

$filter=
(PartitionKey eq 'key')
 and
(
    (
        (RowKey gt '08D372E4E0A02B2600000000')
         and
        (RowKey le '08D372E4E515E3E9FFFFFFFF')
    )
     and
    (
        (Done ne 'true')
         or
        (EndTimestamp gt '635978299756075046')
    )
)

I need all records in a range which either not complete (Done ne 'true') or complete after specific time (EndTimestamp gt '635978299756075046').我需要一个范围内的所有记录,这些记录要么不完整(完成 ne 'true'),要么在特定时间后完成(EndTimestamp gt '635978299756075046')。 Done is 'bool?'完成是'bool?' and EndTimestamp is 'Int64?'.和 EndTimestamp 是“Int64?”。

In Fiddler I can clearly see that a record like this is returned back:在 Fiddler 中,我可以清楚地看到返回了这样的记录:

{  
  "PartitionKey":"key",
  "RowKey":"08D372E4E0A0B8F5002CDBE3",
  "Done":true,
  "EndTimestamp@odata.type":"Edm.Int64",
  "EndTimestamp":"635978299737021249",
}

What does not satisfy the EndTimestamp condition: 6359782997 37021249 is obviously less than 6359782997 56075046 .什么不满足 EndTimestamp 条件: 6359782997 37021249明显小于 6359782997 56075046

Seems like a bug, or am I missing something?似乎是一个错误,还是我错过了什么?

I can do additional checks at run-time as a workaround, but (1) that defeats the purpose of filtering on server side and (2) I want to reduce the traffic and query count - there can be thousands of entities which don't satisfy the condition.我可以在运行时做额外的检查作为一种解决方法,但是 (1) 这违背了在服务器端过滤的目的和 (2) 我想减少流量和查询计数 - 可能有数千个实体没有满足条件。

Found the issue, that was my mistake.发现问题,那是我的错误。 The right condition is:正确的条件是:

    (Done ne true)
     or
    (EndTimestamp gt 635978299756075046L)

I use the TableQuery.GenerateFilterCondition helper method, which takes in strings only, so it adds quotes to the values.我使用TableQuery.GenerateFilterCondition辅助方法,该方法仅接受字符串,因此它会为值添加引号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM