# US 2026/0064675 A1 · Efficient user-defined function execution and artificial intelligence model invocation

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2026/0064675 A1
- Document ID: US20260064675A1
- Status: Published application
- Kind: A1
- Application number: 18/821,241
- Filed: 2024-08-30
- Published: 2026-03-05
- Earliest claimed: 2024-08-30
- Assignees: Hewlett Packard Enterprise Development LP
- Applicants: Hewlett Packard Enterprise Development LP
- Inventors: Ramakumar V. Kosuru; Ronald Tischler; Adam Romayor
- Web page: https://patentgrep.com/patent/US20260064675A1

## CPC

- G06F 16/2452: Query translation
- G06F 16/24542: {Plan optimisation}
- G06F 16/24573: {using data annotations, e.g. user-defined metadata}
- G06F 16/252: {between a Database Management System and a front-end application}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Efficient implementation of user defined functions (UDFs) is provided herein. Specifically, a database management system (DBMS) compiler may receive a UDF and a query that includes a relational operator and an indication of the UDF that is associated with the relational operator. The compiler may attach the UDF to the relational operator in the query plan, which indicates an execution order of components of the query.

## Claims

### Claim 1

A system, comprising:
a database management system (DBMS) compiler comprising computer-implementable instructions that are implemented by a processor to:
receive a user-defined function (UDF);
receive a query comprising:
a relational operator; and
an indication of the UDF associated with the relational operator;
compile the query, by attaching an instance of the UDF to the relational operator in a query plan indicating an execution order of components of the query; and
provide the query plan with the attached instance of the UDF to an execution engine to cause a direct implementation of both the instance of the UDF and the relational operator by the execution engine in accordance with the query plan.

### Claim 2 (depends on 1)

The system of claim 1, comprising: the execution engine, wherein the execution engine is configured to perform the query plan by implementing both the instance of the UDF and the relational operator in accordance with the query plan, without implementation of the instance of the UDF by a UDF interpreter.

### Claim 3 (depends on 2)

The system of claim 2, wherein the query plan comprises an indication to implement:
a plurality of portions of implementation of the relational operator in parallel; and
a plurality of instances of the UDF in parallel.

### Claim 4 (depends on 2)

The system of claim 2, wherein:
the DBMS compiler is configured to:
receive a second UDF;
target a standalone implementation of an instance of the second UDF, by implementing the instance of the second UDF by a UDF interpreter separate from the execution engine; and
the system comprises the UDF interpreter, configured to:
implement the instance of the second UDF; and
provide data resulting from implementing the instance of the second UDF to the execution engine.

### Claim 5 (depends on 4)

The system of claim 4, wherein the DBMS compiler is configured to target the standalone implementation of the instance of the second UDF in response to at least one of:
identifying that the second UDF includes an embedded query;
identifying that an input of the second UDF is not available at the relational operator in the query plan;
identifying a number of a particular component type exceeds a threshold allowance; or
identifying that a locational constraint of the UDF is not met by the relational operator.

### Claim 6 (depends on 5)

The system of claim 5, wherein:
the DBMS compiler is configured to target the standalone implementation of the instance of the second UDF in response to identifying that the locational constraint of the second UDF is not met by the relational operator; and
wherein the DBMS compiler is configured to identify the locational constraint of the second UDF as a restriction from placing the second UDF at a disk process, based upon at least one of:
an estimated processor utilization of the second UDF exceeding a processor utilization threshold;
an estimated memory utilization of the second UDF exceeding a memory utilization threshold;
a number of UDF executions at the disk process exceeding a threshold number of allowed UDF executions;
a size of the second UDF exceeding a UDF size allowance threshold; or
an amount of filtering provided by the second UDF when used as a predicate for the relational operator being below a filtering threshold.

### Claim 7 (depends on 1)

The system of claim 1, comprising:
a UDF compiler, configured to:
receive code written in a procedural language; and
compile the code into the UDF.

### Claim 8 (depends on 1)

The system of claim 1, wherein:
the query plan comprises a relational tree comprising the components of the query ordered in the execution order within the relational tree, wherein the components comprise the relational operator; and
the DBMS compiler is configured to attach the instance of the UDF to the relational operator by coupling the instance of the UDF as an expression item accessible to the relational operator in the relational tree.

### Claim 9 (depends on 1)

The system of claim 1, wherein the DBMS compiler is configured to:
identify whether the UDF exceeds a resource use threshold; and
in response to determining that the UDF exceeds the resource use threshold, restrain implementation of the UDF at a disk process; and
in response to determining that the UDF does not exceed the resource use threshold, permit implementation at least one: the disk process, an executor server process (ESP), or at an application coordinator.

