You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Frédéric SOUCHU <Fr...@ingenico.com> on 2015/06/01 19:05:56 UTC
RE: $count+$filter 'implementation' gap both in Olingo and in
reference service?
Any views?
Producing a fix touches a complex part of the Olingo code.
>From what I see, the $count option pushes a context without any type (context.contextTypes = []).
The $filter option then raises an exception :[
A fix might be to add a method to the UriResourceCountImpl to look at the type before the $count option but a bit unsure of the side effects!!!
Regards,
Frederic
From: Frédéric SOUCHU [mailto:Frederic.SOUCHU@ingenico.com]
Sent: 29 May 2015 14:41
To: user@olingo.apache.org
Subject: $count+$filter 'implementation' gap both in Olingo and in reference service?
According to OData specifications:
11.2.9 Requesting the Number of Items in a Collection
...
Example 64: return the number of all products whose Price is less than $10.00
http://host/service/Products/$count?$filter=Price lt 10.00
The /$count segment can be used in combination with the $filter<http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_The_$filter_System> system query option.
Now a real-life test shows that implementors did not read the small fonts in the contract:
http://services.odata.org/V4/TripPinService/People('russellwhyte')/Trips/$count?$filter=Budget gt 2001
{
"error": {
"code": "BadRequest",
"message": "The query option '$filter' can only be applied to collection resouces",
"innererror": {
"message": "The query option '$filter' can only be applied to collection resouces",
"type": "Microsoft.Test.OData.Services.ODataWCFService.ODataServiceException",
"stacktrace": " at Microsoft.Test.OData.Services.ODataWCFService.QueryContext.GetElementTypeForOption(String option)\r\n at Microsoft.Test.OData.Services.ODataWCFService.QueryContext.ResolveQuery(IODataDataSource dataSource, Int32 level)\r\n at Microsoft.Test.OData.Services.ODataWCFService.Handlers.QueryHandler.Process(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage)\r\n at Microsoft.Test.OData.Services.ODataWCFService.Handlers.RequestHandler.Process(Stream requestStream)\r\n at Microsoft.Test.OData.Services.ODataWCFService.Handlers.RootRequestHandler.Process(Stream requestStream)"
}
}
}
Olingo JAVA Beta 03 returns a somewhat different error:
http://localhost:8080/myservice/Stores/$count?$filter=ID eq '123465'
{
"error": {
"code": null,
"message": "The key value 'ID' is invalid."
}
}
(of course http://localhost:8080/EverestService/um/Stores?$filter=ID eq '123465' does work...)
In short, no SDK seems to match the Odata specification :[
Is it a known bug? Or is my syntax incorrect?
If so, what would be the syntax to get the total number of filtered entities?
Regards,
Frederic
RE: $count+$filter 'implementation' gap both in Olingo and in
reference service?
Posted by Frédéric SOUCHU <Fr...@ingenico.com>.
The bug is about using $count within a filter or orderby.
My use case is slightly different: the specs says that you can count the result of a filter but implementation does not support it.
Bug created here:
https://issues.apache.org/jira/browse/OLINGO-679
Frederic
From: Ramesh Reddy [mailto:rareddy@redhat.com]
Sent: 01 June 2015 21:06
To: user@olingo.apache.org
Subject: Re: $count+$filter 'implementation' gap both in Olingo and in reference service?
May be related with https://issues.apache.org/jira/browse/OLINGO-635 have not had chance to take a look.
________________________________
Any views?
Producing a fix touches a complex part of the Olingo code.
From what I see, the $count option pushes a context without any type (context.contextTypes = []).
The $filter option then raises an exception :[
A fix might be to add a method to the UriResourceCountImpl to look at the type before the $count option but a bit unsure of the side effects!!!
Regards,
Frederic
From: Frédéric SOUCHU [mailto:Frederic.SOUCHU@ingenico.com]
Sent: 29 May 2015 14:41
To: user@olingo.apache.org<ma...@olingo.apache.org>
Subject: $count+$filter 'implementation' gap both in Olingo and in reference service?
According to OData specifications:
11.2.9 Requesting the Number of Items in a Collection
…
Example 64: return the number of all products whose Price is less than $10.00
http://host/service/Products/$count?$filter=Price lt 10.00
The /$count segment can be used in combination with the $filter<http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_The_$filter_System> system query option.
Now a real-life test shows that implementors did not read the small fonts in the contract:
http://services.odata.org/V4/TripPinService/People('russellwhyte')/Trips/$count?$filter=Budget gt 2001
{
"error": {
"code": "BadRequest",
"message": "The query option '$filter' can only be applied to collection resouces",
"innererror": {
"message": "The query option '$filter' can only be applied to collection resouces",
"type": "Microsoft.Test.OData.Services.ODataWCFService.ODataServiceException",
"stacktrace": " at Microsoft.Test.OData.Services.ODataWCFService.QueryContext.GetElementTypeForOption(String option)\r\n at Microsoft.Test.OData.Services.ODataWCFService.QueryContext.ResolveQuery(IODataDataSource dataSource, Int32 level)\r\n at Microsoft.Test.OData.Services.ODataWCFService.Handlers.QueryHandler.Process(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage)\r\n at Microsoft.Test.OData.Services.ODataWCFService.Handlers.RequestHandler.Process(Stream requestStream)\r\n at Microsoft.Test.OData.Services.ODataWCFService.Handlers.RootRequestHandler.Process(Stream requestStream)"
}
}
}
Olingo JAVA Beta 03 returns a somewhat different error:
http://localhost:8080/myservice/Stores/$count?$filter=ID eq '123465'
{
"error": {
"code": null,
"message": "The key value 'ID' is invalid."
}
}
(of course http://localhost:8080/EverestService/um/Stores?$filter=ID eq '123465' does work…)
In short, no SDK seems to match the Odata specification :[
Is it a known bug? Or is my syntax incorrect?
If so, what would be the syntax to get the total number of filtered entities?
Regards,
Frederic
Re: $count+$filter 'implementation' gap both in Olingo and in
reference service?
Posted by Ramesh Reddy <ra...@redhat.com>.
May be related with https://issues.apache.org/jira/browse/OLINGO-635 have not had chance to take a look.
----- Original Message -----
> Any views?
> Producing a fix touches a complex part of the Olingo code.
> From what I see, the $count option pushes a context without any type
> (context.contextTypes = []).
> The $filter option then raises an exception :[
> A fix might be to add a method to the UriResourceCountImpl to look at the
> type before the $count option but a bit unsure of the side effects!!!
> Regards,
> Frederic
> From: Frédéric SOUCHU [mailto:Frederic.SOUCHU@ingenico.com]
> Sent: 29 May 2015 14:41
> To: user@olingo.apache.org
> Subject: $count+$filter 'implementation' gap both in Olingo and in reference
> service?
> According to OData specifications:
> 11.2.9 Requesting the Number of Items in a Collection
> …
> Example 64: return the number of all products whose Price is less than $10.00
> http://host/service/Products/$count?$filter=Price lt 10.00
> The /$count segment can be used in combination with the $filter system query
> option.
> Now a real-life test shows that implementors did not read the small fonts in
> the contract:
> http://services.odata.org/V4/TripPinService/People('russellwhyte')/Trips/$count?$filter=Budget
> gt 2001
> {
> "error": {
> "code": "BadRequest",
> "message": "The query option '$filter' can only be applied to collection
> resouces",
> "innererror": {
> "message": "The query option '$filter' can only be applied to collection
> resouces",
> "type":
> "Microsoft.Test.OData.Services.ODataWCFService.ODataServiceException",
> "stacktrace": " at
> Microsoft.Test.OData.Services.ODataWCFService.QueryContext.GetElementTypeForOption(String
> option)\r\n at
> Microsoft.Test.OData.Services.ODataWCFService.QueryContext.ResolveQuery(IODataDataSource
> dataSource, Int32 level)\r\n at
> Microsoft.Test.OData.Services.ODataWCFService.Handlers.QueryHandler.Process(IODataRequestMessage
> requestMessage, IODataResponseMessage responseMessage)\r\n at
> Microsoft.Test.OData.Services.ODataWCFService.Handlers.RequestHandler.Process(Stream
> requestStream)\r\n at
> Microsoft.Test.OData.Services.ODataWCFService.Handlers.RootRequestHandler.Process(Stream
> requestStream)"
> }
> }
> }
> Olingo JAVA Beta 03 returns a somewhat different error:
> http://localhost:8080/myservice/Stores/$count?$filter=ID eq '123465'
> {
> "error": {
> "code": null,
> "message": "The key value 'ID' is invalid."
> }
> }
> (of course http://localhost:8080/EverestService/um/Stores?$filter=ID eq
> '123465' does work…)
> In short, no SDK seems to match the Odata specification :[
> Is it a known bug? Or is my syntax incorrect?
> If so, what would be the syntax to get the total number of filtered entities?
> Regards,
> Frederic