Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4838

Add RoundingMode in RelDataTypeSystem to specify the rounding behavior

    XMLWordPrintableJSON

Details

    Description

      According to the SQL Strandard about how to cast an approximate numeric to int in different database have different RoundingMode. for example:

      In PostgreSQL、Mysql、Oracle(RoundingMode.HALF_UP):

      select cast(5.1 as int) return 5
      select cast(5.5 as int) return 6
      select cast(-5.5 as int) return -6

      In Calcite、Sql Server 2008(RoundingMode.DOWN):

      select cast(5.1 as int) return 5
      select cast(5.5 as int) return 5
      select cast(-5.5 as int) return -5
      

       

      Attachments

        Issue Links

          Activity

            People

              nobigo xiong duan
              nobigo xiong duan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: