Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_WD01
    • Fix Version/s: V4.0_WD01
    • Component/s: CSDL XML
    • Labels:
      None
    • Environment:

      [Closed]

      Description

      Computer history has provided us with a growing number of numeric data types, and quite a few of them are reflected in Edm primitive types.

      Integer types:

      • Byte (0..2^8)
      • SByte
      • Int16
      • Int32
      • Int64
      • Decimal Scale=0

      Fixed-point types

      • Decimal with VariableScale="false", see ODATA-76

      Floating-point types

      • Decimal with VariableScale="true", see ODATA-76
      • Single
      • Double

      Especially for defining vocabularies it would be helpful to have an abstract type Edm.Number that can be applied to any of the numeric primitive types.

        Attachments

          Activity

          ralfhandl Ralf Handl created issue -
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          I was going to enter this same issue, for tracking purposes, although I propose we NOT do this. Most implementations have the concept of a 16, 32, or 64 bit integer and it's actually simpler to have the discrete types that reflect those common types than to attempt to define through facets (i.e., MaxValue on a Double, are not straightforward to represent.)

          Show
          mikep Michael Pizzo (Inactive) added a comment - I was going to enter this same issue, for tracking purposes, although I propose we NOT do this. Most implementations have the concept of a 16, 32, or 64 bit integer and it's actually simpler to have the discrete types that reflect those common types than to attempt to define through facets (i.e., MaxValue on a Double, are not straightforward to represent.)
          Hide
          ralfhandl Ralf Handl added a comment -

          We can instead add

          • Edm.Quadruple
          • Edm.DecFloat16
          • Edm.DecFloat34
            to the Edm type system, although one can argue that this is the opposite of simplification.
          Show
          ralfhandl Ralf Handl added a comment - We can instead add Edm.Quadruple Edm.DecFloat16 Edm.DecFloat34 to the Edm type system, although one can argue that this is the opposite of simplification.
          Hide
          evan.ireland Evan Ireland (Inactive) added a comment -

          In the SAP enterprise mobility space, we took a simple subset of XML schema types that has proven to be quite sufficient:

          byte (signed)
          short (Int16)
          int (Int32)
          long (int64)
          integer ("lots" of digits, but no fraction)
          decimal ("lots" of digits)
          float
          double

          With this set of 8 types, we have had sucess in interopating across multiple client platforms (Java ME, Java SE, Windows CE, iOS) and I have not heard any reports of "missing" types causing any difficulty.

          I recommend caution with any proposal to introduce quad precision binary floating point, or even decimal floating point for that matter. I do not believe that the support is there for such types across a sufficient number of the client types that may need to interoperate with OData services.

          Show
          evan.ireland Evan Ireland (Inactive) added a comment - In the SAP enterprise mobility space, we took a simple subset of XML schema types that has proven to be quite sufficient: byte (signed) short (Int16) int (Int32) long (int64) integer ("lots" of digits, but no fraction) decimal ("lots" of digits) float double With this set of 8 types, we have had sucess in interopating across multiple client platforms (Java ME, Java SE, Windows CE, iOS) and I have not heard any reports of "missing" types causing any difficulty. I recommend caution with any proposal to introduce quad precision binary floating point, or even decimal floating point for that matter. I do not believe that the support is there for such types across a sufficient number of the client types that may need to interoperate with OData services.
          Hide
          evan.ireland Evan Ireland (Inactive) added a comment -

          I should have added that I do not recommend the introduction of a basic Numeric type. It should be permissable to use facets on other types (Int32, Double etc) to specify valid ranges. Forcing the modeler to at least choose an initial type that is "close" to the range and precision of the target value is preferable to allowing the modeler to be "vague", which has folow-on effects for clients (e.g. Java clients being forced to use BigDecimal for all numeric values if the modeler is not careful enough).

          Show
          evan.ireland Evan Ireland (Inactive) added a comment - I should have added that I do not recommend the introduction of a basic Numeric type. It should be permissable to use facets on other types (Int32, Double etc) to specify valid ranges. Forcing the modeler to at least choose an initial type that is "close" to the range and precision of the target value is preferable to allowing the modeler to be "vague", which has folow-on effects for clients (e.g. Java clients being forced to use BigDecimal for all numeric values if the modeler is not careful enough).
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          Evan's list pretty closely matches what we currently have in OData, which is encouraging. Note that we used to be slightly closer (we recently got rid of "float", but have its synonym "single"). The only one missing is an integer larger than int64.

          Is such a large integer required? Do we have examples where services need to store values that large? Are a sufficient number of clients prepared for such large values?

          If so, I would propose we add an Edm.HugeInt (or some such). If we don't have requirements for such a type at this point, and examples of clients prepared to support them, I would propose we keep the primitive types as-is and consider adding larger int (and perhaps decimal) values in the future as required.

          Show
          mikep Michael Pizzo (Inactive) added a comment - Evan's list pretty closely matches what we currently have in OData, which is encouraging. Note that we used to be slightly closer (we recently got rid of "float", but have its synonym "single"). The only one missing is an integer larger than int64. Is such a large integer required? Do we have examples where services need to store values that large? Are a sufficient number of clients prepared for such large values? If so, I would propose we add an Edm.HugeInt (or some such). If we don't have requirements for such a type at this point, and examples of clients prepared to support them, I would propose we keep the primitive types as-is and consider adding larger int (and perhaps decimal) values in the future as required.
          ralfhandl Ralf Handl made changes -
          Field Original Value New Value
          Proposal Define a single Numeric data type with facets to specify its range and precision, e.g.
          - MinValue
          - MaxValue
          - ItFloats
          - ...

          Have a close look at XML Schema 1.1 and IEEE 754 to detect the required facets.
          Define an abstract type Edm.Number as a specialization of Edm.PrimitiveType and a generalization of all numeric primitive types that can be used in term definitions and in complex types used within term definitions.
          Description Computer history has provided us with a growing number of numeric data types, and quite a few of them are reflected in Edm primitive types.

          Integer types:
          - Byte (0..2^8)
          - SByte
          - Int16
          - Int32
          - Int64
          - Decimal Scale=0

          Fixed-point types
          - Decimal --> not sure yet if this is fixed or floating point, see ODATA-76

          Floating-point types
          - Decimal --> not sure yet if this is fixed or floating point, see ODATA-76
          - Single
          - Double

          Missing numeric types
          - Quadruple == binary128
          - DECFLOAT in various lengths
          Computer history has provided us with a growing number of numeric data types, and quite a few of them are reflected in Edm primitive types.

          Integer types:
          - Byte (0..2^8)
          - SByte
          - Int16
          - Int32
          - Int64
          - Decimal Scale=0

          Fixed-point types
          - Decimal with VariableScale="false", see ODATA-76

          Floating-point types
          - Decimal with VariableScale="true", see ODATA-76
          - Single
          - Double

          Especially for defining vocabularies it would be helpful to have an abstract type Edm.Number that can be applied to any of the numeric primitive types.

          Environment [Proposed]
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          The latest proposal appears to be introducing an "abstract" type that can be applied in some places (i.e., vocabularies) but not others (i.e., properties). While I like the idea, the fact that we use ComplexType in both term definitions and models makes it difficult to enforce restrictions based on the usage.

          There are other cases where we've recently added "abstract" typeslike Edm.PrimitiveType, Edm.ComplexType, and Edm.EntityType and had to define rules around what could be used in each of the different contexts.

          Before adding more special-use types, I'd like to see if we can rationalize all of these with some easy to understand rules about what types can be used where.

          Show
          mikep Michael Pizzo (Inactive) added a comment - The latest proposal appears to be introducing an "abstract" type that can be applied in some places (i.e., vocabularies) but not others (i.e., properties). While I like the idea, the fact that we use ComplexType in both term definitions and models makes it difficult to enforce restrictions based on the usage. There are other cases where we've recently added "abstract" typeslike Edm.PrimitiveType, Edm.ComplexType, and Edm.EntityType and had to define rules around what could be used in each of the different contexts. Before adding more special-use types, I'd like to see if we can rationalize all of these with some easy to understand rules about what types can be used where.
          ralfhandl Ralf Handl made changes -
          Proposal Define an abstract type Edm.Number as a specialization of Edm.PrimitiveType and a generalization of all numeric primitive types that can be used in term definitions and in complex types used within term definitions. Close without action

          Accepted: https://www.oasis-open.org/committees/download.php/48549/odata-meeting-29_on-20130314-minutes.html#odata-256
          Status New [ 10000 ] Open [ 1 ]
          ralfhandl Ralf Handl made changes -
          Status Open [ 1 ] Closed [ 6 ]
          ralfhandl Ralf Handl made changes -
          Environment [Proposed] [Closed]
          Status Closed [ 6 ] Open [ 1 ]
          ralfhandl Ralf Handl made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          ralfhandl Ralf Handl made changes -
          Status Resolved [ 5 ] Applied [ 10002 ]
          ralfhandl Ralf Handl made changes -
          Status Applied [ 10002 ] Closed [ 6 ]
          handl Ralf Handl made changes -
          Reporter Ralf Handl [ ralfhandl ] Ralf Handl [ handl ]
          handl Ralf Handl made changes -
          Assignee Ralf Handl [ handl ]

            People

            • Assignee:
              handl Ralf Handl
              Reporter:
              handl Ralf Handl
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: