Data conversion method, device and equipment and computer readable medium

By parsing Partition Range statements into a syntax tree and extracting clauses, GBASE Partition Range statements are automatically generated, solving the problem of low conversion efficiency in existing technologies and achieving more efficient statement conversion.

CN121009115APending Publication Date: 2025-11-25CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511177292.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-21
Publication Date
2025-11-25

AI Technical Summary

Technical Problem

In existing technologies, converting PostgreSQL Partition Range statements to GBASE Partition Range statements is inefficient, mainly because it requires a lot of manual work.

Method used

The Partition Range statement is parsed into a syntax tree, and the start clause, end clause, and procedure clause are extracted and sorted. Based on these clauses, a GBASE Partition Range statement is generated using an automated syntax tree generation process.

Benefits of technology

It improves the efficiency of sentence conversion, reduces manual operation, and enhances the automation and accuracy of conversion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121009115A_ABST
    Figure CN121009115A_ABST
Patent Text Reader

Abstract

The invention discloses a data conversion method, device and equipment and a computer readable medium, and relates to the technical field of big data. A specific embodiment of the method comprises the following steps: analyzing a Partial Range statement of a date column in an open source relational database management system into a syntax tree, wherein the syntax tree comprises a syntax structure of the Partial Range statement; traversing each Partial Range statement of the syntax tree, extracting a starting clause, an ending clause and a process clause according to the syntax structure, and sorting the Partial Range statements according to the date value of the extracted starting clause; and in the sorted Partial Range statements, according to the starting clause, the ending clause and the process clause, determining a partition range mode of the Partial Range statement, so as to generate the Partial Range statement of the GBASE according to the partition range mode of the Partial Range statement. According to the embodiment, the statement conversion efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of big data, and particularly relates to a data conversion method and device, equipment and a computer readable medium. BACKGROUND

[0002] In order to realize the controllability, researchability and development of technology, it is necessary to convert the data format in the database. PostgreSQL is a commonly used data system, and GBASE has high popularity in the database market.

[0003] In the implementation of the present application, the inventor found that at least the following problems exist in the prior art: the conversion of the Partition Range statement in PostgreSQL to the Partition Range statement in GBASE is mostly manually converted, resulting in low conversion efficiency. SUMMARY

[0004] Therefore, the embodiments of the present application provide a data conversion method, device, equipment and computer readable medium, which can improve the statement conversion efficiency.

[0005] To achieve the above object, according to one aspect of the embodiments of the present application, a data conversion method is provided, comprising:

[0006] analyzing the Partition Range statement of the date column in the open source relational database management system into a syntax tree, wherein the syntax tree comprises the syntax structure of the Partition Range statement;

[0007] extracting the start clause, the end clause and the process clause from each Partition Range statement of the syntax tree according to the syntax structure, and sorting the Partition Range statement according to the date value of the extracted start clause;

[0008] determining the partition range mode of the Partition Range statement according to the start clause, the end clause and the process clause in the sorted Partition Range statement, so as to generate the Partition Range statement of GBASE according to the partition range mode of the Partition Range statement.

[0009] The analysis of the Partition Range statement of the date column in the open source relational database management system into a syntax tree comprises:

[0010] obtaining the conversion condition for analyzing the PostgreSQL date column in the database;

[0011] In the Partition Range statement of the PostgreSQL date column, the Partition Range clause is obtained according to the range partition keyword in the conversion condition to construct the syntax tree, and the partition type and date column in the syntax tree are reserved.

[0012] The start clause, end clause and process clause are extracted according to the syntax structure when traversing each Partition Range statement of the syntax tree, and the Partition Range statements are sorted according to the date value of the extracted start clause, including:

[0013] According to the conversion condition of the PostgreSQL date column, the start clause, end clause and process clause are extracted according to the syntax structure when traversing each Partition Range statement of the syntax tree, and the date value is extracted in the start clause by using the keyword;

[0014] The Partition Range statements are sorted in the order from early to late according to the date value of the extracted start clause.

[0015] According to the start clause, end clause and process clause, the partition range mode of the Partition Range statement is determined in the sorted Partition Range statement, including:

[0016] In the sorted Partition Range statement, the process clause is empty, and the partition range mode of the Partition Range statement is determined according to the start clause and the end clause, including explicitly specifying the partition;

