All Products
Search
Document Center

Tablestore:Use UDFs to process data

Last Updated:Aug 11, 2023

If your data stored in Tablestore is uniquely structured and requires customized processing, such as parsing a specific JSON string, you can use User Defined Function (UDF) to define development logic.

Procedure

  1. Install MaxCompute-Java/MaxCompute-Studio in IntelliJ IDEA. For more information, see Install MaxCompute Studio.

    After the plug-in is installed, you can start development.

    The following figure shows the definition of a simple UDF that connects two strings. MaxCompute supports more complex UDFs, such as user-defined window execution logic. For more information, see Develop a UDF. fig_udf_001

  2. Package resources and upload the JAR package to MaxCompute. For more information, see Package a Java program, upload the package, and create a MaxCompute UDF.

  3. Run bin/odpscmd.bat.

    // Select a row of data and pass in name/name to the UDF. A connection of the two strings is returned.
    select cloud_metric_extract_md5(name, name) as udf_test from test_table limit 1;                    

    The following result is returned:

    fig_udf_004