Skip to content

Make ECSql Units aware #8876

@ColinKerr

Description

@ColinKerr

EC schemas contain units information but ECSql doesn't use that information.

Consider supporting the following things:

  • Unit information exposed via query results metadata
  • Explicit unit conversion e.g. SELECT Length @ 'Units:FT' FROM Pipe returns the value of length converted to feet.
  • Unit aware math. e.g. SELECT Length + '2 Units.IN' FROM Pipe returns the length in persistence units (M) with 2 inches added. Or SELECT Length * Width FROM Door would return an area in meters squared
    • Consider other options for how to encode units in literals.
  • Any operation using incompatible units should fail. e.g. if Length has no or incompatible persistence unit defined the operation will fail with a descriptive error

Support should not include:

  • Numeric string formatting support, it should only return the converted double value.
  • Automatic detection of presentation unit and auto conversion to it. ECSql should always include explicit input defining the presentation unit.

Existing implementation to in Postgres: https://github.com/df7cb/postgresql-unit

Metadata

Metadata

Assignees

No one assigned

    Labels

    ecdbECDb and ECSQL related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions