You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于OData不同版本中$filter数字字面量后缀有效性的确认及版本变更官方依据咨询

结论确认

Your observations are spot-on—let's break this down clearly to confirm your conclusions and tie them to official OData specs:

  • OData 2.0 & 3.0: Numeric literal suffixes are supported (and in some scenarios required) to explicitly define the Edm data type of the literal. The type mappings you discovered are 100% accurate:
    • d → Edm.Double
    • f → Edm.Single
    • L → Edm.Int64
    • m/M → Edm.Decimal
    • Invalid suffixes (like a/b) trigger syntax errors, while mismatched suffixes (e.g., d/f paired with an Edm.Decimal property) result in type mismatch errors.
  • OData 4.0+: Numeric literal suffixes are no longer valid. The system automatically infers the Edm type of the literal based on context (such as the property it's being compared against). Using any suffix in 4.0+ will throw a syntax error.
Official Documentation References

Here's how this aligns with specific sections of the OData specification:

OData 2.0

  • URI Conventions > 4.5 Filter System Query Option ($filter): While the documentation links 32d to 32 in examples, 32d is a valid literal in actual requests to explicitly denote an Edm.Double value.
  • Overview > 6. Primitive Data Types: Defines the suffix rules for numeric literals to distinguish between different Edm numeric types.

OData 3.0

  • URL Conventions > 5.1.2 Filter System Query Option ($filter) > 5.1.2.2.6 Arithmetic Operator Examples: Explicitly mentions using the M suffix to represent an Edm.Decimal literal (e.g., Freight gt 100M for an Edm.Decimal property).

OData 4.0+ (including 4.01)

  • Part 1: Protocol > 11.2.6.1.2 Built-in Query Functions > Arithmetic Functions: No references to numeric literal suffixes exist—all numeric literals have their types inferred from context.
  • Part 2: URL Conventions > 5.1.1.9 Arithmetic Functions > 5.1.1.9.3 round Function: Examples only use suffix-free numeric literals (e.g., round(Freight) eq 32).
  • ABNF Construction Rules > decimalValue =: The defined format for decimal literals does not include any suffixes, confirming that suffixes were removed starting in OData 4.0.

内容的提问来源于stack exchange,提问作者Sandra Rossi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 16:12:26