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

Allow TableMacro to consume Maps and Collections

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.0-incubating
    • Component/s: None
    • Labels:
      None

      Description

      Actually it is not possible to pass to TableMacro smth like

      TABLE(MY_TABLE('simpleName', MAP[ 'key', 'value', 'anotherKey', 'anotherValue' ] ))

      SqlUserDefinedTableMacro.convertArguments leads to IllegalArgumentException: All arguments of call to macro XXX should be literal.

        Activity

        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/882477b8 .
        Hide
        vladimir.dolzhenko Vladimir Dolzhenko added a comment - - edited

        It looks good, but there is a small issue :

        MAP[ 'key', 'value' ] is parsed as Map<String, String> contains string literals with single quotes:

         map.get( 'key' ) .equals ( 'value' ) 

        while expected w/o them

        Show
        vladimir.dolzhenko Vladimir Dolzhenko added a comment - - edited It looks good, but there is a small issue : MAP[ 'key', 'value' ] is parsed as Map<String, String> contains string literals with single quotes: map.get( 'key' ) .equals ( 'value' ) while expected w/o them
        Hide
        vladimir.dolzhenko Vladimir Dolzhenko added a comment -

        The actual workaround (to me) is to use eval( Map<SqlLiteral, SqlLiteral> ) and after that manually translate to Map<String, String> handling SqlCharStringLiteral - so it is quite unclear that in case of eval(Map<String, String>) it would be converted with single quotes in it.

        Show
        vladimir.dolzhenko Vladimir Dolzhenko added a comment - The actual workaround (to me) is to use eval( Map<SqlLiteral, SqlLiteral> ) and after that manually translate to Map<String, String> handling SqlCharStringLiteral - so it is quite unclear that in case of eval(Map<String, String>) it would be converted with single quotes in it.
        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/abe76e3d .
        Hide
        julianhyde Julian Hyde added a comment -

        Closing now that 1.1.0-incubating has been released.

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

          People

          • Assignee:
            julianhyde Julian Hyde
            Reporter:
            vladimir.dolzhenko Vladimir Dolzhenko
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development