IP Library › Granted Patent US 12,174,817
Granted Patent B2
US 12,174,817 · App. 18/338,938 · Granted Dec 24, 2024

Processing user-defined functions (UDFs) using multiple execution environments

Inventors: Elliott Brossard (Kirkland, WA); Chong Han (Bellevue, WA); Igor Zinkovsky (Redmond, WA)
Assignee: Snowflake Inc.
G06F16/2291G06F16/221G06F16/248G06F16/258G06F16/27
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,174,817
App. No.
18/338,938
Granted
Dec 24, 2024
Kind
B2
Abstract

A method includes detecting, by at least one hardware processor, an upload of a user application within a database system. The user application includes user-defined function (UDF) code. A plurality of dependencies of the user application is determined by the at least one hardware processor. A plurality of execution environments corresponding to the plurality of dependencies is generated by the at least one hardware processor. The plurality of execution environments is associated with a corresponding plurality of data types of the UDF. A database query is decoded. The database query specifies database data of a data type of the plurality of data types of the UDF. The database query is processed using at least one of the plurality of execution environments to generate results data. The at least one of the plurality of execution environments corresponds to the data type of the plurality of data types of the UDF.

Claims (80)

1. A method comprising:

detecting, by at least one hardware processor, an upload of a user application within a database system, the user application comprising user-defined function (UDF) code;

determining, by the at least one hardware processor, a plurality of dependencies of the user application;

generating, by the at least one hardware processor, a plurality of execution environments corresponding to the plurality of dependencies, the plurality of execution environments associated with a corresponding plurality of data types of the UDF;

decoding a database query, the database query specifying database data of a data type of the plurality of data types of the UDF; and

processing the database query using at least one of the plurality of execution environments to generate results data, the at least one of the plurality of execution environments corresponding to the data type of the plurality of data types of the UDF.

2. The method of claim 1 , further comprising:

determining one or more of at least one software package, a code version, and a code library associated with the UDF code to determine the plurality of dependencies.

3. The method of claim 1 , further comprising:

instantiating a first execution process within a computing node of the database system.

4. The method of claim 3 , further comprising:

configuring a plurality of UDF clients within the first execution process, the plurality of UDF clients corresponding to the plurality of execution environments.

5. The method of claim 4 , further comprising:

selecting a UDF client of the plurality of UDF clients based on the data type of the database query.

6. The method of claim 5 , further comprising:

forwarding using the UDF client, the database query to an execution environment of the plurality of execution environments to generate the results data, the execution environment corresponding to the UDF client.

7. The method of claim 6 , further comprising:

reformatting the database data specified by the database query using a data transport mechanism of the UDF client to generate reformatted data, the reformatted data comprising columnar data; and

forwarding the columnar data to the execution environment, the result data based on the columnar data.

8. The method of claim 4 , further comprising:

instantiating a second execution process within the computing node of the database system; and

instantiating a user code runtime within the second execution process.

9. The method of claim 8 , further comprising:

instantiating the plurality of execution environments corresponding to the plurality of dependencies as UDF server processes within the user code runtime.

10. The method of claim 8 , further comprising:

instantiating the second execution process as a sandbox process within the computing node.

11. A system comprising:

at least one hardware processor; and

at least one memory storing instructions that cause the at least one hardware processor to perform operations comprising:

detecting an upload of a user application within a database system, the user application comprising user-defined function (UDF) code;

determining a plurality of dependencies of the user application;

generating a plurality of execution environments corresponding to the plurality of dependencies, the plurality of execution environments associated with a corresponding plurality of data types of the UDF;

decoding a database query, the database query specifying database data of a data type of the plurality of data types of the UDF; and

processing the database query using at least one of the plurality of execution environments to generate results data, the at least one of the plurality of execution environments corresponding to the data type of the plurality of data types of the UDF.

12. The system of claim 11 , the operations further comprising:

determining one or more of at least one software package, a code version, and a code library associated with the UDF code to determine the plurality of dependencies.

