hadoop-cloud / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

ExpressionParser fails to parse Double which contains exponent #227

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. filter="value eq 1.05e10d"
2. OptionsQueryParser.parseFilter(filter)

What is the expected output? What do you see instead?

Expected: 
  BoolCommonExpression containing a DoubleLiteral object.
Actual:
  java.lang.RuntimeException: Unable to read expression with tokens: [[1], [.], [05], [e10d]]

What version of the product are you using? On what operating system?
odata4j-core-0.7.0.jar, JDK 1.6_0_33, Windows Server 2008R2

Please provide any additional information below.

This should be supported for both "E" and "e":
http://www.odata.org/developers/protocols/overview#AbstractTypeSystem
http://www.odata.org/media/16352/[ms-odata].pdf

Original issue reported on code.google.com by www.Dave...@gmail.com on 8 Nov 2012 at 8:35

GoogleCodeExporter commented 8 years ago
I was looking through the expression parser and see it does support E but not 
e. My original test would have worked if I had used E.  It is interesting that 
the document http://www.odata.org/media/16352/[ms-odata].pdf says either can 
work but the document 
http://www.odata.org/developers/protocols/overview#AbstractTypeSystem says only 
E can work.

You can close this, as with some other reformatting on the client, I did get 
the doubles to work.

It is a bit of a pain though, because if the number is near zero you need to 
append the "d" but if it contains exponent you do not contain d.  Was unable to 
use default rendering logic to put this in the $filter parameter.

Original comment by www.Dave...@gmail.com on 8 Nov 2012 at 8:47

GoogleCodeExporter commented 8 years ago
Interesting point about the conditional double formatting.  Worth raising on 
the odata list?

Closing per request.

Original comment by john.spurlock on 10 Nov 2012 at 3:42