[0017] In the sorted Partition Range statement, the process clause is not empty, and the partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, including specifying the partition by steps.

[0018] The Partition Range statement of GBASE is generated according to the partition range mode of the Partition Range statement, including:

[0019] The partition range mode of the Partition Range statement includes explicitly specifying the partition, and the date in the end clause in the Partition Range statement is extracted to generate the LESS THAN clause, and the LESS THAN clause belongs to the Partition Range statement of GBASE.

[0020] The Partition Range statement for generating the GBASE according to the partition range mode of the Partition Range statement comprises:

[0021] The partition range mode of the Partition Range statement comprises: specifying the partition by step, extracting a step parameter in a process clause of the Partition Range statement;

[0022] After initializing the method in the object by the date in the start clause, calibrating the date according to the step parameter, a LESS THAN clause is generated, and the LESS THAN clause belongs to the Partition Range statement of the GBASE.

[0023] After the Partition Range statement for generating the GBASE according to the partition range mode of the Partition Range statement, further comprising:

[0024] After the Partition Range statement for generating the GBASE is generated in the last Partition Range statement in the sorting, a clause is added after the clause to receive other data.

[0025] According to a second aspect of the embodiment of the present application, there is provided an apparatus for converting data, comprising:

[0026] A parsing module is configured to parse a Partition Range statement of a date column in an open source relational database management system into a syntax tree, wherein the syntax tree comprises a syntax structure of the Partition Range statement;

[0027] A sorting module is configured to traverse each Partition Range statement of the syntax tree to extract a start clause, an end clause and a process clause according to the syntax structure, and sort the Partition Range statements according to a date value of the start clause;

[0028] A conversion module is configured to determine a partition range mode of the Partition Range statement according to the start clause, the end clause and the process clause in the sorted Partition Range statement, and generate a Partition Range statement of the GBASE according to the partition range mode of the Partition Range statement.

[0029] According to a third aspect of the embodiment of the present application, there is provided an electronic device for converting data, comprising:

[0030] One or more processors;

[0031] a storage device for storing one or more programs,

[0032] When the one or more programs are executed by the one or more processors, the one or more processors implement the above method.

[0033] According to a fourth aspect of the embodiments of the present application, a computer readable medium is provided, having stored thereon a computer program which, when executed by a processor, implements the above method.

[0034] According to a fifth aspect of the embodiments of the present application, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the above method provided by the embodiments of the present application.

[0035] An embodiment of the above application has the following advantages or beneficial effects: the Partition Range statement of the date column in the open source relational database management system is parsed into a syntax tree, the syntax tree including the syntax structure of the Partition Range statement; each Partition Range statement of the syntax tree is traversed to extract a start clause, an end clause and a process clause according to the syntax structure, and the Partition Range statements are sorted according to the date value of the extracted start clause; in the sorted Partition Range statements, the partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, so as to generate the Partition Range statement of the GBASE according to the partition range mode of the Partition Range statement. The syntax tree is used to extract multiple clauses in the Partition Range statement, and the Partition Range statement is automatically generated according to the syntax tree. In this way, the statement conversion efficiency can be improved.

[0036] Further effects of the above-described non-conventional optional mode will be described in the following in conjunction with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0037] The accompanying drawings are used to better understand the present application, and do not constitute an improper limitation on the present application. Among them:

[0038] Figure 1 is a main flow diagram of the method for converting data according to the embodiments of the present application;

[0039] Figure 2 is a flow diagram of parsing the Partition Range statement into a syntax tree according to the embodiments of the present application;

[0040] Figure 3is a flowchart of processing each Partition Range statement of a syntax tree according to an embodiment of the present application;

[0041] Figure 4 is a flowchart of determining a partition range mode of a Partition Range statement according to an embodiment of the present application;

[0042] Figure 5 is a flowchart of generating a Partition Range statement of a GBASE according to an embodiment of the present application;

[0043] Figure 6 is a main structure diagram of an apparatus for converting data according to an embodiment of the present application;

[0044] Figure 7 is an exemplary system architecture diagram to which embodiments of the present application can be applied;

