You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Deyan (Jira)" <ji...@apache.org> on 2021/09/05 12:40:00 UTC

[jira] [Updated] (OLINGO-1540) $count is an Integer value and cannot handle counts bigger than 2 billions (2147483647)

     [ https://issues.apache.org/jira/browse/OLINGO-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deyan updated OLINGO-1540:
--------------------------
    Description: 
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._

 
h3. 11.2.10 [Requesting the Number of Items in a Collection|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_RequestingtheNumberofItemsinaCollect]

_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|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionfilter] or [$search|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionsearch] system query options, formatted as a *simple primitive integer value* with media type text/plain. Clients SHOULD NOT combine the system query options [$top|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptiontop], [$skip|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionskip], [$orderby|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionorderby], [$expand|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionexpand], and [$format|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionformat] with the path suffix /$count. The result of such a request is undefined._

  was:
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 and also to keep backwards compatibility of the Olingo server API somehow. 

 

+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._

 
h3. 11.2.10 [Requesting the Number of Items in a Collection|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_RequestingtheNumberofItemsinaCollect]

_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|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionfilter] or [$search|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionsearch] system query options, formatted as a *simple primitive integer value* with media type text/plain. Clients SHOULD NOT combine the system query options [$top|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptiontop], [$skip|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionskip], [$orderby|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionorderby], [$expand|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionexpand], and [$format|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionformat] with the path suffix /$count. The result of such a request is undefined._


> $count is an Integer value and cannot handle counts bigger than 2 billions (2147483647) 
> ----------------------------------------------------------------------------------------
>
>                 Key: OLINGO-1540
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1540
>             Project: Olingo
>          Issue Type: Improvement
>          Components: odata4-server
>            Reporter: Deyan
>            Priority: Major
>
> 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._
>  
> h3. 11.2.10 [Requesting the Number of Items in a Collection|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_RequestingtheNumberofItemsinaCollect]
> _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|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionfilter] or [$search|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionsearch] system query options, formatted as a *simple primitive integer value* with media type text/plain. Clients SHOULD NOT combine the system query options [$top|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptiontop], [$skip|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionskip], [$orderby|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionorderby], [$expand|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionexpand], and [$format|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptionformat] with the path suffix /$count. The result of such a request is undefined._



--
This message was sent by Atlassian Jira
(v8.3.4#803005)