SQL Graph Parsing for Target-Field Logic Extraction
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The complexity of Structured Query Language (SQL) processing makes it challenging to determine the processing logic for fields related to data lakes and data warehouses.
Innovation Solution
A method involving parse processing to convert SQL into a graphic representation, cropping the graphic representation to focus on a target field, and performing inverse parse processing to obtain the corresponding SQL, utilizing tools like Apache Calcite for syntax tree conversion and custom visualization.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If SQL is processed to extract processing logic for target fields, then extraction accuracy is improved, but the complexity of SQL processing increases
Solution Approach 1:
The patent segments the SQL processing into distinct phases: parsing phase (converting SQL to abstract syntax tree), graphic representation phase (converting AST to visual graph), cropping phase (extracting target field information), and inverse parsing phase (converting back to SQL). This segmentation allows complex processing to be broken down into manageable steps, improving accuracy while maintaining processability.
Solution Approach 2:
The patent introduces an intermediary graphic representation layer between the SQL statement and the target field extraction. This intermediate graphic representation (visual graph showing execution process) serves as a mediator that simplifies the complex SQL structure into an easily analyzable format, enabling accurate extraction without directly processing complex SQL logic.
2Productivity
If the graphic representation is cropped to focus on target field, then extraction efficiency is improved, but information loss may occur
Solution Approach 1:
The patent extracts only the necessary information related to the target field from the complete graphic representation. By identifying and isolating the specific portion of the execution process that pertains to the target field, the system achieves efficient extraction while maintaining completeness of the extracted information through the inverse parsing step.
Solution Approach 2:
The patent employs inverse parsing to reverse the cropping process. After extracting the target field's graphic representation, the inverse parsing operation reconstructs the complete processing logic by working backwards from the simplified representation, ensuring no information is lost and recovering the full SQL logic for the target field.
3Ease of operation
If parse processing is performed to convert SQL to graphic representation, then processing logic becomes clearer, but processing time increases
Solution Approach 1:
The patent performs parse processing and graphic representation conversion as preliminary actions before the actual target field extraction. By pre-converting the SQL into a visual graphic representation, the system prepares the data in an easily analyzable format, making the subsequent extraction process faster and more efficient despite the initial time cost.
Data Source
AI summary
The present application discloses a SQL processing method, an apparatus, a device, a medium and a product. The method includes: after a SQL to-be-processed is acquired, performing parse processing on the SQL to-be-processed to obtain a graphic representation corresponding to the SQL to-be-processed, so that the graphic representation is used for describing an execution process of the SQL to-be-processed; then, when the execution process includes processing logic of at least one candidate field and the at least one candidate field includes a target field, cropping a graphic representation corresponding to the target field from the graphic representation corresponding to the SQL to-be-processed, so that the graphic representation corresponding to the target field is used for describing the processing logic of the target field; finally, performing inverse parse processing on the graphic representation corresponding to the target field to obtain a SQL corresponding to the target field.