[0045] Figure 8 is a structure diagram of a computer system of a terminal device or a server suitable for implementing embodiments of the present application. DETAILED DESCRIPTION

[0046] Exemplary embodiments of the present application are described herein with reference to the accompanying drawings, in which various details are set forth to facilitate an understanding of the embodiments of the present application. However, it will be apparent to those of ordinary skill in the art that various changes in the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, the description set forth in the following description of the embodiments of the present application is not limitative in nature and should not be construed as limiting the scope and spirit of the present application. In the drawings, the same or similar components are denoted by the same reference numerals throughout the drawings.

[0047] It should be noted that in the embodiments of the present application, some software, components, models, etc. that are known in the industry can be mentioned, which should be considered as exemplary, and the purpose is only to illustrate the feasibility of the technical solutions of the present application, but it does not mean that the applicant has or will necessarily use the scheme.

[0048] In the migration process from PostgreSQL to GBASE, the conversion of the table creation statement needs to be implemented first, and the table creation statement involves a large number of Partition Range statements. Partition Range is a widely used table partitioning mode, which uses column value range as the basis for dividing partitions, so it is necessary to specify which columns are based on and the column value division basis within the table creation statement.

[0049] Since a PostgreSQL statement needs to be converted into multiple GBASE LESS THAN partition statements. For example: a PostgreSQL statement: "Start ('2023-10-01'::date) End ('2024-10-01'::date) Procedure ('10 days'::interval)", needs to be converted into 37 GBASE statements.

[0050] The above steps all need syntax conversion, further increasing the workload of manual conversion. The Partition Range statement syntax of PostgreSQL and GBASE is completely different. The above differences bring great difficulty to conversion, especially when there are a large number of table creation statements that need to be converted, the workload is huge.

[0051] It can be seen that the conversion of the Partition Range statement in PostgreSQL to the Partition Range statement of GBASE is mostly manual conversion, resulting in low conversion efficiency.

[0052] In order to solve the low conversion efficiency, the technical solutions in the embodiments of the present application can be used.

[0053] Referring to Figure 1 , Figure 1 The method for converting data according to the embodiment of the present application mainly includes the following steps: Figure 1 That is, 100 is specifically shown as follows:

[0054] S101, parse the Partition Range statement of the date column in the open source relational database management system into a syntax tree, and the syntax tree includes the syntax structure of the Partition Range statement.

[0055] In the embodiments of the present application, the open source relational database management system includes PostgreSQL. PostgreSQL is a powerful open source object relational database system, which provides support for date and time data types. In PostgreSQL, date columns are usually stored using the date type, which stores dates (year, month, day). In order to convert the format of the Partition Range statement, the Partition Range statement of the PostgreSQL date column is parsed into a syntax tree. The syntax tree represents the syntax structure of the programming language in the form of a tree, and each node in the tree represents a structure in the source code. That is, the syntax tree includes the syntax structure of the Partition Range statement.

[0056] Referring to Figure 2 That is 200, Figure 2 is a flowchart of parsing the Partition Range statement of the embodiments of the present application into a syntax tree. Specifically, it includes the following steps:

[0057] S201, obtaining a conversion condition for parsing the PostgreSQL date column in the database.

[0058] In the embodiments of the present application, parsing the Partition Range statement needs to be implemented based on the conversion condition, and the conversion condition for parsing the PostgreSQL date column can be obtained in the database.

[0059] The conversion condition of the PostgreSQL date column includes a first conversion sub-condition and a second conversion sub-condition. The first conversion sub-condition is executed first, and then the second conversion sub-condition is executed.

[0060] The first conversion sub-condition includes matching the range partition keyword. As an example, the range partition keyword includes PARTITION BY RANGE and the date column.

[0061] The second conversion sub-condition includes matching the Partition definition clause. The clause includes the start clause, the end clause, the process clause and the WITH clause.

[0062] In order to facilitate the execution of the conversion condition, the conversion condition can be converted into Java parsing code.

[0063] S202, in the Partition Range statement of the PostgreSQL date column, the Partition Range clause is obtained according to the range partition keyword in the conversion condition to build a syntax tree, and the partition type and date column in the syntax tree are reserved.

