IP Library Granted Patent US 12,423,299
Granted Patent B2
US 12,423,299 · App. 18/212,443 · Granted Sep 23, 2025

Method and system for imitation conversion fixes between Structured Query Language (SQL) dialects

Inventors: Ran Zmigrod (Cambridge, GB); Salwa Husam Alamir (Bournemouth, GB); Parag Sharma (Mumbai, IN); Bhagyalakshmi Rathakrishnan (Bengaluru, IN); Harsha Valaturu (Bengaluru, IN); Sameena Shah (Scarsdale, NY)
Assignee: JPMORGAN CHASE BANK, N.A.
G06F16/24534G06F16/2433
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,423,299
App. No.
18/212,443
Granted
Sep 23, 2025
Kind
B2
Abstract

A system for correcting a Structured Query Language (SQL) dialect conversion error. The system may include a processor and memory that stores instructions that, when executed by the processor, cause the processor to perform operations. The operations may include: receiving a first partially converted SQL file that has been partially converted from a first SQL dialect into a second SQL dialect; extracting, from the first partially converted SQL file, at least one first unconverted SQL snippet; deriving at least one first transformation; determining whether the at least one first transformation includes an appropriate set of at least one transformation for correcting a corresponding SQL conversion error; and associating the appropriate set of at least one transformation with the at least one first unconverted SQL snippet.

Claims (105)

1. A method for correcting a Structured Query Language (SQL) dialect conversion error, the method comprising:

receiving a first partially converted SQL file that has been partially converted from a first SQL dialect into a second SQL dialect;

extracting, from the first partially converted SQL file, at least one first unconverted SQL snippet;

deriving at least one first transformation, wherein the deriving the at least one first transformation comprises:

parsing the at least one first unconverted SQL snippet into a first SQL dialect-independent tree, wherein the first SQL dialect-independent tree comprises a SQL dialect-independent tree representation of the at least one first unconverted SQL snippet;

obtaining at least one first converted SQL snippet that includes a first set of code, wherein the at least one first unconverted SQL snippet includes a second set of code, wherein the first set of code and the second set of code include common information, and wherein the first set of code and the second set of code utilize different SQL dialects;

parsing the at least one first converted SQL snippet into a second SQL dialect-independent tree, wherein the second SQL dialect-independent tree comprises the SQL dialect-independent tree representation of the at least one first converted SQL snippet;

evaluating at least one first tree transformation difference by comparing the first SQL dialect-independent tree to the second SQL dialect-independent tree; and

deriving, based on the at least one first tree transformation difference, the at least one first transformation that is required to convert the first SQL dialect-independent tree into the second SQL dialect-independent tree;

determining whether the at least one first transformation includes an appropriate set of at least one transformation for correcting a corresponding SQL conversion error, wherein the appropriate set of the at least one transformation comprises a first set of transformations that eliminates a difference between the first SQL dialect-independent tree and the second SQL dialect-independent tree; and

associating the appropriate set of the at least one transformation with the at least one first unconverted SQL snippet.

2. The method of claim 1 , wherein the at least one transformation comprises at least one type of transformation from among insert, delete, and replace, wherein the replace type of transformation comprises the insert and the delete types of transformations.

3. The method of claim 1 , further comprising:

receiving a second partially converted SQL file that has been partially converted from the first SQL dialect into the second SQL dialect;

extracting, from the second partially converted SQL file, at least one second unconverted SQL snippet;

determining that the at least one second unconverted SQL snippet is the same as the first partially unconverted SQL snippet; and

converting the at least one second unconverted SQL snippet into the second SQL dialect of the at least one second unconverted SQL snippet.

4. The method of claim 3 , wherein the converting further comprises:

parsing the at least one second unconverted SQL snippet into a SQL dialect-independent tree representation of the at least one second unconverted SQL snippet;

generating a SQL dialect-independent tree representation of at least one second converted SQL snippet by applying the appropriate set of the at least one transformation to the SQL dialect-independent tree representation of the at least one second unconverted SQL snippet; and

