A construction method of a multi-storage system general query language
By designing a universal query language, the problem of query complexity between different data storage systems was solved, enabling unified querying across storage systems and improving development efficiency and system flexibility.
Patent Information
- Application Number
- CN202111185755.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-12
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2041-10-12
AI Technical Summary
Different types of data storage systems have different management models, capacities, and storage methods, which increases the complexity of data query operations and the difficulty of maintenance.
Design a general query language, including the syntax design of the unified query language, rule description script writing, syntax analysis code generation, syntax parse tree processing, and target query language translation, to achieve unified querying across storage systems.
It simplifies the selection of storage systems, increases the freedom of choice in storage system selection, improves the efficiency of developers, and enhances the scalability and compatibility of the system.
Smart Images

Figure CN113821196B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage query, in particular to a construction method of a general query language for multiple storage systems. BACKGROUND
[0002] For large software, multiple different data storage systems are generally used. Different types of data storage systems have great differences in data query operations, including the types of query languages, due to the differences in their management modes, capacities, storage methods and other characteristics, which brings many technical difficulties to the use and maintenance of data storage systems. SUMMARY
[0003] In view of this, the purpose of the present application is to design a general query language for data query of various different storage systems.
[0004] The present application provides a construction method of a general query language for multiple storage systems, comprising the following steps:
[0005] S1, designing a syntax of a unified query language;
[0006] S2, writing a description script of the rules of the syntax;
[0007] S3, using a compiler to generate executable syntax analysis code with the syntax rule file as input;
[0008] S4, inputting specific sentences of the unified query language, and generating a syntax analysis tree through lexical analysis and syntax analysis processing;
[0009] S5, analyzing the content in the syntax analysis tree, and translating the syntax analysis tree into a target query language of a target storage system in combination with the specific type of the target storage system;
[0010] S6, executing the target query language to realize the query of the target storage system;
[0011] S7, converting the query result of the target storage system into a unified structure and outputting it to a query client.
[0012] Further, the syntax structure of the unified query language of the S1 step comprises:
[0013] namespace::table:(columns)[time-expr]{where-conditions}by-clauseorder-by-clause;
[0014] Wherein the namespace is divided into time sequence, object, and log types;
[0015] table is the sub-category of different data in each namespace;
[0016] columns are the target columns of the query;
[0017] Preferably, the columns can be a list;
[0018] time-expr is used to select a time period, consisting of three fields: start time, end time, and grouping interval;
[0019] where-conditons are other filtering conditions in addition to time filtering;
[0020] by-clause is the grouping basis, which is a list of fields by which the query result is grouped according to different columns;
[0021] Order-by-clause is the sorting basis, which is a list of fields by which the query result is sorted according to the specified columns.
[0022] Further, the description script of the S2 step is a gram.y language or a lex.go language.
[0023] Further, the compiler of the S3 step is a yacc grammar construction tool, the file format of the grammar rule file is a gram.y language file, and the file format of the syntax analysis code is a gram.go language file.
[0024] Further, the lexical analysis of the S4 step is based on a lex.go language file, and the syntax analysis is based on a gram.go language file.
[0025] Further, the syntax analysis tree of the S5 step is an abstract syntax tree AST, and the target query language is a query query statement.
[0026] Further, the query query statement includes one or more of InfluxDB, ElasticSearch.
[0027] Further, the method of converting into a unified structure of the S7 step is a unified conversion into a timeline structure.
[0028] Compared with the prior art, the beneficial effects of the present application are:
[0029] The application simplifies the selection of the storage system, improves the degree of freedom of the selection of the storage system, and improves the work efficiency of the business system developer. BRIEF DESCRIPTION OF DRAWINGS
[0030] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments with reference made to the accompanying drawings. The drawings are for purposes of illustration only and are not intended to be limiting of the application.
[0031] In the drawings:
[0032] Figure 1 A workflow diagram of a construction method of a universal query language for multiple storage systems according to an embodiment of the application. DETAILED DESCRIPTION
[0033] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The description of the exemplary embodiments is intended to apply to various alternative embodiments as well. It is to be understood that other equipment and processes can be utilized, and that conceptual aspects of the exemplary embodiments are intended to be illustrative and not restrictive.
[0034] The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the present disclosure. As used in the present disclosure and the appended claims, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0035] It will be understood that, although the terms first, second, third, etc. can be used herein to describe various information, the information should not be limited by these terms. These terms are used only to distinguish one piece of information from another. For example, a first information could be termed a second information, and, similarly, a second information could be termed a first information without departing from the scope of the present disclosure. As used herein, the term "if' can be construed to mean "when" or "in response to determining" depending on the context.
[0036] The specific implementation steps of the embodiments of the application are described below in conjunction with the accompanying drawings:
[0037] The embodiment of the application provides a construction method of a universal query language for multiple storage systems, as shown inFigure 1 As shown, comprising the following steps:
[0038] S1, design the syntax of the unified query language;
[0039] Specifically, the syntax structure of the syntax of the unified query language comprises:
[0040] namespace::table:(columns)[time-expr]{where-conditions}by-clauseorder-by-clause;
[0041] Wherein the namespace is divided into time sequence, object, log and several types;
[0042] table is a sub-classification of different data in each namespace;
[0043] columns are the target columns of the query;
[0044] Preferably, the columns can be a list;
[0045] time-expr is used to select a time period, which consists of three fields: start time, end time and grouping interval;
[0046] where-conditons are other filtering conditions in addition to time filtering;
[0047] by-clause is the grouping basis, which is a list of fields that the query result is grouped according to different columns;
[0048] Order-by-clause is the sorting basis, which is a list of fields that the query result is sorted according to the specified column;
[0049] S2, write a description script of the rules of the syntax;
[0050] Specifically, the description script is a gram.y language or a lex.go language;
[0051] S3, using a compiler, taking the syntax rule file as input, to generate executable syntax analysis code;
[0052] Specifically, the compiler is a yacc syntax construction tool, the file format of the syntax rule file is a gram.y language file, and the file format of the syntax analysis code is a gram.go language file;
[0053] S4, input the specific statement of the unified query language, and generate a syntax parsing tree through lexical analysis and syntax analysis processing;
[0054] Specifically, the lexical analysis is based on a lex.go language file, and the syntax analysis is based on a gram.go language file;
[0055] S5. Analyzing the content in the syntax analysis tree, and translating the syntax analysis tree into a target query language of the target storage system in combination with a specific target storage system type;
[0056] Specifically, the syntax analysis tree in the S5 step is an abstract syntax tree (AST), and the target query language is a query statement;
[0057] The query statement includes one or more of InfluxDB and ElasticSearch;
[0058] S6. Executing the target query language to realize the query of the target storage system;
[0059] S7. Converting the result of the query of the target storage system into a unified structure and outputting to a query client;
[0060] The method of converting into a unified structure in the S7 step is converting into a timeline structure.
[0061] The embodiments of the present application simplify the selection of storage systems and improve the degree of freedom of the selection of storage systems; a business system developer only needs to learn one syntax to realize the data query of multiple storage systems, thereby improving work efficiency; the present application has high expansibility, is convenient for porting, is compatible with existing storage systems, is convenient for system implementation of flexible storage selection, and improves the development efficiency of application software.
[0062] The technical solutions of the present application have been described in combination with the preferred embodiments shown in the accompanying drawings, but those skilled in the art can easily understand that the protection scope of the present application is obviously not limited to these specific embodiments. Those skilled in the art can make any modifications or replacements to the related technical features without departing from the principles of the present application, and the technical solutions after the modifications or replacements will all fall within the protection scope of the present application.
[0063] The above description is only the preferred embodiments of the present application and is not used to limit the present application; those skilled in the art can make various modifications and changes to the present application. Any modifications, replacements, improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method of constructing a multi-storage system universal query language, characterized by, The method comprises the following steps: S1, designing a syntax of a unified query language; S2, writing a description script of rules of the syntax; S3, using a compiler to generate executable syntax analysis code by taking a syntax rule file as input; S4, inputting a specific sentence of the unified query language, processing by lexical analysis and syntax analysis, and generating a syntax analysis tree; S5, analyzing content in the syntax analysis tree, combining with a specific target storage system type, and translating the syntax analysis tree into a target query language of the target storage system; S6, executing the target query language to realize query of the target storage system; S7, converting a result of the query of the target storage system into a unified structure and outputting to a query client; The syntax structure of the unified query language in the S1 step comprises: namespace::table:(columns) [time-expr] { where-conditions} by-clause order-by-clause; The namespace is divided into time sequence, object, and log types; The table is a subcategory of different data in each namespace; The columns are target columns of query; The time-expr is used for selecting a time period and consists of three fields: a start time, an end time, and a grouping interval; The where-conditons are other filtering conditions in addition to time filtering; The by-clause is a grouping basis and is a field list for grouping query results according to different columns; The order-by-clause is a sorting basis and is a field list for sorting query results according to specified columns; The description script in the S2 step is a gram.y language or a lex.go language; The compiler in the S3 step is a yacc syntax construction tool, the file format of the syntax rule file is a gram.y language file, and the file format of the syntax analysis code is a gram.go language file; The lexical analysis in the S4 step is based on a lex.go language file, and the syntax analysis is based on a gram.go language file; The syntax analysis tree in the S5 step is an abstract syntax tree AST, and the target query language is a query query statement; The query query statement comprises one or more of InfluxDB and ElasticSearch; The method for converting into a unified structure in the S7 step is converting into a timeline structure.
Citation Information
Patent Citations
Database data query method, apparatus and device, and storage medium
CN111209298A