[0064] In the Partition Range statement of the PostgreSQL date column, the analysis tool acquires the Partition Range clause according to the range partition keyword in the conversion condition to construct a syntax tree. As an example, the analysis tool includes a syntax analyzer generator or a regular expression. For example, the syntax analyzer generator includes anltr4 syntax analysis tool. The anltr4 syntax analysis tool can be used to convert the conversion condition into Java parsing code.

[0065] Specifically, the analysis tool parses the Partition Range statement of the PostgreSQL date column into a syntax tree. According to the range partition keyword in the conversion condition, the range partition keyword in the syntax tree is retained in the converted GBASE Partition Range statement.

[0066] The range partition keyword includes the partition type (PARTITION BY RANGE) and the date column. This is because the syntax of the range partition keyword is the same as GBASE, so the range partition keyword in the syntax tree does not need to be modified and can be retained as is.

[0067] In the embodiment of Figure 2 The syntax tree is constructed using the conversion condition of the PostgreSQL date column and the analysis tool. On the one hand, based on the syntax structure of the syntax tree, various clauses can be extracted to implement conversion data, and on the other hand, the range partition keyword is included in the syntax tree. To achieve targeted processing of different data.

[0068] S102, according to the syntax structure, the start clause, the end clause and the process clause are extracted from each Partition Range statement of the syntax tree, and the Partition Range statement is sorted according to the date value of the extracted start clause.

[0069] In the syntax tree, there are multiple Partition Range statements. According to the syntax structure, the start clause, the end clause and the process clause are extracted for each Partition Range statement. Then, the Partition Range statement is sorted according to the date value of the extracted start clause to define the partition range

[0070] Referring to Figure 3 That is 300, Figure 3 is a flowchart of processing each Partition Range statement of the syntax tree according to an embodiment of the application. Specifically, the following steps are included:

[0071] S301, according to the conversion condition of the PostgreSQL date column, according to the syntax structure, traverse each Partition Range statement of the syntax tree to extract the start clause, the end clause and the process clause, and use the keyword to extract the date value in the start clause.

[0072] According to the second conversion sub-condition in the conversion condition of the PostgreSQL date column, the Partition name, the start clause, the end clause, the process clause and the WITH clause are extracted by traversing each Partition Range statement of the syntax tree in combination with the syntax structure. Since the Partition Range statement in GBASE does not have a WITH clause, the WITH clause extracted in the Partition Range statement can be discarded.

[0073] PARTITION BY: specifies the type of partition, such as RANGE, LIST or HASH.

[0074] In an embodiment of the present application:

[0075] Start (START) clause: used for RANGE partition, specifies the starting value of the partition.

[0076] End (END) clause: used for RANGE partition, specifies the end value of the partition.

[0077] The process clause includes the EVERY clause: used for RANGE or LIST partition, specifies the step or interval of the partition.

[0078] WITH clause: used to specify the storage parameters of the partition table, such as table space.

[0079] S302, according to the date value of the extracted start clause, sort the Partition Range statements in the order from early to late.

[0080] According to the date value of the extracted start clause, sort the Partition Range statements in the order from early to late, so as to process the Partition Range statements according to the date value.

[0081] As an example, the log value format of the start clause is “'2022-01-01'::date”, and the date “'2022-01-01'” is extracted by using the Java keyword search method. Then, sort the Partition Range statements in the order from early to late according to the date value in the start clause.

[0082] In Figure 3In the embodiment of the present application, multiple literal expressions are extracted by traversing the syntax tree, and the Partition Range statement is sorted by using the log value in the literal expression to maintain the logical order of data.

[0083] S103, in the sorted Partition Range statement, the partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, so as to generate the Partition Range statement of GBASE according to the partition range mode of the Partition Range statement.

[0084] In the embodiment of the present application, considering that the partition range mode of the Partition Range statement is different, the way of generating the Partition Range statement of GBASE is different. It is necessary to first determine the partition range mode of the Partition Range statement in the sorted Partition Range statement according to the start clause, the end clause and the process clause. Then, the Partition Range statement of GBASE is generated according to the partition range mode of the Partition Range statement.

[0085] Referring to Figure 4 That is 400, Figure 4 is a flowchart of determining the partition range mode of the Partition Range statement according to the embodiment of the present application. Specifically, it includes the following steps:

