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

Jdbc dialect specific FLOOR fails when in GROUP BY

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.14.0
    • Component/s: jdbc-adapter
    • Labels:
      None

      Description

      Currently the SqlFloorFunction sometimes modifies the operands in a SqlCall (i.e. replaceTimeUnitOperand). This is fine if the floor is only used in a project, but when used again in an aggregate this modification will change the aggregate, which will break the unparsing of it there.

      This can be reproduced by adding a "group by" to the RelToSqlConverterTest#testFloor.

      SqlBasicCall#clone is a shallow clone so cannot be used to fix the problem (since the underlying operands are not cloned).

        Issue Links

          Activity

          Hide
          michaelmior Michael Mior added a comment -

          Resolved in release 1.14.0 (2017-10-01)

          Show
          michaelmior Michael Mior added a comment - Resolved in release 1.14.0 (2017-10-01)
          Hide
          julianhyde Julian Hyde added a comment -

          Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/8cb189f7. I added test cases for a few more dialects. Thanks for the PR, Chris Baynes!

          Show
          julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/8cb189f7 . I added test cases for a few more dialects. Thanks for the PR, Chris Baynes !
          Hide
          chris-baynes Chris Baynes added a comment -

          I've created a PR that fixes this: https://github.com/apache/calcite/pull/489

          Show
          chris-baynes Chris Baynes added a comment - I've created a PR that fixes this: https://github.com/apache/calcite/pull/489

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              chris-baynes Chris Baynes
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development