parsing the SQL dialect-independent tree representation of the at least one second converted SQL snippet into the second SQL dialect of the at least one second unconverted SQL snippet.

5. The method of claim 1 , wherein the determining comprises:

providing, to a validator, the at least one first unconverted SQL snippet and the at least one first converted SQL snippet;

when the at least one first converted SQL snippet comprises the second SQL dialect of the at least one first unconverted SQL snippet:

receiving, from the validator, confirmation that the at least one first transformation includes the appropriate set of the at least one transformation; and

when the at least one first converted SQL snippet does not comprise the second SQL dialect of the at least one first unconverted SQL snippet:

receiving, from the validator, the second SQL dialect of the at least one first unconverted SQL snippet; and

determining the appropriate set of the at least one transformation.

6. The method of claim 5 , wherein the validator comprises at least one from among: a user, a computer specialist, and an artificial intelligence and machine learning (AI/ML) model.

7. The method of claim 5 , wherein the determining the appropriate set of the at least one transformation comprises:

parsing the second SQL dialect of the at least one first converted SQL snippet into a third SQL dialect-independent tree, wherein the third SQL dialect-independent tree comprises the SQL dialect-independent tree representation of the second SQL dialect of the at least one first unconverted SQL snippet;

determining, by comparing the first SQL dialect-independent tree to the third SQL dialect-independent tree, at least one second tree transformation difference; and

determining, based on the at least one second tree transformation difference, the appropriate set of the at least one transformation, wherein the appropriate set of the at least one transformation is required to convert the first SQL dialect-independent tree into the third SQL dialect-independent tree.

8. The method of claim 7 , further comprising: deriving the at least one transformation based on at least one tree transformation difference, wherein the deriving the at least one transformation further comprises:

following a first path of a first tree and a second path of a second tree;

determining at least one difference between at least one first branch along the first path and at least one second branch along the second path; and

determining the at least one transformation that eliminates the at least one difference when the at least one transformation is performed on the first tree.

9. The method of claim 1 , further comprising:

when the first partially converted SQL file comprises at least one unconverted SQL snippet that is not associated with any transformations, and until every unconverted SQL snippet of the first partially converted SQL file is associated with a corresponding transformation, iteratively:

extracting, from the first partially converted SQL file, at least one snippet from among the at least one unconverted SQL snippet that is not associated with any transformations;

deriving at least one additional transformation; and

associating the at least one additional transformation with the at least one snippet; and

when each unconverted SQL snippet of the first partially converted SQL file is associated with at least one associated transformation, generating a first fully converted SQL file that comprises the second SQL dialect of every SQL snippet of the first partially converted SQL file.

10. A system for correcting a Structured Query Language (SQL) dialect conversion error, the system comprising:

a processor; and

memory storing instructions that, when executed by the processor, cause the processor to perform operations comprising:

receiving a first partially converted SQL file that has been partially converted from a first SQL dialect into a second SQL dialect;

extracting, from the first partially converted SQL file, at least one first unconverted SQL snippet;

deriving at least one first transformation, wherein the deriving the at least one first transformation comprises:

parsing the at least one first unconverted SQL snippet into a first SQL dialect-independent tree, wherein the first SQL dialect-independent tree comprises a SQL dialect-independent tree representation of the at least one first unconverted SQL snippet;

obtaining at least one first converted SQL snippet that includes a first set of code, wherein the at least one first unconverted SQL snippet includes a second set of code, wherein the first set of code and the second set of code include common information, and wherein the first set of code and the second set of code utilize different SQL dialects;

parsing the at least one first converted SQL snippet into a second SQL dialect-independent tree, wherein the second SQL dialect-independent tree comprises the SQL dialect-independent tree representation of the at least one first converted SQL snippet;

evaluating at least one first tree transformation difference by comparing the first SQL dialect-independent tree to the second SQL dialect-independent tree; and

deriving, based on the at least one first tree transformation difference, the at least one first transformation that is required to convert the first SQL dialect-independent tree into the second SQL dialect-independent tree;