[0086] S401, in the sorted Partition Range statement, the process clause is empty, and the partition range mode of the Partition Range statement is determined according to the start clause and the end clause, including explicitly specifying the partition.

[0087] The start clause and the end clause are used to define the range of each partition, and the process clause is used to define the step length of the partition.

[0088] In the sorted Partition Range statement, the process clause is empty, which means that the data does not need to be converted by using the process clause. According to the start clause and the end clause, the partition range mode of the Partition Range statement can be determined, including explicitly specifying the partition.

[0089] S402, in the sorted Partition Range statement, the process clause is not empty, and the partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, including specifying the partition by step length.

[0090] In the sorted Partition Range statement, the process clause is not empty, which indicates that the data needs to be converted by using the process clause. The range of each partition can be specified by using the process clause, and there is no need to manually create each partition. That is, the partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, and the partition range mode includes specifying the partition by step.

[0091] In Figure 4 In the embodiment, the partition range mode of the Partition Range statement can be determined according to the clauses in the sorted Partition Range statement, so as to convert the data according to the partition range mode.

[0092] In an embodiment of the present application, the partition range mode of the Partition Range statement includes explicitly specifying the partition, and the data can be converted in the following manner: extracting the date in the end clause of the Partition Range statement, generating a clause of LESS THAN of a single GBASE, and keeping the Partition name unchanged. The clause of LESS THAN belongs to the Partition Range statement of the GBASE.

[0093] As an example, the date in the end clause is extracted as $date, and a clause PARTITION $partitionName VALUES LESS THAN (to_date($date, 'yyyy-mm-dd')) is generated.

[0094] Referring to Figure 5 That is, 500, Figure 5 is a flowchart of generating the Partition Range statement of the GBASE according to the embodiment of the present application. Specifically, the flowchart includes the following steps:

[0095] S501, the partition range mode of the Partition Range statement includes specifying the partition by step, and the step parameter is extracted in the process clause of the Partition Range statement.

[0096] The Partition Range statement of the partition range mode of specifying the partition by step is identified, that is, the Partition Range statement including the start clause, the end clause and the process clause. It can be known that the partition range mode of the Partition Range statement includes specifying the partition by step.

[0097] The step parameter is extracted in the process clause of the Partition Range statement. Specifically, the step parameter is extracted by using the regular expression to match the process clause.

[0098] As an example, the step parameter includes a step value and a step unit. The step unit includes: day (DAYS); month (MONTH); year (YEAR). For example, the format of the process clause is ‘10 DAYS’::INTERVAL’, which identifies that 10 is the step value and DAYS is the step unit. The process clause indicates that a Partition partition is generated every 10 days.

[0099] S502, after initializing the method in the object with the date in the start clause and calibrating the date according to the step parameter, the LESS THAN clause is generated.

[0100] The method in the object is initialized with the date in the start clause to implement the date increment from the date after the start clause. As an example, the date initialization object includes a java.util.Calendar object.

[0101] When the step unit is MONTH or YEAR, the date increment with the step parameter only implements the month or year increment, and does not adjust the date. As an example, the step unit is MONTH, and the date increment operation is performed on 2023-04-30, which will obtain 2023-05-30, and actually 2023-05-31 is expected.

[0102] Therefore, the date needs to be calibrated. As an example, the calibration is implemented according to ‘getActualMaximum(Calendar.DAY_OF_MONTH)’.

[0103] getActualMaximum is a method of the Calendar class in Java, which is used to obtain the maximum value of a specified calendar field. When getActualMaximum(Calendar.DAY_OF_MONTH) is called, the maximum number of days in the given month is returned.

[0104] Then, the date is continuously incremented and calibrated by using the add() method of java.util.Calendar until the date exceeds the date in the end clause. The input parameters of the add() method include the step unit and the step value. The boundary of each explicit partition range is obtained according to the calibrated date.

[0105] For each boundary of the explicit partition range, a clause of LESS THAN of the GBASE partition is generated, and the original partition name is suffixed with a number as the partition name of the GBASE. The implementation splits the partition range statement into multiple clauses of LESS THAN according to the step parameter. The clause of LESS THAN belongs to the partition range statement of the GBASE.

[0106] In Figure 5 In an embodiment, the clause of LESS THAN is generated after the calibration date for the partition specified by the step. This further improves the accuracy of the converted data.