### Claim 10 (depends on 9)

The system of claim 9, wherein the DBMS compiler is configured to:
in response to determining that the UDF exceeds the resource use threshold, determining, based upon characteristics of the UDF, characteristics of an execution of the query, or both, whether the UDF can run in parallel;
in response to determining the UDF can run in parallel, cause parallel implementation of the UDF at the ESP, the application coordinator, or both; and
in response to determining that the UDF cannot run in parallel, cause serial implementation of the UDF.

### Claim 11 (depends on 1)

The system of claim 1,
wherein the UDF encapsulates weights of an Artificial Intelligence (AI) model to invoke the AI model directly via the execution engine, indirectly from a remote procedure call, or both.

### Claim 12

A computer-implemented method, comprising:
receive a user-defined function (UDF);
receive a query comprising:
a relational operator; and
an indication of the UDF;
compile the query, by attaching an instance of the UDF to the relational operator in a query plan indicating an execution order of components of the query; and
provide the query plan with the attached instance of the UDF to a database management system (DBMS) execution engine to cause a direct implementation of both the instance of the UDF and the relational operator by the DBMS execution engine in accordance with the query plan.

### Claim 13 (depends on 12)

The computer-implemented method of claim 12, comprising performing the query plan, by implementing both the UDF and the relational operator via the DBMS execution engine, in accordance with the query plan.

### Claim 14 (depends on 13)

The computer-implemented method of claim 13, comprising implementing:
a plurality of portions of the relational operator in parallel; and
a plurality of instances of the UDF in parallel.

### Claim 15 (depends on 13)

The computer-implemented method of claim 13, comprising:
receiving a second UDF;
refraining from targeting implementation of the second UDF to the DBMS execution engine based upon at least one of:
identifying that the second UDF includes an embedded query;
identifying that an input of the second UDF is not available at the relational operator in the query plan;
identifying a number of a particular component type exceeds a threshold allowance; or
identifying that a locational constraint of the second UDF is not met by the relational operator; and
targeting the implementation of the second UDF to a UDF interpreter separate from the DBMS execution engine.

### Claim 16 (depends on 15)

The computer-implemented method of claim 15, comprising:
identifying that the locational constraint of the second UDF is not met by the relational operator, wherein the locational constraint comprises a restriction from placing the second UDF at a disk process where the relational operator is implemented, based upon at least one of:
an estimated processor utilization of the second UDF exceeding a processor utilization threshold;
an estimated memory utilization of the second UDF exceeding a memory utilization threshold;
a number of UDF executions at the disk process exceeding a threshold number of allowed UDF executions;
a size of the second UDF exceeding a UDF size allowance threshold; or
an amount of filtering provided by the second UDF when used as a predicate for the relational operator is below a filtering threshold.

### Claim 17 (depends on 12)

The computer-implemented method of claim 12, comprising:
attaching the UDF to the relational operator by coupling the UDF to the relational operator in a relational tree of the query plan that comprises the components of the query ordered in the execution order.

### Claim 18

A non-transitory, computer-readable medium, comprising computer-readable instructions that, when executed by one or more processors of one or more computers, cause the one or more computers to:
receive a user-defined function (UDF) configured to return a value based upon operations to data in a database;
receive a database query comprising:
a relational operator; and
an indication of the UDF associated with the relational operator in the database query;
compile the database query, targeting execution of the UDF directly by a database management system (DBMS) execution engine that executes the relational operator, by attaching an instance of the UDF to the relational operator in a query plan indicating an execution order of components of the database query; and
provide the query plan with the attached instance of the UDF to the DBMS execution engine to cause a direct implementation of both the instance of the UDF and the relational operator by the DBMS execution engine in accordance with the query plan.

### Claim 19 (depends on 18)

The non-transitory, computer-readable medium of claim 18, comprising computer-readable instructions that, when executed by the one or more processors of the one or more computers, cause the one or more computers to:
implement the UDF as a first class citizen of the database that is accessible by an execution of the relational operator.

### Claim 20 (depends on 18)

The non-transitory, computer-readable medium of claim 18, comprising computer-readable instructions that, when executed by the one or more processors of the one or more computers, cause the one or more computers to:
receive a second UDF;
determine to refrain from targeting implementation of the second UDF to the DBMS execution engine in response to at least one of:
identifying that the second UDF includes an embedded query;
identifying that an input of the second UDF is not available at the relational operator in the query plan; or
identifying that a locational constraint of the second UDF is not met by the relational operator; and
in response to determining to refrain from targeting the implementation of the second UDF to the DBMS execution engine, target implementation of the second UDF to a UDF interpreter separate from the DBMS execution engine.
