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

Add a set of built-in scalar functions to Table API & SQL

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: Table SQL / API
    • Labels:

      Description

      In this JIRA, we will create some sub-tasks for adding specific scalar functions such as mathematical-function LOG, date-functions
      DATEADD, string-functions LPAD, etc.

      How to contribute a built-in scalar function
      Thank you very much for contributing a built-in function. In order to make sure your contributions are in a good direction, it is recommended to read the following instructions.

      1. Investigate the behavior of the function that you are going to contribute in major DBMSs. This is very important since we have to understand the exact semantics of the function.
      2. It is recommended to add function for both SQL and table-API (Java and Scala).
      3. For every scalar function, add corresponding docs which should include a SQL, a Java and a Scala version in ./docs/dev/table/functions.md. Make sure your description of the function is accurate. Please do not simply copy documentation from other projects, especially if the projects are not Apache licensed.
      4. Take overflow, NullPointerException and other exceptions into consideration.
      5. Add unit tests for every new function and its supported APIs. Have a look at ScalarFunctionsTest, SqlExpressionTest, ScalaFunctionsValidationTest, etc. for how to implement function tests.

        Welcome anybody to add the sub-task about standard database scalar function.

      Note: Usually, adding a runtime function to ScalarFunctions.scala is sufficient. However, sometimes it makes sense to implement a CallGenerator for FunctionGenerator to leverage object reuse. E.g., HashCalcCallGen creates a MessageDigest only once for SHA2 if the parameters are literals.

        Attachments

        1. how to add a scalar function.png
          159 kB
          Xingcan Cui
        1.
        Add TIMESTAMPADD supported in SQL Sub-task Resolved sunjincheng  
        2.
        Add TIMESTAMPADD supported in TableAPI Sub-task Resolved sunjincheng  
        3.
        Add TIMESTAMPDIFF supported in SQL Sub-task Resolved sunjincheng  
        4.
        Add TIMESTAMPDIFF supported in TableAPI Sub-task Resolved Unassigned  
        5.
        Add LOG(X) supported in SQL Sub-task Resolved sunjincheng  
        6.
        ADD LOG(X) supported in TableAPI Sub-task Closed Jiayi Liao  
        7.
        Add L/RPAD supported in SQL Sub-task Resolved sunjincheng  
        8.
        Add L/RPAD supported in TableAPI Sub-task Resolved sunjincheng  
        9.
        Add BIN supported in SQL & Table API Sub-task Resolved sunjincheng  
        10.
        Add BIN supported in TableAPI Sub-task Resolved sunjincheng  
        11.
        Add STR_TO_DATE supported in SQL Sub-task In Progress Jiayi Liao  
        12.
        Add STR_TO_DATE supported in TableAPI Sub-task Open Zhanchun Zhang  
        13.
        Add CONCAT/CONCAT_WS supported in SQL Sub-task Closed sunjincheng  
        14.
        Add CONCAT/CONCAT_WS supported in TableAPI Sub-task Closed sunjincheng  
        15.
        Add support for MD5, SHA1 and SHA2 Sub-task Closed Michael Gendelman  
        16.
        Add MD5/SHA1/SHA2 supported in TableAPI Sub-task Closed Alexandr Arkhipov  
        17.
        Add E() supported in SQL Sub-task Closed sunjincheng  
        18.
        Add E() supported in TableAPI Sub-task Resolved Timo Walther  
        19.
        Add DATE_FORMAT supported in SQL Sub-task Closed Unassigned  
        20.
        Add UUID supported in TableAPI/SQL Sub-task Resolved Jiayi Liao  
        21.
        Fix Mod scala function bug Sub-task Resolved sunjincheng  
        22.
        Add ASCII/CHR function for table/sql API Sub-task In Progress vinoyang  
        23.
        Add regexp_extract supported in TableAPI and SQL Sub-task Resolved vinoyang  
        24.
        Add regexp_replace supported in TableAPI and SQL Sub-task Resolved vinoyang  
        25.
        Add ISNUMERIC supported in Table API/SQL Sub-task Closed vinoyang  
        26.
        Add LTRIM supported in Table API and SQL Sub-task Resolved vinoyang  
        27.
        Add RTRIM supported in Table API and SQL Sub-task Resolved vinoyang  
        28.
        Add FROM_BASE64 function for table/sql API Sub-task Resolved vinoyang  
        29.
        Add TO_BASE64 function for table/sql API Sub-task Resolved vinoyang  
        30.
        Add REPEAT supported in Table API and SQL Sub-task Resolved vinoyang  
        31.
        Add replace supported in TableAPI and SQL Sub-task Resolved Guibo Pan  
        32.
        Add reverse supported in TableAPI and SQL Sub-task In Progress Guibo Pan  
        33.
        Add LOG2 function for table/sql API Sub-task Resolved vinoyang  
        34.
        Add REGEXP_MATCH in TableAPI and SQL Sub-task Open Unassigned  
        35.
        Add Cosh math function supported in Table API and SQL Sub-task Closed vinoyang  
        36.
        Add Sinh math function supported in Table API and SQL Sub-task Closed vinoyang  
        37.
        Add Tanh math function supported in Table API and SQL Sub-task Closed vinoyang  
        38.
        Add COTH math function supported in Table API and SQL Sub-task Closed Aleksei Izmalkin
        39.
        Add CBRT math function supported in Table API and SQL Sub-task Closed Aleksei Izmalkin
        40.
        Add HYPOT math function supported in Table API and SQL Sub-task Closed Aleksei Izmalkin
        41.
        Add REMAINDER math function supported in Table API and SQL Sub-task In Progress Max Efremov  
        42.
        Add support for IS DISTINCT FROM in code generator Sub-task Open xueyu  
        43.
        Add support for IS NOT DISTINCT FROM in code generator Sub-task Open Hequn Cheng  
        44.
        Add Reverse function supported in Table API and SQL Sub-task Open Zhanchun Zhang
        45.
        [Bitwise Functions] Add BIT_AND, BIT_OR functions supported in Table API and SQL Sub-task Open Zhanchun Zhang  
        46.
        [Bitwise Functions] Add BIT_LSHIFT, BIT_RSHIFT functions supported in Table API and SQL Sub-task Open Zhanchun Zhang  
        47.
        [Bitwise Functions] Add BIT_XOR function supported in Table API and SQL Sub-task Open Zhanchun Zhang  

          Activity

            People

            • Assignee:
              sunjincheng121 sunjincheng
              Reporter:
              sunjincheng121 sunjincheng
            • Votes:
              0 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m