[0107] In an embodiment of the present application, the generated partition range statement of the GBASE considers the current partition range statement, and needs to be separated from the generated partition range statement of the GBASE of the next partition range statement to identify different partition range statements.

[0108] A clause can be added after the last partition range statement of the GBASE to receive other data after the added clause. As an example, the added clause includes the GBASE partition clause of MAXVALUE. The clause name is p_other. The clause is used to receive data of other ranges after the partition. MAXVALUE is used to represent the maximum possible value of the partition. For example: PARTITION p_other VALUES LESS THAN MAXVALUE.

[0109] In the above embodiment of the application, a Partition Range statement of a date column in an open-source relational database management system is parsed into a syntax tree, the syntax tree including a syntax structure of the Partition Range statement; each Partition Range statement of the syntax tree is traversed to extract a start clause, an end clause and a process clause according to the syntax structure, and the Partition Range statements are sorted according to date values of the extracted start clauses; in the sorted Partition Range statements, a partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, to generate a Partition Range statement of GBASE according to the partition range mode of the Partition Range statement. The syntax tree is used to extract multiple clauses in the Partition Range statement, and the Partition Range statement is automatically generated according to the extracted clauses. In this way, the statement conversion efficiency can be improved.

[0110] Referring to Figure 6 , Figure 6 is a main structure diagram of a data conversion device according to an embodiment of the application. The data conversion device can implement a data conversion method, such as Figure 6 As shown in 600, the data conversion device specifically includes:

[0111] The parsing module 601 is configured to parse a Partition Range statement of a date column in an open-source relational database management system into a syntax tree, the syntax tree including a syntax structure of the Partition Range statement.

[0112] The sorting module 602 is configured to traverse each Partition Range statement of the syntax tree to extract a start clause, an end clause and a process clause according to the syntax structure, and sort the Partition Range statements according to date values of the extracted start clauses.

[0113] The conversion module 603 is configured to determine a partition range mode of the Partition Range statement according to the start clause, the end clause and the process clause in the sorted Partition Range statements, to generate a Partition Range statement of GBASE according to the partition range mode of the Partition Range statement.

[0114] In an embodiment of the application, the parsing module 601 is specifically configured to obtain a conversion condition for parsing the PostgreSQL date column in the database.

[0115] In the Partition Range statement of the PostgreSQL date column, the Partition Range clause is obtained according to the range partition keyword in the conversion condition to construct the syntax tree, and the partition type and date column in the syntax tree are reserved.

[0116] In an embodiment of the present application, the sorting module 602 is specifically configured to extract a start clause, an end clause and a process clause according to the syntax structure in each Partition Range statement of the syntax tree according to the conversion condition of the PostgreSQL date column, and extract a date value in the start clause by using a keyword;

[0117] The Partition Range statements are sorted according to the date value of the extracted start clause in the order from early to late.

[0118] In an embodiment of the present application, the conversion module 603 is specifically configured to determine the partition range mode of the Partition Range statement according to the start clause and the end clause when the process clause is empty in the sorted Partition Range statement, and the partition range mode includes explicit specification of partitions.

[0119] In the sorted Partition Range statement, when the process clause is not empty, the partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, and the partition range mode includes step-by-step specification of partitions.

[0120] In an embodiment of the present application, the conversion module 603 is specifically configured to extract the date in the end clause in the Partition Range statement when the partition range mode of the Partition Range statement includes explicit specification of partitions, and generate a LESS THAN clause, and the LESS THAN clause belongs to the Partition Range statement of the GBASE.

[0121] In an embodiment of the present application, the conversion module 603 is specifically configured to extract a step parameter in the process clause of the Partition Range statement when the partition range mode of the Partition Range statement includes step-by-step specification of partitions.

[0122] The method in the object is initialized by the date in the start clause, the date is calibrated according to the step parameter, and a LESS THAN clause is generated, and the LESS THAN clause belongs to the Partition Range statement of the GBASE.

[0123] In one embodiment of the present application, the conversion module 603 is specifically configured to add a clause after the generated Partition Range statement of GBASE in the last PartitionRange statement in the order, so as to receive other data after the clause.

