Overview
Function Description
Remote User-Defined Table-Generating Functions (UDTFs) apply to one-in-multiple-out data operations. That is, remote UDTFs read a row of data and output multiple values as a table.
This section explains the steps to develop a remote UDTF and call it from a computing engine, using FunctionGraph as the execution platform for the remote UDTF.
Solution Benefits
The advantages of remote UDTFs include risk isolation, resource decoupling, and cost optimization.
- Risk isolation: Although technically feasible, executing UDTFs in critical production environments can introduce execution risks.
Remote UDTFs offload the computing logic to FunctionGraph, maintaining service functionality while isolating risks through a serverless architecture.
- Resource decoupling: For resource-intensive tasks like large model inference, remote UDFs avoid long-term resource occupation in Spark clusters. This ensures stability, cost-effectiveness, and functionality by offloading heavy computations to FunctionGraph.
- Cost optimization: Remote UDTFs turn the default queue into a pure data channel, removing risks caused by UDTFs and offering more cost-effective and secure core data flow services to users.
Environment Preparations
Before developing and debugging a remote UDTF using FunctionGraph, you must install IDEA, configure Maven, download required JAR files, and set up the FunctionGraph service.
| Preparation Item | Description |
|---|---|
| Operating system (OS) | Windows 7 or a later version is required. |
| JDK | JDK 1.8 is required. |
| IntelliJ IDEA | IntelliJ IDEA 2019.1 or a compatible version is required. |
| Maven | Basic configurations of the development environment. Maven is used for project management throughout the lifecycle of software development. |
| Dependency JAR file download | Download the dependency JAR file spark-function-sdk_2.13-jar-with-dependencies.jar from https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/. |
Comparison of UDTF and Remote UDTF
- UDTF: Ideal for high-performance scenarios where the development team is familiar with the query engine's language. It offers high execution efficiency but has lower flexibility and security.
- Remote UDTF: Best for scenarios that require external service calls, multi-language development, or high flexibility in the development language. It provides better security and greater development flexibility.
| Feature | UDTF | Remote UDTF |
|---|---|---|
| Execution method | Runs locally on the query engine. | Executes through a function hosting service. |
| Security | Instability in UDTF code may affect the query engine process. | Execution failures only impact the UDTF itself, not the overall job process. |
| Performance | High execution efficiency | Comparable to local UDTFs in vectorized and batch modes. |
| Development flexibility | Highly coupled with query engine code, with limited flexibility. | Highly flexible and applicable to external services or libraries. |
| Development cost | Requires familiarity with the query engine, with high development cost. | Lower development cost due to reduced complexity. |
| Use case | High-performance scenarios where the team knows the query engine languages. | Scenarios needing flexible development languages or external service calls. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot