IP Library › Granted Patent US 12,517,902
Granted Patent B2
US 12,517,902 · App. 18/477,694 · Granted Jan 6, 2026

User defined function memoization

Inventors: Raja Suresh Krishna Balakrishnan (Fremont, CA); Thierry Cruanes (San Mateo, CA); Yujie Li (Santa Clara, CA); Subramanian Muralidhar (Mercer Island, WA); David Schultz (Piedmont, CA); Jiaqi Yan (Menlo Park, CA)
Assignee: Snowflake Inc.
G06F16/24539G06F21/53G06F2221/034
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,517,902
App. No.
18/477,694
Granted
Jan 6, 2026
Kind
B2
Abstract

A data platform that implements memoizable functions for database objects. The data platform detects a first execution of a memoizable function and generates a first key based on metadata of one or more database objects operated on by the memoizable function and generates a first result for the memoizable function based on the one or more database objects. The data platform detects a second execution of the memoizable function and generates a second key based on the metadata of the one or more database objects operated on by the memoizable function. When the first key and the second key are equal, the data platform reuses the first result of the memoizable function. When the first key and second key do not match, the data platform generates a second result for the second execution of the memoizable function.

Claims (77)

1 . A computer-implemented method comprising:

detecting a first execution of a user-defined function (UDF);

generating a first key based on metadata of one or more database objects operated on by the UDF, the metadata comprising a modification history of the one or more database objects;

generating a first result for the first execution of the UDF based on the one or more database objects;

storing the first key and the first result;

detecting a second execution of the UDF;

generating a second key based on the metadata of the one or more database objects;

based on determining the second key matches the first key, reusing the stored first result for the second execution of the UDF; and

based on determining the second key does not match the first key, generating a second result for the second execution of the UDF based on the one or more database objects.

2 . The computer-implemented method of claim 1 , wherein the operations of storing the first key and the first result further comprise:

based on determining that a memory requirement of the first result is below a memory storage limit, caching the first key and the first result; and

based on determining that the memory requirement of the first result is above a memory storage limit, not caching the first key and the first result.

3 . The computer-implemented method of claim 1 , wherein operations of the first execution comprise:

launching a child job to perform the first execution.

4 . The computer-implemented method of claim 3 , wherein operations of launching the child job comprise:

expanding a body of the UDF in the child job; and

replacing a function node with a result of the UDF.

5 . The computer-implemented method of claim 3 , wherein operations of launching the child job comprise:

instantiating a virtual machine and allocating computing resources for executing the UDF.

6 . The computer-implemented method of claim 3 , wherein operations of launching the child comprise:

performing the first execution within a security context of a data platform based on a security policy of the data platform.

7 . The computer-implemented method of claim 6 , wherein the security policy comprises a security manager policy enforced by a security manager of the data platform.

8 . The computer-implemented method of claim 7 , wherein the security policy comprises a sandbox policy enforced by a sandbox process of the data platform.

9 . The computer-implemented method of claim 1 , wherein the stored first result persists across multiple sessions.

10 . The computer-implemented method of claim 1 , wherein the modification history comprises timestamps associated with modifications to the one or more database objects.

11 . A machine comprising:

one or more processors; and

one or more memories storing instructions that, when executed by the one or more processors, cause the machine to perform operations comprising:

detecting a first execution of a user-defined function (UDF);

generating a first key based on metadata of one or more database objects operated on by the UDF, the metadata comprising a modification history of the one or more database objects;

generating a first result for the first execution of the UDF based on the one or more database objects;

storing the first key and the first result;

detecting a second execution of the UDF;

generating a second key based on the metadata of the one or more database objects;

based on determining the second key matches the first key, reusing the stored first result for the second execution of the UDF; and

based on determining the second key does not match the first key, generating a second result for the second execution of the UDF based on the one or more database objects.

12 . The machine of claim 11 , wherein the operations of storing the first key and the first result further comprise:

based on determining that a memory requirement of the first result is below a memory storage limit, caching the first key and the first result; and

based on determining that the memory requirement of the first result is above a memory storage limit, not caching the first key and the first result.

13 . The machine of claim 11 , wherein operations of the first execution comprise:

launching a child job to perform the first execution.

14 . The machine of claim 13 , wherein operations of launching the child job comprise:

expanding a body of the UDF in the child job; and

replacing a function node with a result of the UDF.

15 . The machine of claim 13 , wherein operations of launching the child job comprise:

instantiating a virtual machine and allocating computing resources for executing the UDF.

16 . The machine of claim 13 , wherein operations of launching the child comprise:

performing the first execution within a security context of a data platform based on a security policy of the data platform.

17 . The machine of claim 16 , wherein the security policy comprises a security manager policy enforced by a security manager of the data platform.

18 . The machine of claim 17 , wherein the security policy comprises a sandbox policy enforced by a sandbox process of the data platform.

19 . The machine of claim 11 , wherein the stored first result persists across multiple sessions.

20 . The machine of claim 11 , wherein the modification history comprises timestamps associated with modifications to the one or more database objects.

21 . A machine-storage medium storing instructions that, when executed by the machine, cause the machine to perform operations comprising:

detecting a first execution of a user-defined function (UDF);

generating a first key based on metadata of one or more database objects operated on by the UDF, the metadata comprising a modification history of the one or more database objects;

generating a first result for the first execution of the UDF based on the one or more database objects;

storing the first key and the first result;

detecting a second execution of the UDF;

generating a second key based on the metadata of the one or more database objects;

based on determining the second key matches the first key, reusing the stored first result for the second execution of the UDF; and

based on determining the second key does not match the first key, generating a second result for the second execution of the UDF based on the one or more database objects.

22 . The machine-storage medium of claim 21 , wherein the operations of storing the first key and the first result further comprise:

based on determining that a memory requirement of the first result is below a memory storage limit, caching the first key and the first result; and

based on determining that the memory requirement of the first result is above a memory storage limit, not caching the first key and the first result.

23 . The machine-storage medium of claim 21 , wherein operations of the first execution comprise:

launching a child job to perform the first execution.

24 . The machine-storage medium of claim 23 , wherein operations of launching the child job comprise:

expanding a body of the UDF in the child job; and

replacing a function node with a result of the UDF.

25 . The machine-storage medium of claim 23 , wherein operations of launching the child job comprise:

instantiating a virtual machine and allocating computing resources for executing the UDF.

26 . The machine-storage medium of claim 23 , wherein operations of launching the child comprise:

performing the first execution within a security context of a data platform based on a security policy of the data platform.

27 . The machine-storage medium of claim 26 , wherein the security policy comprises a security manager policy enforced by a security manager of the data platform.

28 . The machine-storage medium of claim 27 , wherein the security policy comprises a sandbox policy enforced by a sandbox process of the data platform.

29 . The machine-storage medium of claim 21 , wherein the stored first result persists across multiple sessions.

30 . The machine-storage medium of claim 21 , wherein the modification history comprises timestamps associated with modifications to the one or more database objects.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 29, 2023
From: BALAKRISHNAN, RAJA SURESH KRISHNA; CRUANES, THIERRY; LI, YUJIE; MURALIDHAR, SUBRAMANIAN; SCHULTZ, DAVID; YAN, JIAQI
To: SNOWFLAKE INC.
Reel/Frame 065070/0815 →
Continuity (3)
Continuation 17819758 · Aug 15, 2022
Provisional Application 63366036 · Jun 8, 2022
Related Publication 20240028591A1 · Jan 25, 2024
References Cited (24)
US 8793241B2 · Koch et al. · 2014 [cited by applicant]
US 10997286B1 · Brossard et al. · 2021 [cited by applicant]
US 11288361B1 · Salehpour et al. · 2022 [cited by applicant]
US 11334548B2 · Kuimelis et al. · 2022 [cited by applicant]
US 11809425B1 · Balakrishnan et al. · 2023 [cited by applicant]
US 20030055813A1 · Chaudhuri · 2003 [cited by examiner]
US 20090049421A1 · Meijer · 2009 [cited by examiner]
US 20090327254A1 · Bruno et al. · 2009 [cited by applicant]
US 20110302371A1 · Lysko · 2011 [cited by applicant]
US 20120331249A1 · Benjamin et al. · 2012 [cited by applicant]
US 20130085882A1 · Gounares et al. · 2013 [cited by applicant]
US 20170177486A1 · Horn · 2017 [cited by applicant]
US 20170371940A1 · Chintakayala et al. · 2017 [cited by applicant]
US 20210135854A1 · Karame et al. · 2021 [cited by applicant]
US 20210191942A1 · Arnold · 2021 [cited by applicant]
US 20220206816A1 · Soundararajan et al. · 2022 [cited by applicant]
US 20220229916A1 · Soman et al. · 2022 [cited by applicant]
“U.S. Appl. No. 17/819,758, Non Final Office Action mailed Oct. 31, 2022”, 12 pages. [cited by applicant]
“U.S. Appl. No. 17/819,758, Non Final Office Action mailed Dec. 14, 2022”, 12 pages. [cited by applicant]
“U.S. Appl. No. 17/819,758, Response filed Mar. 14, 2023 to Non Final Office Action mailed Dec. 14, 2022”, 11 pages. [cited by applicant]
“U.S. Appl. No. 17/819,758, Final Office Action mailed Apr. 4, 2023”, 15 pages. [cited by applicant]
“U.S. Appl. No. 17/819,758, Response filed Jun. 30, 2023 to Final Office Action mailed Apr. 4, 2023”, 11 pages. [cited by applicant]
“U.S. Appl. No. 17/819,758, Notice of Allowance mailed Aug. 9, 2023”, 10 pages. [cited by applicant]
Christie, Alan M., “Software Process Automation: The Technology and Its Adoption”, https: books.google.combooks?hl=enU andlr=andid=WcqoCAAAQBAJandoi=fndandpg=PA1anddq=info:mrbs7qfiMDgJ:scholar.google.com+andots=KTqCr_ST… [cited by applicant]