13. The system of claim 11 , the operations further comprising:

instantiating a first execution process within a computing node of the database system.

14. The system of claim 13 , the operations further comprising:

configuring a plurality of UDF clients within the first execution process, the plurality of UDF clients corresponding to the plurality of execution environments.

15. The system of claim 14 , the operations further comprising:

selecting a UDF client of the plurality of UDF clients based on the data type of the database query.

16. The system of claim 15 , the operations further comprising:

forwarding using the UDF client, the database query to an execution environment of the plurality of execution environments to generate the results data, the execution environment corresponding to the UDF client.

17. The system of claim 16 , the operations further comprising:

reformatting the database data specified by the database query using a data transport mechanism of the UDF client to generate reformatted data, the reformatted data comprising columnar data; and

forwarding the columnar data to the execution environment, the result data based on the columnar data.

18. The system of claim 14 , the operations further comprising:

instantiating a second execution process within the computing node of the database system; and

instantiating a user code runtime within the second execution process.

19. The system of claim 18 , the operations further comprising:

instantiating the plurality of execution environments corresponding to the plurality of dependencies as UDF server processes within the user code runtime.

20. The system of claim 18 , the operations further comprising:

instantiating the second execution process as a sandbox process within the computing node.

21. A computer-storage medium comprising instructions that, when executed by one or more processors of a machine, configure the machine to perform operations comprising:

detecting an upload of a user application within a database system, the user application comprising user-defined function (UDF) code;

determining a plurality of dependencies of the user application;

generating a plurality of execution environments corresponding to the plurality of dependencies, the plurality of execution environments associated with a corresponding plurality of data types of the UDF;

decoding a database query, the database query specifying database data of a data type of the plurality of data types of the UDF; and

processing the database query using at least one of the plurality of execution environments to generate results data, the at least one of the plurality of execution environments corresponding to the data type of the plurality of data types of the UDF.

22. The computer-storage medium of claim 21 , the operations further comprising:

determining one or more of at least one software package, a code version, and a code library associated with the UDF code to determine the plurality of dependencies.

23. The computer-storage medium of claim 21 , the operations further comprising:

instantiating a first execution process within a computing node of the database system.

24. The computer-storage medium of claim 23 , the operations further comprising:

configuring a plurality of UDF clients within the first execution process, the plurality of UDF clients corresponding to the plurality of execution environments.

25. The computer-storage medium of claim 24 , the operations further comprising:

selecting a UDF client of the plurality of UDF clients based on the data type of the database query.

26. The computer-storage medium of claim 25 , the operations further comprising:

forwarding using the UDF client, the database query to an execution environment of the plurality of execution environments to generate the results data, the execution environment corresponding to the UDF client.

27. The computer-storage medium of claim 26 , the operations further comprising:

reformatting the database data specified by the database query using a data transport mechanism of the UDF client to generate reformatted data, the reformatted data comprising columnar data; and

forwarding the columnar data to the execution environment, the result data based on the columnar data.

28. The computer-storage medium of claim 24 , the operations further comprising:

instantiating a second execution process within the computing node of the database system; and

instantiating a user code runtime within the second execution process.

29. The computer-storage medium of claim 28 , the operations further comprising:

instantiating the plurality of execution environments corresponding to the plurality of dependencies as UDF server processes within the user code runtime.

30. The computer-storage medium of claim 28 , the operations further comprising:

instantiating the second execution process as a sandbox process within the computing node.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 21, 2023
From: BROSSARD, ELLIOTT; HAN, CHONG; ZINKOVSKY, IGOR
To: SNOWFLAKE INC.
Reel/Frame 064018/0156 →
Continuity (3)
Continuation 18060085 · Nov 30, 2022
Provisional Application 63366282 · Jun 13, 2022
Related Publication 20230409552A1 · Dec 21, 2023
Cited By (2)
US 12,367,186 US 12,724,761