Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1540

$count is an Integer value and cannot handle counts bigger than 2 billions (2147483647)



    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • odata4-server
    • None


      The classes EntityCollection and FixedFormatSerializer require an Integer value for the count of entities and introduce a limit of 2 bln (Integer.MAX). That number is certainly not enough for some data sets that might have more records than 2 bln. For example I am working on a project which has a database table with 3 bln rows and growing. 

      The OData 4 specification does not restrict the value of $count to a signed 32 bit Integer. Instead the specification implies that the count is an integer number, meaning zero fractional digits.

      The suggested approach here is to upgrade the count properties from Integer to Long. 


      From the OData specification: 


      The $count system query option with a value of true specifies that the total count of items within a collection matching the request be returned along with the result.


      11.2.10 Requesting the Number of Items in a Collection

      To request only the number of items of a collection of entities or items of a collection-valued property, the client issues a GET request with /$count appended to the resource path of the collection.

      On success, the response body MUST contain the exact count of items matching the request after applying any $filter or $search system query options, formatted as a simple primitive integer value with media type text/plain. Clients SHOULD NOT combine the system query options $top$skip$orderby$expand, and $format with the path suffix /$count. The result of such a request is undefined.




            Unassigned Unassigned
            deyanmf Deyan
            0 Vote for this issue
            1 Start watching this issue