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

Create handlers for JDBC dialect-specific generated SQL

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.14.0
    • jdbc-adapter
    • None

    Description

      Currently the only way to generate different sql for dialects is to switch on the dialect in the unparse method. This is used quite heavily in e.g. SqlFloorFunction, but there are also switches in:

      • SUBSTRING()
      • SqlDateLiteral quoting
      • SqlTimestampLiteral quoting
      • Dialects using different interval literals (e.g. Hsqldb uses YYYY & MM rather than YEAR & MONTH)
      • limit/offset construction
      • mysql isnull function
      • type differences

      It would be great to have dialect specific handlers to deal with these, making testing & addition of new handlers (new dialects, or new overrides for a given function) much easier in the future.

      One suggested path to approach this: https://issues.apache.org/jira/browse/CALCITE-1798?focusedCommentId=16031609&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16031609

      There is a comment in SqlImplementor that reads "MySQL doesn't have a VARCHAR type, only CHAR.". Not sure if this was for a very old version of mysql, but it's certainly not true anymore.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: