Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-530 Phoenix support
  3. CALCITE-494

Support NEXT/CURRENT VALUE FOR syntax for sequences usage

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0-incubating
    • Component/s: None
    • Labels:

      Description

      Support the ANSI standard NEXT VALUE FOR and CURRENT VALUE FOR syntax to access/increment sequence values. See http://phoenix.apache.org/sequences.html and http://phoenix.apache.org/language/index.html#sequence for examples.

        Activity

        Hide
        julianhyde Julian Hyde added a comment -

        The syntax is quite straightforward.

        Calcite already has a NEXT_VALUE operator in SqlStdOperatorTable (not used). We would add a CURRENT_VALUE operator.

        Generating code to implementing sequences is a matter of providing implementors for those functions, in whichever language we are targeting. James Taylor, would we need an extra (hidden) parameter to the function so that the function knows whether it is being called for the 2nd time on the same row or whether it has advanced to a new row?

        Need to add definitions of sequences to the Schema SPI.

        Expose them a JDBC metadata (they are apparently a table-type), per http://stackoverflow.com/questions/5637423/how-to-retrieve-sequences-metadata-from-jdbc:

        meta.getTables(connection.getCatalog(), null, "%_FOO", new String[] { "SEQUENCE" });
        
        Show
        julianhyde Julian Hyde added a comment - The syntax is quite straightforward. Calcite already has a NEXT_VALUE operator in SqlStdOperatorTable (not used). We would add a CURRENT_VALUE operator. Generating code to implementing sequences is a matter of providing implementors for those functions, in whichever language we are targeting. James Taylor , would we need an extra (hidden) parameter to the function so that the function knows whether it is being called for the 2nd time on the same row or whether it has advanced to a new row? Need to add definitions of sequences to the Schema SPI. Expose them a JDBC metadata (they are apparently a table-type), per http://stackoverflow.com/questions/5637423/how-to-retrieve-sequences-metadata-from-jdbc: meta.getTables(connection.getCatalog(), null , "%_FOO" , new String [] { "SEQUENCE" });
        Show
        julianhyde Julian Hyde added a comment - Work in progress https://github.com/julianhyde/incubator-calcite/tree/calcite-494
        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/f2df8e7c .
        Hide
        julianhyde Julian Hyde added a comment -

        Closing now that 1.0.0-incubating has been released.

        Show
        julianhyde Julian Hyde added a comment - Closing now that 1.0.0-incubating has been released.

          People

          • Assignee:
            julianhyde Julian Hyde
            Reporter:
            jamestaylor James Taylor
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development