Data processing method and device, medium, electronic equipment and program product
By directly parsing JSON data into the data format supported by the Flink engine and encoding it into transferable data, the problem of low data transmission performance under the Flink engine is solved, and more efficient CPU utilization and data transmission performance is achieved.
Patent Information
- Application Number
- CN202411858371.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-03-28
AI Technical Summary
Under the Flink engine, data transmission performance is low. The existing technology requires converting JSON data into Java objects and RowData objects, resulting in high CPU overhead and low parsing efficiency.
Generation and recycling of Java objects and RowData objects are avoided by directly parsing JSON data into first data in accordance with the data format supported by the Flink engine and encoding it into second data that supports transmission upstream and downstream in the Flink engine.
Reduces the CPU overhead of data processing and improves the performance of upstream and downstream data transmission in the Flink engine.
Smart Images

Figure CN119721003A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of electronic information technology, and in particular, to a data processing method, device, medium, electronic equipment and program product. Background Art
[0002] Flink is a distributed processing engine for distributed stream and batch processing. It was developed to address the challenges faced by traditional batch and stream processing systems in scalability, fault tolerance, and low-latency processing.
[0003] In related technologies, under the Flink engine, there are interactions between multiple modules, such as upstream and downstream data transmission and data transmission between operators, etc. How to improve the performance of data transmission is a technical problem that needs to be solved urgently. Summary of the invention
[0004] This section is provided to introduce the concepts in a brief form, which will be described in detail in the detailed implementation section below. This section is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to be used to limit the scope of the technical solution claimed for protection.
[0005] In a first aspect, the present disclosure provides a data processing method, comprising: Get JSON data; The JSON data is directly parsed into first data that conforms to a preset data format, and the first data is encoded into second data that supports upstream and downstream transmission in a Flink engine, where the preset data format is a data format supported by the Flink engine.
[0006] In a second aspect, the present disclosure provides a data processing device, comprising: The acquisition module is configured to obtain JSON data; The parsing module is configured to directly parse the JSON data into first data that conforms to a preset data format, and encode the first data into second data that supports transmission between upstream and downstream parties in the Flink engine, wherein the preset data format is a data format supported by the Flink engine.
[0007] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0008] In a fourth aspect, the present disclosure provides an electronic device, including: a storage device having at least one computer program stored thereon; At least one processing device is used to execute the at least one computer program in the storage device to implement the steps of the method described in the first aspect above.
[0009] In a fifth aspect, the present disclosure provides a computer program product, comprising a computer program, which implements the steps of the method described in the first aspect when executed by a processor.
[0010] Through the above technical solution, JSON data in JSON format is directly parsed into first data that conforms to a preset data format, and the first data is encoded into second data that supports transmission in the upstream and downstream of the Flink engine. In the process of parsing JSON, there is no need to convert the JSON data into a Java object first, which reduces the CPU (Central Processing Unit) overhead required for data processing, and there is no need to perform object recycling processing, which improves the performance of data transmission in the upstream and downstream of the Flink engine.
[0011] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 The figure is a flow chart of a data processing method according to an exemplary embodiment of the present disclosure.
[0013] Figure 2 It is a schematic diagram comparing the processes of obtaining Flink RowData by using related technologies and the present disclosure respectively according to an embodiment of the present disclosure.
[0014] Figure 3 It is a schematic diagram describing a first description text according to an exemplary embodiment of the present disclosure.
[0015] Figure 4 It is a schematic diagram showing a preset data structure according to an exemplary embodiment of the present disclosure.
[0016] Figure 5 The figure is a schematic diagram of a data structure of a second description text according to an exemplary embodiment of the present disclosure.
[0017] Figure 6 The figure is a schematic diagram of a data structure of a parsing capability parameter according to an exemplary embodiment of the present disclosure.
[0018] Figure 7 It is a block diagram of a data processing device according to an exemplary embodiment of the present disclosure.
[0019] Figure 8 It is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0021] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0022] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0023] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0024] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0025] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0026] All actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where they are located, and with the authorization given by the owner of the corresponding device.
[0027] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0028] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0029] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0030] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0031] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0032] In the related technologies based on the Flink engine, based on the provided Flink task running on the cluster and written in Java code, the Java JSON library is called to implement the parsing of JSON data, and then the JSON data is converted into data that can be transmitted in the Flink engine. For example, the above task reads JSON data from kafka / MQ (Message Queue), the JSON data is deserialized into Java objects, the Java objects are converted into RowData objects, and then the RowData objects are serialized into binary data in the RowData format that can be transmitted upstream and downstream in the Flink engine. However, this method requires continuous conversion between objects, the transmission speed is slow, and after the Java objects and RowData objects are not used, the Java objects and RowData objects need to be recycled, which has the problem of high CPU overhead; in addition, during the parsing process, some Java versions of the Java development kit do not support hardware simd instructions, and cannot achieve parallel level acceleration, resulting in low parsing efficiency. Therefore, the above method has the problem of poor performance of data transmission under the Flink engine.
[0033] In view of this, the embodiments of the present disclosure provide a data processing method, device, medium, electronic device and program product, which improve the performance of upstream and downstream data transmission in the Flink engine.
[0034] The embodiments of the present disclosure are further explained and illustrated below in conjunction with the accompanying drawings.
[0035] Figure 1 is a flowchart of a data processing method according to an exemplary embodiment of the present disclosure. The data processing method can be applied to an electronic device. The data processing method may include the following steps: Step 110, obtaining JSON data.
[0036] In this embodiment, JSON data is provided by a data provider, and the data provider can transmit the JSON data to the electronic device via a network socket; alternatively, the data provider can transmit the JSON data to a shared memory between processes, and the electronic device then obtains the JSON data from the shared memory; alternatively, the data provider can transmit the JSON data to a memory in the same address space between threads, and the electronic device then obtains the JSON data from the memory.
[0037] The JSON data at least includes business data that needs to be transmitted upstream and downstream in the Flink engine.
[0038] Step 120: directly parse the JSON data into first data that complies with a preset data format, and encode the first data into second data that supports upstream and downstream transmission in the Flink engine. The preset data format is a data format supported by the Flink engine.
[0039] It is worth noting that, in this embodiment, the JSON parsing process does not involve the generation of objects.
[0040] In this embodiment, before parsing the JSON data, it can be determined whether the JSON data is JSON data that is allowed to be parsed.
[0041] In this embodiment, the preset data format supported by the Flink engine may be the RowData format. The following describes the embodiment of the present disclosure assuming that the preset data format is the RowData format.
[0042] In this embodiment, the second data supporting the transmission of the upstream and downstream in the Flink engine may be binary data. As an example, the first data may be encoded on the output memory to improve the encoding performance.
[0043] Figure 2 FIG. 1 is a schematic diagram showing a comparison of the process of obtaining Flink RowData using the related technology and the present disclosure according to an embodiment of the present disclosure. It is worth noting that Flink RowData is the second data. Figure 2 In the Flink RowData data link obtained by using the related technology, the json binary data read from Kafka / MQ is deserialized into a json java object, then converted into a RowData object, and then serialized into Flink RowData and transmitted to the downstream for calculation or storage; while in the Flink RowData data link obtained by using the present disclosure, the json binary data read from Kafka / MQ is directly converted into Flink RowData without generating java objects and RowData objects.
[0044] Through the above method, JSON data in JSON format is directly parsed into first data that conforms to a preset data format, and the first data is encoded into second data that supports transmission in the upstream and downstream of the Flink engine. In the process of parsing JSON, there is no need to convert the JSON data into a Java object first, which reduces the CPU overhead of data processing and does not require recycling of Java objects, thereby improving the performance of data transmission in the upstream and downstream of the Flink engine.
[0045] In some embodiments, the above-mentioned step of directly parsing the JSON data into the first data that conforms to the preset data format can be implemented in the following manner: based on the acquired description text, the JSON data is directly parsed into the first data that conforms to the preset data format, the description text is used to describe the data structure of the JSON data, and each key-value pair data in the JSON data is correspondingly parsed into the data type supported by the preset data format.
[0046] It is worth noting that, in this embodiment, the description text is used to directly parse the JSON data into the first data in a preset data format.
[0047] Among them, the key-value pair data in the JSON data includes a key name and a corresponding key value. Each key-value pair data in the JSON data corresponds to a data type. Key-value pairs of different data types can be nested to form a complex data structure.
[0048] Refer to the following table, which is a comparison table of data types supported by JSON and RowData:
[0049] Through the above method, the data structure of the JSON data is described using the description text, and each key-value pair in the JSON data is parsed into a data type supported by the preset data format, thereby directly parsing the JSON data into the first data that conforms to the preset data format.
[0050] In some embodiments, the description text includes a first description text, and the relative positions of all target key names included in the first description text are consistent with the relative positions of all target key names in the data structure of the JSON data.
[0051] It is worth noting that the target key name is used to specify the target field in the JSON data that needs to be parsed.
[0052] In this embodiment, the first description text may be a character string. Figure 3 is a schematic diagram showing a first description text according to an exemplary embodiment of the present disclosure, referring to Figure 3 , the first description text is composed of Figure 3 The string representation shown includes each target key name. For ease of understanding, the target key name is directly represented by the name of the data type supported by the JOSN format in this embodiment and the following embodiments.
[0053] It is worth noting that the relative position of the target key name is consistent with the relative position of all target key names in the data structure of the JSON data, so that the data can be parsed in sequence according to the key values corresponding to each target key name in the JSON data during parsing; the target key name is used to specify the target field that needs to be parsed in the JSON data, thereby avoiding full parsing of the JSON data.
[0054] In some embodiments, the description text further includes a second description text, the second description text includes each record corresponding to each target key name, each record is carried by a preset data structure, wherein the preset data structure includes: The data type identifier is used to describe the data type to be parsed corresponding to the key-value pair data of the target key name. The data type is the data type supported by the preset data format.
[0055] The key name field is used to describe the length of the target key name and the starting address of the target key name in the first description text. Combined with the first description text, the length of the target key name and the starting address of the target key name in the first description text can assist in determining the corresponding target key name. Please refer to the following related embodiments for the specific determination method, which will not be described in detail in this embodiment.
[0056] Supplementary information is used to describe the number of sub-elements corresponding to the target key name or the size of the data type to be parsed corresponding to the key-value pair data of the target key name, so that some special types of information can be supplemented during parsing to avoid parsing errors. As an example, special types can be Array type, MAP type, and ROW type. Further supplementary information can be, for example, the size of the Array type, the size of the MAP type, or the number of ROW type elements. Here, the Array type, MAP type, and ROW type elements are all data types supported by the data formats supported by Flink.
[0057] Figure 4 is a schematic diagram showing a preset data structure according to an exemplary embodiment of the present disclosure. Figure 4 , Figure 4 The type in indicates the data type identifier. Figure 4 The field name in represents the key name field. Figure 4 The others in indicate supplementary information.
[0058] In this embodiment, the memory size occupied by each record is fixed, refer to Figure 5 As shown in the schematic diagram, multiple records of fixed memory size constitute the second description text.
[0059] As an example, a fixed 8 bytes or 16 bytes may be used to store the information of each record.
[0060] In the above manner, a preset data structure is used to transmit the relevant information required for parsing JSON data, and the memory size occupied by each record is fixed, thereby accelerating the speed of reading records. And because the key name is generally in the form of a string, its length is variable. Therefore, if you want to keep the memory size occupied by each record fixed, consider storing the key name (i.e., the first description text) separately in a memory area, and hit the target key name with the starting address (i.e., offset) and length, so as to better achieve the fixed memory size occupied by each record.
[0061] In some embodiments, the above-mentioned step of directly parsing JSON data into first data that conforms to a preset data format based on the acquired description text can be implemented in the following manner: for each record, determine the target key name in the first description text corresponding to the record based on the key name field in the record, and parse the key-value pair data corresponding to the target key name according to the data type indicated by the data type identifier in the record to obtain the corresponding first data.
[0062] Taking the first record {MAP, 0, 0, 6} as an example, the data in the first record are interpreted in order. MAP represents the data type indicated by the data type identifier. The first 0 represents the starting address (i.e., offset) of the target key name in the first description text. The second 0 represents the length of the target key name. 6 represents the number of sub-elements corresponding to the target key name, indicating that the JSON data is an object, and the key-value pairs corresponding to the following 6 records should be parsed as sub-elements corresponding to the target key name.
[0063] Continuing with the second record {BIGINT,0,5,0} as an example, BIGINT indicates the data type indicated by the data type identifier, the first 0 indicates the starting address (i.e. offset) of the target key name in the first description text, 5 indicates the length of the target key name, and the second 0 indicates that the key-value pair corresponding to the target key name does not contain child elements. Figure 3 In the example, the string with the starting address of 0 and the length of 5 is "int64", that is, "int64" is the target first key-value pair. The key-value pair data corresponding to "int64" is parsed according to the data type BIGINT indicated by the data type identifier in this record to obtain the corresponding first data.
[0064] In other embodiments, the data type identifier in the record may also be represented by numbers, and different numbers represent different data types supported by the preset data format.
[0065] In the above manner, the hit fields (i.e., target key names) in the JSON data are compared according to the first description text and the second description text, and in the case of a hit, the data type indicated by the data type identifier in the record is parsed to obtain the corresponding first data.
[0066] In some embodiments, the electronic device implements the parsing of JSON data by calling and executing a compiled target code that belongs to a preset code language, and the preset code language is a code language that has the ability to parse data in parallel.
[0067] In this embodiment, the preset code language may be C++, which may use simd instructions to implement parallel parsing of data.
[0068] In this embodiment, the electronic device is a server that executes the Flink task running on the cluster mentioned above. It is necessary to ensure that the server can call the C++ code to implement the parsing of JSON data based on C++. And due to the diversity of servers in the cluster, it is necessary to compile and adapt the C++ codes using multiple architectures and multiple instruction sets respectively, so as to provide compilation products of multiple architectures and instruction sets, such as sse and avx2 on x86, and neon on arm, etc.
[0069] It is worth noting that when implementing the parsing of JSON data through target code, the preset data structure can be understood as the data structure of the service based on C++ code and the service agreement based on Java code. These services (ie tasks) all run in the above cluster.
[0070] In this embodiment, after obtaining the second data, the service based on C++ code can notify the service based on Java code Flink RowData to complete the data parsing, construct the parsed data into a java packaging structure according to the agreed API (Application Programming Interface), and send it to the service based on Java code, thereby facilitating upstream and downstream data transmission in the Flink engine.
[0071] In the above way, the parsing of JSON data can be implemented by using a compiled code language with the ability to parse data in parallel, which can improve the parsing efficiency. In addition, by using the agreed preset data structure, various information required for the conversion from JSON to Flink rowdata can be transmitted between services based on Java code and services based on C++ code.
[0072] In some embodiments, the second description text may further include a parsing capability parameter, which may be designed in a one-hot manner and encoded by 0 or 1. As an example, encoding 0 indicates that the parsing capability corresponding to the parsing capability parameter is turned off, and the parsing capability cannot be supported when parsing JSON; encoding 1 indicates that the parsing capability corresponding to the parsing capability parameter is turned on, and the parsing capability is supported when parsing JSON. Figure 6 , parameter 1, parameter 2, ..., parameter M represents different parsing capability parameters. By configuring 0 or 1 corresponding to each parameter, the parsing capability is configured.
[0073] As an example, the parsing capability parameter includes at least one of the following: The ability to specify a timestamp format (timestamp-format) refers to the format of the timestamp. In JSON data, timestamps are usually represented as strings and follow a specific date and time format. Common timestamp formats include ISO 8601 (such as "2024-07-10T14:48:00Z"), which is an international standard date and time representation method that is easy for machines to parse.
[0074] Error JSON handling capabilities (fail-on-missing-field / ignore-field-parse-errors), fail-on-missing-field means that when parsing JSON data, if you encounter a missing expected field, this option will cause the parser to throw an error or fail. This is a strict mode that ensures that all necessary data exists; ignore-field-parse-errors is opposite to fail-on-missing-field. The ignore-field-parse-errors option allows the parser to continue executing when encountering a parsing error or missing field instead of failing immediately. This can be used for fault tolerance, but may result in lost or incomplete data.
[0075] The ability to fill in data integrity (default-on-missing-field) refers to using a default value instead when an expected field is missing in the JSON data. For example, if a JSON object is missing an expected numeric field, the default-on-missing-field configuration may specify a default value (such as 0) to replace the missing field.
[0076] Figure 7 is a block diagram of a data processing device according to an exemplary embodiment of the present disclosure, and the device may include: The acquisition module is configured to obtain JSON data; The parsing module is configured to directly parse the JSON data into first data that conforms to a preset data format, and encode the first data into second data that supports transmission between upstream and downstream parties in the Flink engine, wherein the preset data format is a data format supported by the Flink engine.
[0077] Optionally, the parsing module includes: The parsing submodule is configured to directly parse the JSON data into first data that conforms to a preset data format based on the acquired description text, wherein the description text is used to describe the data structure of the JSON data, and each key-value pair data in the JSON data is correspondingly parsed into a data type supported by the preset data format.
[0078] Optionally, the key-value pair data includes a key name and a corresponding key value, the description text includes a first description text and a second description text, the relative positions of all target key names included in the first description text are consistent with the relative positions of all target key names in the data structure of the JSON data, and the second description text includes each record corresponding to each target key name, and each record is carried by a preset data structure, and the preset data structure includes: A data type identifier, used to describe the data type of the key-value pair data corresponding to the target key name to be parsed, and the data type is the data type supported by the preset data format; A key name field, used to describe the length of the target key name and the starting address of the target key name in the first description text; Supplementary information, used to describe the number of sub-elements corresponding to the target key name or the size information of the data type parsed corresponding to the key-value pair data of the target key name.
[0079] Optionally, the memory size occupied by each record is fixed.
[0080] Optionally, the parsing submodule is configured to determine, for each of the records, a target key name corresponding to the record in the first description text based on the key name field in the record, and parse the key-value pair data corresponding to the target key name according to the data type indicated by the data type identifier in the record to obtain the corresponding first data.
[0081] Optionally, the parsing of the JSON data is achieved by calling and executing a compiled target code that belongs to a preset code language, and the preset code language is a code language that has the ability to parse data in parallel.
[0082] Optionally, the second description text further includes a parsing capability parameter, and the parsing capability parameter includes at least one of the following: The ability to specify timestamp formats; Error JSON handling capabilities; Padding capability used to determine data integrity.
[0083] The implementation of each module in the above device can refer to the above related embodiments, and this embodiment will not be described in detail here.
[0084] An embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, and the program implements the steps of the above method when executed by a processing device.
[0085] An embodiment of the present disclosure provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0086] An embodiment of the present disclosure provides an electronic device, including: a storage device having at least one computer program stored thereon; At least one processing device is used to execute the at least one computer program in the storage device to implement the steps of the above method.
[0087] Reference below Figure 8 , which shows a schematic diagram of the structure of an electronic device 800 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0088] like Figure 8 As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0089] Typically, the following devices may be connected to the I / O interface 805: an input device 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 808 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0090] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 809, or installed from a storage device 808, or installed from a ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0091] It should be noted that the computer-readable medium mentioned above in the present disclosure may 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 be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0092] In some embodiments, the electronic devices may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0093] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0094] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains JSON data; directly parses the JSON data into first data that conforms to a preset data format, and encodes the first data into second data that supports transmission upstream and downstream in the Flink engine, and the preset data format is a data format supported by the Flink engine.
[0095] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0096] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0097] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, limit the module itself.
[0098] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0099] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 foregoing.
[0100] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0101] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0102] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. A data processing method, characterized in that: The method comprises: Get JSON data; The JSON data is directly parsed into first data that conforms to a preset data format, and the first data is encoded into second data that supports upstream and downstream transmission in a Flink engine, where the preset data format is a data format supported by the Flink engine.
2. The method according to claim 1, characterized in that The directly parsing the JSON data into first data conforming to a preset data format includes: According to the obtained description text, the JSON data is directly parsed into first data that conforms to a preset data format, the description text is used to describe the data structure of the JSON data, and each key-value pair data in the JSON data is correspondingly parsed into a data type supported by the preset data format.
3. The method according to claim 2, characterized in that The key-value pair data includes a key name and a corresponding key value, the description text includes a first description text and a second description text, the relative positions of all target key names included in the first description text are consistent with the relative positions of all target key names in the data structure of the JSON data, and the second description text includes each record corresponding to each target key name, and each record is carried by a preset data structure, and the preset data structure includes: A data type identifier, used to describe the data type of the key-value pair data corresponding to the target key name to be parsed, and the data type is the data type supported by the preset data format; A key name field, used to describe the length of the target key name and the starting address of the target key name in the first description text; Supplementary information, used to describe the number of sub-elements corresponding to the target key name or the size information of the data type parsed corresponding to the key-value pair data of the target key name.
4. The method according to claim 2, characterized in that: The memory size occupied by each record is fixed.
5. The method according to claim 3, characterized in that: The step of directly parsing the JSON data into first data conforming to a preset data format according to the acquired description text includes: For each of the records, the target key name corresponding to the record in the first description text is determined based on the key name field in the record, and the key-value pair data corresponding to the target key name is parsed according to the data type indicated by the data type identifier in the record to obtain the corresponding first data.
6. The method according to any one of claims 1 to 5, characterized in that: The parsing of the JSON data is achieved by calling and executing a compiled target code that belongs to a preset code language, and the preset code language is a code language that has the ability to parse data in parallel.
7. The method according to claim 3, characterized in that: The second description text further includes a parsing capability parameter, and the parsing capability parameter includes at least one of the following: The ability to specify timestamp format; Error JSON handling capabilities; Padding capability used to determine data integrity.
8. A data processing device, characterized in that: include: The acquisition module is configured to obtain JSON data; The parsing module is configured to directly parse the JSON data into first data that conforms to a preset data format, and encode the first data into second data that supports transmission between upstream and downstream parties in the Flink engine, wherein the preset data format is a data format supported by the Flink engine.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: include: a storage device having at least one computer program stored thereon; At least one processing device, configured to execute the at least one computer program in the storage device to implement the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.