[0124] Figure 7 An exemplary system architecture 700 to which the method of converting data or the apparatus of converting data according to embodiments of the present application can be applied is shown.

[0125] As shown in Figure 7 the system architecture 700 can include terminal devices 701, 702, 703, a network 704 and a server 705. The network 704 is a medium to provide a communication link between the terminal devices 701, 702, 703 and the server 705. The network 704 can include various connection types, such as wired, wireless communication links or fiber optic cables, etc.

[0126] A user can use the terminal devices 701, 702, 703 to interact with the server 705 through the network 704 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 701, 702, 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0127] The terminal devices 701, 702, 703 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers and desktop computers, etc.

[0128] The server 705 can be a server providing various services, such as a background management server supporting a shopping website browsed by a user using a terminal device 701, 702, 703 (only as an example). The background management server can analyze and process received product information query requests and other data, and feed back the processing results (such as target push information, product information - only as examples) to the terminal device.

[0129] It should be noted that the method of converting data provided by embodiments of the present application is generally executed by the server 705, and accordingly, the apparatus of converting data is generally provided in the server 705.

[0130] It should be understood that Figure 7 the number of terminal devices, networks and servers in

[0131] A computing program product according to an embodiment of the present invention includes a computer program, which, when executed by a processor, implements the data conversion method provided in the embodiment of the present invention.

[0132] The following is for reference. Figure 8 It shows a schematic diagram of the structure of a computer system 800 suitable for implementing a terminal device of the present invention. Figure 8 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0133] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 802 or programs loaded from storage section 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the system 800. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0134] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.

[0135] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs the functions defined above in the system of this invention.

[0136] It should be noted that the computer-readable medium shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component. In the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0137] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a portion of code that contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than that shown in the figures. For example, two blocks that are shown in succession can actually be executed substantially concurrently, or they can sometimes be executed in reverse order, depending on the functionality involved. It should also be noted that each block in the block diagrams or flowcharts, and combinations of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs specified functions or operations, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0138] The modules described in the embodiments of the present application can be implemented in the form of software or hardware. The described modules can also be arranged in a processor, for example, a processor can be described as including

[0139] In some cases, the names of the modules do not constitute a limitation on the modules themselves, for example, the sending unit can also be described as "a unit for sending a picture acquisition request to a connected server".

[0140] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, which, when executed by the device, cause the device to include:

[0141] The Partition Range statement of the date column in the open source relational database management system is parsed into a syntax tree, and the syntax tree includes the syntax structure of the Partition Range statement;

[0142] Each Partition Range statement of the syntax tree is traversed to extract a start clause, an end clause and a process clause according to the syntax structure, and the Partition Range statements are sorted according to the date value of the extracted start clause;

[0143] In the sorted Partition Range statement, the partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, so as to generate the Partition Range statement of the GBASE according to the partition range mode of the Partition Range statement.

[0144] According to the technical scheme of the embodiment of the present application, the Partition Range statement of the date column in the open source relational database management system is parsed into a syntax tree, the syntax tree includes the syntax structure of the Partition Range statement; each Partition Range statement of the syntax tree is traversed to extract a start clause, an end clause and a process clause according to the syntax structure, and the Partition Range statement is sorted according to the date value of the extracted start clause; in the sorted Partition Range statement, the partition range mode of the Partition Range statement is determined according to the start clause, the end clause and the process clause, so as to generate the Partition Range statement of the GBASE according to the partition range mode of the Partition Range statement. The syntax tree is used to extract multiple clauses in the Partition Range statement, and the Partition Range statement is automatically generated according to the self. Further, the statement conversion efficiency can be improved.

[0145] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.

[0146] It should be noted that in the technical scheme of the present application, the collection, analysis, use, transmission and storage of user personal information are in line with relevant laws and regulations, and are used for legal and reasonable purposes, and are not shared, disclosed or sold outside these legal uses, and are subject to supervision and management by regulatory authorities. Necessary measures should be taken to prevent illegal access to such personal information data and to ensure that personnel with access to personal information data comply with relevant laws and regulations to ensure the security of user personal information. Once these user personal information data are no longer needed, the risk should be minimized by limiting or even prohibiting data collection and / or deleting data.

[0147] When applicable, including in certain related applications, user privacy is protected by de-identifying data, such as by removing specific identifiers (e.g., birth date, etc.), controlling the amount or specificity of data stored (e.g., collecting location data at the city level rather than at the specific address level), controlling how data is stored, and / or other methods of de-identification, as applicable.

Claims

1. A method of converting data, characterized by, The method comprises the following steps: parsing a Partition Range statement of a date column in an open-source relational database management system into a syntax tree, wherein the syntax tree comprises a syntax structure of the Partition Range statement; traversing each Partition Range statement of the syntax tree according to the syntax structure to extract a start clause, an end clause and a process clause, and sorting the Partition Range statements according to date values of the extracted start clauses; determining a partition range mode of the Partition Range statement according to the start clause, the end clause and the process clause in the sorted Partition Range statement, and generating a Partition Range statement of GBASE according to the partition range mode of the Partition Range statement.

2. The method of converting data according to claim 1, wherein, The step of parsing the Partition Range statement of the date column in the open-source relational database management system into the syntax tree comprises the following steps: obtaining a conversion condition for parsing the date column in the open-source relational database management system in a database; in the Partition Range statement of the date column in the open-source relational database management system, obtaining a Partition Range clause according to a range partition keyword in the conversion condition to construct the syntax tree, and retaining a partition type and a date column in the syntax tree.

3. The method of converting data according to claim 1, wherein, The step of traversing each Partition Range statement of the syntax tree according to the syntax structure to extract a start clause, an end clause and a process clause, and sorting the Partition Range statements according to date values of the extracted start clauses comprises the following steps: traversing each Partition Range statement of the syntax tree according to the syntax structure to extract a start clause, an end clause and a process clause according to a conversion condition of a PostgreSQL date column, and extracting date values in the start clause by using a keyword; sorting the Partition Range statements from early to late according to the date values of the extracted start clauses.

4. The method of converting data according to claim 1, wherein, The step of determining the partition range mode of the Partition Range statement according to the start clause, the end clause and the process clause in the sorted Partition Range statement comprises the following steps: in the sorted Partition Range statement, when the process clause is empty, determining the partition range mode of the Partition Range statement according to the start clause and the end clause comprises explicitly specifying a partition; in the sorted Partition Range statement, when the process clause is not empty, determining the partition range mode of the Partition Range statement according to the start clause, the end clause and the process clause comprises specifying a partition by a step.

5. The method of converting data according to claim 1, wherein, The step of generating the Partition Range statement of GBASE according to the partition range mode of the Partition Range statement comprises the following steps: The partition range mode of the Partition Range statement includes: explicitly specifying a partition, extracting a date in an end clause of the Partition Range statement, and generating a LESS THAN clause, which belongs to the Partition Range statement of the GBASE.

6. The method of converting data of claim 1, wherein, The generating the Partition Range statement of the GBASE according to the partition range mode of the Partition Range statement includes: The partition range mode of the Partition Range statement includes: specifying a partition by a step, extracting a step parameter in a process clause of the Partition Range statement; After initializing a method in an object by a date in a start clause, and calibrating the date according to the step parameter, a LESS THAN clause is generated, which belongs to the Partition Range statement of the GBASE.

7. The method of converting data of claim 1, wherein, After the generating the Partition Range statement of the GBASE according to the partition range mode of the Partition Range statement, the method further includes: After generating the Partition Range statement of the GBASE in a last Partition Range statement in the sorting, a clause is added to receive other data after the clause.

8. An apparatus for converting data, characterized by The method includes: a parsing module, configured to parse a Partition Range statement of a date column in an open source relational database management system into a syntax tree, the syntax tree including a syntax structure of the Partition Range statement; a sorting module, configured to traverse each Partition Range statement of the syntax tree to extract a start clause, an end clause and a process clause according to the syntax structure, and sort the Partition Range statements according to a date value of the start clause; a conversion module, configured to determine a partition range mode of the Partition Range statement according to the start clause, the end clause and the process clause in the sorted Partition Range statement, and generate a Partition Range statement of the GBASE according to the partition range mode of the Partition Range statement.

9. An electronic device that converts data, characterized by, The method includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method in any one of claims 1-7.

10. A computer readable medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method in any one of claims 1-7.

11. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the method in any one of claims 1-7.