determining whether the at least one first transformation includes an appropriate set of at least one transformation for correcting a corresponding SQL conversion error, wherein the appropriate set of the at least one transformation comprises a first set of transformations that eliminates a difference between the first SQL dialect-independent tree and the second SQL dialect-independent tree; and

associating the appropriate set of the at least one transformation with the at least one first unconverted SQL snippet.

11. The system of claim 10 , wherein the instructions, when executed by the processor, further cause the processor to perform operations comprising,

when the first partially converted SQL file comprises at least one unconverted SQL snippet that is not associated with any transformations, and until every unconverted SQL snippet of the first partially converted SQL file is associated with a corresponding transformation, iteratively:

extracting, from the first partially converted SQL file, at least one snippet from among the at least one unconverted SQL snippet that is not associated with any transformations;

deriving at least one additional transformation; and

associating the at least one additional transformation with the at least one snippet; and

when each unconverted SQL snippet of the first partially converted SQL file is associated with at least one associated transformation, generating a first fully converted SQL file that comprises the second SQL dialect of every SQL snippet of the first partially converted SQL file.

12. The system of claim 10 , wherein the instructions, when executed by the processor, further cause the processor to perform operations comprising:

receiving a second partially converted SQL file that has been partially converted from the first SQL dialect into the second SQL dialect;

extracting, from the second partially converted SQL file, at least one second unconverted SQL snippet;

determining that the at least one second unconverted SQL snippet is the same as the first partially unconverted SQL snippet; and

converting the at least one second unconverted SQL snippet into the second SQL dialect of the at least one second unconverted SQL snippet.

13. The system of claim 12 , wherein the converting comprises:

parsing the at least one second unconverted SQL snippet into a SQL dialect-independent tree representation of the at least one second unconverted SQL snippet;

generating a SQL dialect-independent tree representation of at least one second converted SQL snippet by applying the appropriate set of the at least one transformation to the SQL dialect-independent tree representation of the at least one second unconverted SQL snippet; and

parsing the SQL dialect-independent tree representation of the at least one second converted SQL snippet into the second SQL dialect of the at least one second unconverted SQL snippet.

14. The system of claim 10 , wherein the determining comprises:

providing, to a validator, the at least one first unconverted SQL snippet and the at least one first converted SQL snippet;

when the at least one first converted SQL snippet comprises the second SQL dialect of the at least one first unconverted SQL snippet:

receiving, from the validator, confirmation that the at least one first transformation includes the appropriate set of the at least one transformation; and

when the at least one first converted SQL snippet does not comprise the second SQL dialect of the at least one first unconverted SQL snippet:

receiving, from the validator, the second SQL dialect of the at least one first unconverted SQL snippet; and

determining the appropriate set of the at least one transformation.

15. The system of claim 14 , wherein the determining the appropriate set of the at least one transformation comprises:

parsing the second SQL dialect of the at least one first converted SQL snippet into a third SQL dialect-independent tree, wherein the third SQL dialect-independent tree comprises the SQL dialect-independent tree representation of the second SQL dialect of the at least one first unconverted SQL snippet;

determining, by comparing the first SQL dialect-independent tree to the third SQL dialect-independent tree, at least one second tree transformation difference; and

determining, based on the at least one second tree transformation difference, the appropriate set of the at least one transformation, wherein the appropriate set of the at least one transformation is required to convert the first SQL dialect-independent tree into the third SQL dialect-independent tree.

16. The system of claim 15 , wherein the instructions, when executed by the processor, further cause the processor to perform operations comprising:

deriving the at least one transformation based on at least one tree transformation difference, wherein the deriving the at least one transformation further comprises:

following a first path of a first tree transformation and a second path of a second tree transformation;

determining at least one difference between at least one first branch along the first path and at least one second branch along the second path; and

determining the at least one transformation that eliminates the at least one difference when the at least one transformation is performed on the first tree transformation.

