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

In JDBC adapter, generate dialect-specific SQL for FLOOR operator

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.13.0
    • jdbc-adapter

    Description

      The FLOOR operator (on dates) is currently broken for all jdbc dialects.
      The syntax allowed by the parser looks like: "FLOOR(datetime to timeUnit)".
      However no jdbc dialect (as far as I'm aware) actually name the function FLOOR:
      In postgres: DATE_TRUNC('year', my_datetime)
      In hsqldb: TRUNC ( my_datetime, 'YYYY' )
      In oracle: TRUNC(my_datetime, 'YEAR')
      In mysql: There's no direct equivalent in mysql (though it could be emulated with some nasty timestamp diffing)

      The other issue is that the timeUnits are sometimes also named differently by each dialect (e.g. 'YYYY' in hsqldb).

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            julianhyde Julian Hyde
            chris-baynes Chris Baynes
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment