Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-5678

User-defined TableFunctions do not support all types of parameters

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.1
    • Component/s: Table API & SQL
    • Labels:
      None

      Description

      It seems that TableFunctions do not support all types of parameters. E.g.

      XXX.select("1000L AS time").join("mytf(time)");
      
      public static class MyTableFunction extends TableFunction<Row> {
      	public void eval(Long ts) {
      		Row r = new Row(2);
      		r.setField(0, ts);
      		collect(r);
      	}
      }
      

      leads to

      Exception in thread "main" org.apache.flink.table.codegen.CodeGenException: No matching signature found.
      	at org.apache.flink.table.codegen.calls.TableFunctionCallGen$$anonfun$1.apply(TableFunctionCallGen.scala:47)
      	at org.apache.flink.table.codegen.calls.TableFunctionCallGen$$anonfun$1.apply(TableFunctionCallGen.scala:47)
      	at scala.Option.getOrElse(Option.scala:120)
      	at org.apache.flink.table.codegen.calls.TableFunctionCallGen.generate(TableFunctionCallGen.scala:47)
      	at org.apache.flink.table.codegen.CodeGenerator.visitCall(CodeGenerator.scala:1011)
      

        Issue Links

          Activity

          Hide
          twalthr Timo Walther added a comment -

          The described autocasting "DATE/TIME is equal to int, TIMESTAMP is equal to long." does also not work for TableFunctions.

          Show
          twalthr Timo Walther added a comment - The described autocasting "DATE/TIME is equal to int, TIMESTAMP is equal to long." does also not work for TableFunctions.
          Hide
          jark Jark Wu added a comment -

          Thank you for reporting this, I will look into this.

          Show
          jark Jark Wu added a comment - Thank you for reporting this, I will look into this.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user wuchong opened a pull request:

          https://github.com/apache/flink/pull/3233

          FLINK-5678 [table] Fix User-defined Functions do not support all types of parameters

          Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
          If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
          In addition to going through the list, please provide a meaningful description of your changes.

          • [ ] General
          • The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
          • The pull request addresses only one issue
          • Each commit in the PR has a meaningful commit message (including the JIRA id)
          • [ ] Documentation
          • Documentation has been added for new functionality
          • Old documentation affected by the pull request has been updated
          • JavaDoc for public methods has been added
          • [ ] Tests & Build
          • Functionality added by the pull request is covered by tests
          • `mvn clean verify` has been executed successfully locally or a Travis build has passed

          The bug of FLINK-5678 (doesn't support Long and temporal types) is not only happen in TableFunctions but also ScalarFunctions. I fixed them and added some tests. @twalthr Could you have a look to make sure that I didn't miss anything ?

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/wuchong/flink udf-type-fix-FLINK-5678

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/flink/pull/3233.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #3233


          commit 2b72a3b42137a3f06a23167de2aee10f7f5191ec
          Author: Jark Wu <wuchong.wc@alibaba-inc.com>
          Date: 2017-01-29T12:36:28Z

          FLINK-5678 [table] Fix User-defined Functions do not support all types of parameters


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user wuchong opened a pull request: https://github.com/apache/flink/pull/3233 FLINK-5678 [table] Fix User-defined Functions do not support all types of parameters Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration. If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide] ( http://flink.apache.org/how-to-contribute.html ). In addition to going through the list, please provide a meaningful description of your changes. [ ] General The pull request references the related JIRA issue (" [FLINK-XXX] Jira title text") The pull request addresses only one issue Each commit in the PR has a meaningful commit message (including the JIRA id) [ ] Documentation Documentation has been added for new functionality Old documentation affected by the pull request has been updated JavaDoc for public methods has been added [ ] Tests & Build Functionality added by the pull request is covered by tests `mvn clean verify` has been executed successfully locally or a Travis build has passed The bug of FLINK-5678 (doesn't support Long and temporal types) is not only happen in TableFunctions but also ScalarFunctions. I fixed them and added some tests. @twalthr Could you have a look to make sure that I didn't miss anything ? You can merge this pull request into a Git repository by running: $ git pull https://github.com/wuchong/flink udf-type-fix- FLINK-5678 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/3233.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3233 commit 2b72a3b42137a3f06a23167de2aee10f7f5191ec Author: Jark Wu <wuchong.wc@alibaba-inc.com> Date: 2017-01-29T12:36:28Z FLINK-5678 [table] Fix User-defined Functions do not support all types of parameters
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user twalthr commented on the issue:

          https://github.com/apache/flink/pull/3233

          Thanks for fixing this issue @wuchong! The general fix looks good. I just added the case that boxed types of temporal types can also represent null values. I will merge this...

          Show
          githubbot ASF GitHub Bot added a comment - Github user twalthr commented on the issue: https://github.com/apache/flink/pull/3233 Thanks for fixing this issue @wuchong! The general fix looks good. I just added the case that boxed types of temporal types can also represent null values. I will merge this...
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/flink/pull/3233

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/3233
          Hide
          twalthr Timo Walther added a comment -

          Fixed in 1.3: 126fb1779b84a934dd6bb632c96a7666ac8c521e
          Fixed in 1.2: f523deca8955257a6aeaafe4012a871307ea607a

          Show
          twalthr Timo Walther added a comment - Fixed in 1.3: 126fb1779b84a934dd6bb632c96a7666ac8c521e Fixed in 1.2: f523deca8955257a6aeaafe4012a871307ea607a

            People

            • Assignee:
              jark Jark Wu
              Reporter:
              twalthr Timo Walther
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development