17. A non-transitory computer-readable medium for correcting a Structured Query Language (SQL) dialect conversion error, the non-transitory computer-readable medium comprising instructions that, when executed by a processor, cause the processor to perform operations comprising:

receiving a first partially converted SQL file that has been partially converted from a first SQL dialect into a second SQL dialect;

extracting, from the first partially converted SQL file, at least one first unconverted SQL snippet;

deriving at least one first transformation, wherein the deriving the at least one first transformation comprises:

parsing the at least one first unconverted SQL snippet into a first SQL dialect-independent tree, wherein the first SQL dialect-independent tree comprises a SQL dialect-independent tree representation of the at least one first unconverted SQL snippet;

obtaining at least one first converted SQL snippet that includes a first set of code, wherein the at least one first unconverted SQL snippet includes a second set of code, wherein the first set of code and the second set of code include common information, and wherein the first set of code and the second set of code utilize different SQL dialects;

parsing the at least one first converted SQL snippet into a second SQL dialect-independent tree, wherein the second SQL dialect-independent tree comprises the SQL dialect-independent tree representation of the at least one first converted SQL snippet;

evaluating at least one first tree transformation difference by comparing the first SQL dialect-independent tree to the second SQL dialect-independent tree; and

deriving, based on the at least one first tree transformation difference, the at least one first transformation that is required to convert the first SQL dialect-independent tree into the second SQL dialect-independent tree;

determining whether the at least one first transformation includes an appropriate set of at least one transformation for correcting a corresponding SQL conversion error, wherein the appropriate set of the at least one transformation comprises a first set of transformations that eliminates a difference between the first SQL dialect-independent tree and the second SQL dialect-independent tree; and

associating the appropriate set of the at least one transformation with the at least one first unconverted SQL snippet.

18. The non-transitory computer-readable medium of claim 17 , wherein the determining comprises:

providing, to a validator, the at least one first unconverted SQL snippet and the at least one first converted SQL snippet;

when the at least one first converted SQL snippet comprises the second SQL dialect of the at least one first unconverted SQL snippet:

receiving, from the validator, confirmation that the at least one first transformation includes the appropriate set of the at least one transformation; and

when the at least one first converted SQL snippet does not comprise the second SQL dialect of the at least one first unconverted SQL snippet:

receiving, from the validator, the second SQL dialect of the at least one first unconverted SQL snippet; and

determining the appropriate set of at least one transformation.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 26, 2023
From: ZMIGROD, RAN; ALAMIR, SALWA HUSAM; SHARMA, PARAG; RATHAKRISHNAN, BHAGYALAKSHMI; VALATURU, HARSHA; SHAH, SAMEENA
To: JPMORGAN CHASE BANK, N.A.
Reel/Frame 064387/0001 →
Priority Claims (1)
IN 202311032063 · May 5, 2023 · national
Continuity (1)
Related Publication 20240370431A1 · Nov 7, 2024
References Cited (10)
US 7664795B2 · Balin · 2010 [cited by examiner]
US 20140280259A1 · McGillin · 2014 [cited by examiner]
US 20210049167A1 · Brushaber · 2021 [cited by examiner]
US 20210209098A1 · Shi · 2021 [cited by examiner]
US 20210319356A1 · Wang · 2021 [cited by examiner]
US 20230039860A1 · Chipman · 2023 [cited by examiner]
CN 101405729A · 2009 [cited by examiner]
CN 109062918A · 2018 [cited by examiner]
Feasel, Kevin, and Kevin Feasel. “Common Hadoop and Blob Storage Integration Errors.” PolyBase Revealed: Data Virtualization with SQL Server, Hadoop, Apache Spark, and Beyond (2020): 127-149. (Year: 2020). [cited by examiner]
Wang, Yi, Yang Yang, Weiguo Zhu, Yi Wu, Xu Yan, Yongfeng Liu, Yu Wang et al. “Sqlflow: A bridge between SQL and machine learning.” arXiv preprint arXiv:2001.06846 (2020). (Year: 2020). [cited by examiner]