OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] Updated: (ODATA-294) Clarifications needed for Filter System Query Option: Operators and Functions


     [ http://tools.oasis-open.org/issues/browse/ODATA-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralf Handl updated ODATA-294:
-----------------------------

    Proposal: 
Q1. Apart from EQ and NE (where comparison with null can be easily understood to always return TRUE or FALSE), what is the result of using GT, GE, LT, LE with one (or both arguments) being NULL? 

Answered in ODATA-166


Q2. What is the result of an arithmetic operator applied to one (or both) NULL operands? 

Answered in ODATA-166


Q3. What is the ordering of numeric types for promotion when mixed types are used (e.g. if ADD is applied to Single and Decimal, what type is the result)? 

Order: SByte, Int16, Int32, Int64, Decimal, Single, Double. 

Decimal is considered "less" than Single because Single can in nearly all implementations have a larger exponent than Decimal (so we prefer "range" over "precision" for promotion). 


Q4. What is the result of a canonical function applied to one (or more) NULL parameters? 

Define per function


Q5. Where does NULL occur in ascending sort, and where in descending sort? 

null sorts first asc and last desc


Q6. Examples in the spec show spaces in filters. Shouldn't these be %-encoded (e.g. "%20") so they are valid in URLs? 

Not an issue; we url encode, and explicitly mention that the examples are simplified for readability


Q7. Which primitive types support the use of LT, LE, GT, GE?

All except binary, geo, stream, and of course no collection of any primitive type 
true is greater than false


Q8. Which geo types permit the use of EQ and NE? 

Geo types do not permit any comparison operator, and they MUST NOT be used as primary keys, not even Geo.Point. 
Reason is that geographies can be "spatially equal" without being "literally" equal.


Q9. Are the LHS and RHS operands for a logical operator allowed to have different types (e.g. LHS=Decimal, RHS=Int32)? If so, then can non-string values be compared with string values? 

We define promotions


Q10. What is the result of division/modulo arithmetic operators where the divisor is zero? 

positive / zero = INF
negative / zero = -INF
zero / zero = NaN

NaN is not equal to any number, including NaN
INF is equal to INF and unequal to any other number and -INF
-INF is equal to -INF and unequal to any other number and INF


Q11. What are the rules for the calculation of the result of modulo where one or both operands are negative? 

Dividend owns the sign. Many programming languages either use this rule or offer special operator that uses this rule, including C++ and SQL


Q12. What are the rules for scale of the results of arithmetic operators where the operands are decimal? 
More general: how do we handle overflows?

Define per operator in URL 5.1.1.2


Q13. Which style of rounding is used by the round function (e.g. round-half-even)? 

Round (half) away from zero. This is the default in C++, possible in C# , and possible in Java (rounding-mode HALF_UP).

Examples:
-1.1 -> -1
-0.5 -> -1
0.5 -> 1
1.1 -> 1

	
Q14. Does the 'length' function calculate length according to UTF-8 bytes, UTF-16 characters, or something else? 

Characters, already in URL conventions

  was:
Q1. Apart from EQ and NE (where comparison with null can be easily understood to always return TRUE or FALSE), what is the result of using GT, GE, LT, LE with one (or both arguments) being NULL? 

Answered in ODATA-166


Q2. What is the result of an arithmetic operator applied to one (or both) NULL operands? 

Answered in ODATA-166


Q3. What is the ordering of numeric types for promotion when mixed types are used (e.g. if ADD is applied to Single and Decimal, what type is the result)? 

Order: SByte, Int16, Int32, Int64, Decimal, Single, Double. 

Decimal is considered "less" than Single because Single can in nearly all implementations have a larger exponent than Decimal (so we prefer "range" over "precision" for promotion). 


Q4. What is the result of a canonical function applied to one (or more) NULL parameters? 

Define per function


Q5. Where does NULL occur in ascending sort, and where in descending sort? 

null sorts first asc and last desc


Q6. Examples in the spec show spaces in filters. Shouldn't these be %-encoded (e.g. "%20") so they are valid in URLs? 

Not an issue; we url encode, and explicitly mention that the examples are simplified for readability


Q7. Which primitive types support the use of LT, LE, GT, GE?

All except binary, geo, stream, and of course no collection of any primitive type 
true is greater than false


Q8. Which geo types permit the use of EQ and NE? 

TODO: Probably not supported for any geo types. Ask John


Q9. Are the LHS and RHS operands for a logical operator allowed to have different types (e.g. LHS=Decimal, RHS=Int32)? If so, then can non-string values be compared with string values? 

We define promotions


Q10. What is the result of division/modulo arithmetic operators where the divisor is zero? 

positive / zero = INF
negative / zero = -INF
zero / zero = NaN

NaN is not equal to any number, including NaN
INF is equal to INF and unequal to any other number
-INF is equal to -INF and unequal to any other number


Q11. What are the rules for the calculation of the result of modulo where one or both operands are negative? 

Dividend owns the sign. Many programming languages either use this rule or offer special operator that uses this rule, including C++ and SQL


Q12. What are the rules for scale of the results of arithmetic operators where the operands are decimal? 
More general: how do we handle overflows?

Define per operator in URL 5.1.1.2


Q13. Which style of rounding is used by the round function (e.g. round-half-even)? 

Round away from zero. This is the default in C++, possible in C# , and possible in Java (rounding-mode HALF_UP).

	
Q14. Does the 'length' function calculate length according to UTF-8 bytes, UTF-16 characters, or something else? 

Characters, already in URL conventions


> Clarifications needed for Filter System Query Option: Operators and Functions
> -----------------------------------------------------------------------------
>
>                 Key: ODATA-294
>                 URL: http://tools.oasis-open.org/issues/browse/ODATA-294
>             Project: OASIS Open Data Protocol (OData) TC
>          Issue Type: Improvement
>          Components: OData URL Conventions 
>    Affects Versions: V4.0_WD01
>         Environment: [Proposed]
>            Reporter: Evan Ireland
>             Fix For: V4.0_CSD02
>
>
> Some questions which may be nicely addressed by additional clarifications in the URL Conventions spec...
> Logical Operators:
> Q1. Apart from EQ and NE (where comparison with null can be easily understood to always return TRUE or FALSE), what is the result of using GT, GE, LT, LE with one (or both arguments) being NULL?
>     Possible answers: (a) undefined by the spec; (b) result is NULL; (c) result is FALSE; (d) a NULL value is considered less-than non-NULL values.
>     If the answer is (b) NULL, then we should define that a filter that evaluates to NULL is considered FALSE, for the purposes of determining a filter match. Since NULLs may propagate up the filter expresion tree rather quickly.
> Arithmetic Operators:
> Q2. What is the result of an arithmetic operator applied to one (or both) NULL operands?
>     Possible answers: (a) undefined by the spec; (b) NULL.
> Q3. What is the ordering of numeric types for promotion when mixed types are used (e.g. if ADD is applied to Single and Decimal, what type is the result)?
>     Suggested answer: SByte, Int16, Int32, Int64, Decimal, Single, Double. Decimal is considered "less" than Single because Single can in nearly all implementations have a larger exponent than Decimal (so we prefer "range" over "precision" for promotion).
> Q4. What is the result of a canonical function applied to one (or more) NULL parameters?
>     Possible answers: (a) undefined by the spec; (b) NULL; (c) depends on the function (e.g. boolean-valued functions might return FALSE).
> OrderBy:
> Q5. Where does NULL occur in ascending sort, and where in descending sort?
> Spaces in URLs
> Q6. Examples in the spec show spaces in filters. Shouldn't these be %-encoded (e.g. "%20") so they are valid in URLs?
> Filter Related
> Q7. Which primitive types support the use of LT, LE, GT, GE? (when answering, consider in particular the binary, boolean and geo types)?
> Q8. Which geo types permit the use of EQ and NE? When comparing points (e.g. latitude/longitude for GeographyPoint) is the comparison of coordinates assumed to use Decimal or Double comparison (consider that Single/Double are not usually recommended as suitable for use in database indexes due to the possibility of rounding errors affecting comparisons).
> Q9. Are the LHS and RHS operands for a logical operator allowed to have different types (e.g. LHS=Decimal, RHS=Int32)? If so, then can non-string values be compared with string values?
> Q10. What is the result of division/modulo arithmetic operators where the divisor is zero? Is it undefined by the spec, null, or +/- infinity? (noting that infinity is only applicable to Single/Double).
> Q11. What are the rules for the calculation of the result of modulo where one or both operands are negative?
> Q12. What are the rules for scale of the results of arithmetic operators where the operands are decimal?
> Q13. Which style of rounding is used by the round function (e.g. round-half-even)?
> Q14. Does the 'length' function calculate length according to UTF-8 bytes, UTF-16 characters, or something else? (noting that the CSDL spec defines String as a fixed-length or variable-length sequence of UTF-8 characters, we should just ensure that we have consistent rules for filters).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tools.oasis-open.org/issues/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]