Methods, devices, storage media, and electronic devices for acquiring Hive data

By calling the executable files of the target component and the local shared library in the Hive database, the problem of low data acquisition efficiency caused by Java version differences is solved, achieving efficient Hive data acquisition and data source compatibility.

CN116226246BActive Publication Date: 2026-05-26HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD
Filing Date
2022-12-30
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Because Hive databases support Java version JDK8, existing technologies cannot use integration frameworks that do not support JDK11 to retrieve data from Hive databases, resulting in low retrieval efficiency.

Method used

By calling the target component in the component library of the preset service framework, executing files in multiple programming languages ​​supported by the local shared library, and calling the Hive database API to obtain data, including creating custom components and parsing data links, and using data cursors to traverse query addresses to obtain results.

Benefits of technology

It overcomes Java version limitations, improves the efficiency of Hive data retrieval, expands data integration capabilities, and supports compatibility with Hive data sources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116226246B_ABST
    Figure CN116226246B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, storage medium, and electronic device for acquiring Hive data, relating to the field of database technology. The method for acquiring Hive data includes: responding to a data call instruction and calling a target component from a component library of a preset service framework, wherein the target component is created using a target coding language; obtaining an executable file from a local shared library that the target component needs to execute, wherein the local shared library supports multiple programming languages; executing the executable file to call the Hive database's API, and obtaining Hive data from the Hive database according to the API. This technical solution solves the technical problem of how to acquire Hive database data more efficiently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database technology, and more specifically, to a method, apparatus, storage medium, and electronic device for acquiring Hive data. Background Technology

[0002] Currently, Hive data is generally retrieved from the Hive database. However, because the Hive database only supports JDK 8, Hive data can only be retrieved from the Hive database through an integration framework that supports JDK 8. For example, taking the lightweight integration framework Apache Camel K built with Apache Camel as an example, Apache Camel K uses Quarkus as its runtime by default, but Quarkus requires a minimum Java version of JDK 11. The two versions are different, making it impossible to directly retrieve Hive data from the Hive database.

[0003] This limitation, stemming from the Java version supported by the Hive database, prevents the use of integration frameworks not supported by the Hive database to retrieve Hive data. This severely restricts the channels for obtaining Hive data, resulting in low efficiency in data retrieval. Therefore, there is a technical challenge in related technologies to find a more efficient way to retrieve data from the Hive database.

[0004] No effective solution has yet been proposed for the technical problem of how to more efficiently obtain data from Hive databases. Summary of the Invention

[0005] This application provides a method, apparatus, storage medium, and electronic device for acquiring Hive data, in order to at least solve the technical problem of how to acquire Hive database data more efficiently in related technologies.

[0006] According to one embodiment of this application, a method for acquiring Hive data is provided, comprising: responding to a data call instruction to call a target component from a component library of a preset service framework, wherein the target component is created using a target coding language; acquiring an executable file to be executed by the target component from a local shared library, wherein the local shared library supports multiple programming languages; executing the executable file to call a Hive database API, and acquiring Hive data of the Hive database according to the API.

[0007] In one exemplary embodiment, before invoking the target component from the component library of a preset service framework in response to a data invocation instruction, the method further includes: creating a custom component within the component library of the preset service framework, wherein the custom component is used to automatically invoke the executable file of the local shared library; wherein creating the custom component within the component library of the preset service framework includes: generating a first component for implementing a component interface based on a default component template within the component library of the preset service framework; and generating the custom component based on the first component and a second component for invoking the executable file of the local shared library.

[0008] In one exemplary embodiment, calling a target component from a component library of a preset service framework includes: obtaining custom components already created within the component library of the preset service framework; searching for a component with a name matching the target component from the custom components; if the search is successful, identifying the found component as the target component and calling the target component; if the search fails, generating the target component based on the default component template and the component information of the target component, and calling the target component.

[0009] In one exemplary embodiment, before obtaining the executable file to be executed by the target component from the local shared library, the method further includes: parsing the data link provided by the Hive database to obtain the default programming language call interface supported by the Hive database; determining the application that interfaces with the default programming language call interface; and generating the local shared library based on the application and the query interface for providing data query functions of the Hive database, wherein the local shared library is created using the default programming language.

[0010] In an exemplary embodiment, after generating the local shared library based on the application and the query interface for providing data query functionality for the Hive database, the method further includes: creating a data cursor according to the data link; parsing the received query instruction to obtain the query address of the data to be queried in the Hive database; using the data cursor to traverse the query address and determining the query value corresponding to the query address as the query result.

[0011] In an exemplary embodiment, after generating the local shared library based on the application and a query interface for providing data query functionality for the Hive database, the method further includes: executing a first executable file of the local shared library to obtain a first object corresponding to the default programming language call interface, wherein the executable file includes the first executable file, which is used to obtain the object corresponding to the call interface; and using the first object to initialize the data link provided by the Hive database to obtain a target data link, wherein the target data link is used to provide the call interface for the Hive database.

[0012] In one exemplary embodiment, executing the executable file to invoke the Hive database's API includes: executing a second executable file of the local shared library to invoke the first object; and, if the first object is successfully invoked, using the target data link to invoke the Hive database's API, wherein the executable file further includes the second executable file.

[0013] According to another embodiment of the present application, a Hive data acquisition device is also provided, comprising: a first acquisition module, configured to respond to a data call instruction and call a target component from a component library of a preset service framework, wherein the target component is created using a target coding language; a second acquisition module, configured to acquire an executable file to be executed by the target component from a local shared library, wherein the local shared library supports multiple programming languages; and an execution module, configured to execute the executable file to call the Hive database's API and acquire Hive data from the Hive database according to the API.

[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described method for acquiring Hive data at runtime.

[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described method for acquiring Hive data through the computer program.

[0016] In this embodiment, in response to a data call instruction, a target component is called from the component library of a preset service framework, wherein the target component is created using a target coding language; an executable file to be executed by the target component is obtained from a local shared library, wherein the local shared library supports multiple programming languages; the executable file is executed to call the Hive database's API, and Hive data from the Hive database is obtained according to the API; by adopting the above technical solution, the technical problem of how to obtain Hive database data more efficiently is solved, thereby improving the efficiency of Hive data acquisition. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of the hardware environment for a method of acquiring Hive data according to an embodiment of this application;

[0020] Figure 2 This is a flowchart of a method for acquiring Hive data according to an embodiment of this application;

[0021] Figure 3 This is a schematic diagram (a) of a method for acquiring Hive data according to an embodiment of this application;

[0022] Figure 4 This is a schematic diagram (II) of a method for acquiring Hive data according to an embodiment of this application;

[0023] Figure 5 This is a structural block diagram of a Hive data acquisition device according to an embodiment of this application. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] Next, the technical terms used in this application will be explained:

[0027] Apache Camel K (or simply Camel K) is a lightweight integration framework built on Apache Camel, running natively on Kubernetes, and specifically designed for serverless and microservice architectures. Camel K users can immediately run integration code written in Camel DSL on their preferred cloud servers (Kubernetes or OpenShift).

[0028] Apache Hive (also known as Hive Database) is a data warehouse software project built on top of Apache Hadoop, providing data query and analysis capabilities. Hive Database offers a SQL-like interface for retrieving data stored in various databases and file systems integrated with Hadoop.

[0029] Quarkus is a native Java framework for Kubernetes, customized for GraalVM and HotSpot, built with the best Java libraries and standards. Its goal is to make Java the leading platform for Kubernetes and serverless environments, while providing developers with a framework to solve broader distributed application architectures.

[0030] Go is an open-source programming language, supported by open-source technology from Google.

[0031] GoHive is the driver for Hive and Spark's distributed SQL engine in Go.

[0032] Cgo can create Go packages that can be called by C code.

[0033] Java Native Access (JNA) provides Java programs with easy access to native shared libraries, requiring only Java code and no JNI or native code. Functions in native shared libraries can be called directly. JNA uses a small JNI library root to dynamically invoke native code. Developers use a Java interface to describe the functions and structures in the target native library. This makes leveraging the functionality of the native platform quite easy, without the high overhead of configuring and building JNI code for multiple platforms.

[0034] Camel K uses Quarkus as its runtime by default. Quarkus requires a minimum Java version of JDK 11, while Hive supports a maximum Java version of JDK 8. Therefore, due to JDK version limitations, it is currently not possible to use Hive as a data source on Camel K.

[0035] The Spring framework is an open-source application framework on the Java platform that provides a container with inversion of control features.

[0036] Compared to Spring Boot, Quarkus consumes fewer resources, which is beneficial for saving resources in cloud-native environments. Because it has index information of the classes and resources contained in dependent JARs, it starts up faster than traditional JARs, consumes less memory, has a shorter startup time, and supports fast-jar packaging. At startup, compared to traditional JARs, it avoids the tedious step of traversing every JAR on the classpath to load a class or resource.

[0037] According to one aspect of the embodiments of this application, a method for acquiring Hive data is provided. This method for acquiring Hive data is widely used in whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligence house ecosystems. Optionally, in this embodiment, the above-mentioned method for acquiring Hive data can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0038] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0039] This embodiment provides a method for acquiring Hive data, applied to the aforementioned computer terminal. Figure 2 This is a flowchart of a method for acquiring Hive data according to an embodiment of this application, which includes the following steps:

[0040] Step S202: In response to the data call instruction, call the target component from the component library of the preset service framework, wherein the target component is created using the target encoding language;

[0041] Step S204: Obtain the executable file to be executed by the target component from the local shared library, wherein the local shared library supports multiple programming languages;

[0042] It should be noted that the local shared library supports a variety of programming languages, including but not limited to C, C++, Java, Python, and PHP.

[0043] Step S206: Execute the executable file to call the Hive database API and obtain the Hive data from the Hive database according to the API.

[0044] API stands for Application Programming Interface.

[0045] Through the above steps, in response to data call instructions, the target component is called from the component library of the preset service framework, wherein the target component is created using the target coding language; the executable file to be executed by the target component is obtained from the local shared library, wherein the local shared library supports multiple programming languages; the executable file is executed to call the Hive database's API, and Hive data in the Hive database is obtained according to the API. This solves the technical problem of how to obtain Hive database data more efficiently in related technologies, thereby improving the efficiency of Hive data acquisition.

[0046] In one exemplary embodiment, before executing the technical solution of responding to the data call instruction in step S202 above and calling the target component from the component library of the preset service framework, other technical solutions are also provided. Specific steps include: creating a custom component within the component library of the preset service framework, wherein the custom component is used to automatically call the executable file of the local shared library; wherein creating the custom component within the component library of the preset service framework includes: generating a first component for implementing the component interface based on a default component template within the component library of the preset service framework; and generating the custom component based on the first component and a second component for calling the executable file of the local shared library.

[0047] It should be noted that, in the above embodiments, the preset service framework can be, for example, a service framework such as Apache CamelK, but is not limited to this.

[0048] In an exemplary embodiment, to better understand the implementation process of how to call the target component from the component library of the preset service framework in step S202 above, the following steps are proposed, specifically including: obtaining custom components that have been created in the component library of the preset service framework; searching for a component with the same component name as the target component from the custom components; if the search is successful, determining the found component as the target component and calling the target component; if the search fails, generating the target component according to the default component template and the component information of the target component, and calling the target component.

[0049] In an exemplary embodiment, before performing the above-described step S204 of obtaining the executable file to be executed by the target component from the local shared library, the data link provided by the Hive database can be further parsed to obtain the default programming language call interface supported by the Hive database; the application that interfaces with the default programming language call interface can be determined; and the local shared library can be generated based on the application and the query interface for providing data query functions of the Hive database, wherein the local shared library is created using the default programming language.

[0050] It should be noted that the aforementioned default programming language calling interface may include, for example, the Go programming language calling interface, but is not limited to this.

[0051] In one exemplary embodiment, after generating the local shared library based on the application and the query interface for providing data query functionality for the Hive database, other implementation processes are also provided, specifically including: creating a data cursor according to the data link; parsing the received query instruction to obtain the query address of the data to be queried in the Hive database; using the data cursor to traverse the query address and determining the query value corresponding to the query address as the query result.

[0052] In the above embodiments, the process of creating a data cursor based on the data link may include, for example, creating a cursor using a connection, such as conn.Cursor(); parsing the received query instruction to obtain the query address of the data to be queried in the Hive database, for example, executing an SQL statement using a cursor, such as cursor.Exec(ctx,sql).

[0053] In an exemplary embodiment, further, after generating the local shared library based on the application and the query interface for providing data query functionality for the Hive database, the following implementation steps are proposed: executing a first executable file of the local shared library to obtain a first object corresponding to the default programming language call interface, wherein the executable file includes the first executable file, which is used to obtain the object corresponding to the call interface; using the first object to initialize the data link provided by the Hive database to obtain a target data link, wherein the target data link is used to provide the call interface for the Hive database.

[0054] In an exemplary embodiment, the process of executing the executable file to call the API of the Hive database is described by the following steps, specifically including: executing the second executable file of the local shared library to call the first object; if the first object is successfully called, using the target data link to call the API of the Hive database, wherein the executable file further includes the second executable file.

[0055] Optionally, in an exemplary embodiment, Spring Boot can also be used as the runtime for CamelK to retrieve Hive data from the Hive database. Since Spring Boot supports JDK 8, using Spring Boot as the runtime for CamelK can support JDK 8 for the Hive database.

[0056] To better understand the process of acquiring Hive data described above, the following implementation process is proposed, with specific steps as follows:

[0057] Step 1: Wrap the Go library with CGO to generate a native shared library. CGO can create Go packages that call C code. Wrapping the gohive API with CGO enables the process of packaging gohive into a native shared library. The specific implementation steps are as follows:

[0058] Step 1.1: Obtain the API used to establish a connection in the Hive database:

[0059] You can use the gohive API gohive.Connect (which is the default programming language API supported by Hive databases) to establish a database connection, such as:

[0060] connection,err:=gohive.Connect(config.Host,config.Port,"NONE",configuration);

[0061] Next, use the CGO directive to obtain the go function. For example:

[0062] / / export Init Connection;

[0063] func Init Connection(key,config Strstring)int{…};

[0064] Subsequently, Go functions can be exported for use in C code using the / / export annotation.

[0065] In step 1.1, the aforementioned API gohive.Connect is a session between the application and the Hive database, which helps establish a connection to the database.

[0066] Step 1.2: Obtain the APIs from the Hive database used for data retrieval:

[0067] Use CGO annotations to export query APIs, such as:

[0068] / / export Query;

[0069] func Query(key,sql string)*C.char{…};

[0070] Next, a cursor is created using a connection, such as `conn.Cursor()`. A cursor is a temporary memory location or temporary workstation. It is allocated by the database server when a user performs DML (Data Manipulation Language) operations on a table. Cursors are used to store database tables. Cursors are created by the user and are used whenever the user needs them. Explicit cursors are used to retrieve data from a table row by row.

[0071] Then use the cursor to execute the SQL statement, such as: cursor.Exec(ctx,sql).

[0072] Finally, use a cursor to retrieve the data, such as:

[0073] var data[]map[string]interface{};

[0074] for cursor.HasMore(ctx){

[0075] rowMap:=cursor.RowMap(ctx);

[0076] data=append(data,rowMap)};

[0077] Step 1.3: Generate a local shared library that supports the Go programming language.

[0078] Shared libraries, also known as "shared components" or "archive libraries," are libraries composed of multiple compiled object code files. For example, functions or methods shared by multiple applications can be extracted from the application's source code, compiled, and bundled into a library. This allows direct calling of these functions or methods, simplifying the multiple uses and sharing of different functions or methods across applications. Furthermore, Java Native Access (JNA) provides Java programs with easy access to native shared libraries, enabling direct calling of their functions.

[0079] The process of generating the local shared library file described above is, for example, using the `go build` command to package the file into a .so file, such as `go build -o hive.so -buildmode=c-shared example`.

[0080] Step 2: Wrap the native shared library with JNA so that Java can call the library written in the Go programming language.

[0081] First, define an interface to represent the methods exposed using CGO, such as:

[0082]

[0083] Next, to obtain an object that implements this interface, use JNA methods to load the .so file, such as:

[0084] GoHive goHive=(GoHive)Native.loadLibrary("hive.so",GoHive.class);

[0085] Then, to enable other objects to use this object for queries, the InitConnection method is called to initialize the Hive connection, such as goHive.InitConnection(toGoString(key),toGoString(configJson)). At this point, other objects can use the established Hive connection to query Hive by calling goHive.Query(toGoString(key),toGoString(sql)), which is the gohive object's call method, thereby realizing the process of using JNA to call the .so file exposed by CGO.

[0086] Step 3: By using Java to call other programming languages, you can bypass Hive's Java version restrictions: You can reference the Camel component in a custom component library (i.e., a custom component library) to call the API used by the Hive database to establish connections;

[0087] You can obtain the published Camel Component (i.e., the target component) from the Maven repository, reference the Camel Component in Camel, and then use the component's process method to get the result obtained in step 2.

[0088] The process method is a core method of the Camel Component. It is typically called when a message flows from one Component to another during the routing process.

[0089] The implementation program is as follows:

[0090]

[0091] To better understand the process of acquiring Hive data described above, the implementation flow of acquiring Hive data will be further explained below with reference to optional embodiments, but this is not intended to limit the technical solution of the embodiments of this application.

[0092] In one embodiment, it can be combined Figure 3 This section explains the process of acquiring Hive data. Figure 3 This is a schematic diagram (a) illustrating a method for acquiring Hive data according to an embodiment of this application, as shown below. Figure 3 As shown, when Camel K runs on Quarkus, by wrapping the native shared library (GolangNative Library in the diagram) generated based on the Go programming language using the JVM, it can provide conversion conditions between Go and the Java programming language through the native shared library. This allows for calling the APIs used to establish connections in the Hive database by invoking the Camel K component. In this embodiment, using gohive as the Hive driver, using cgo to create the native shared library, using jna to call functions in the native shared library, and wrapping it as a Camel K component, Camel K can be used to retrieve Hive data from the Hive database.

[0093] The above embodiments achieve compatibility between Quarkus and Hive, allowing users to simultaneously enjoy the advantages of Quarkus' cloud-native framework and Hive's big data capabilities. This enables Camelk to support Hive data sources and expands its data integration capabilities.

[0094] Optionally, in other embodiments, combined with Figure 4 This provides a method for obtaining Hive data. Figure 4 This is a schematic diagram (II) of a method for acquiring Hive data according to an embodiment of this application, as shown below. Figure 4 As shown, the Hive API can be wrapped using the JVM, and the wrapped Hive API can be deployed as an independent process. The RPC interface exposed by the independent process enables the use of RPC to call the Hive API in the Hive Component.

[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0096] Figure 5 This is a structural block diagram of a Hive data acquisition device according to an embodiment of this application; as shown below. Figure 5 As shown, it includes:

[0097] The first acquisition module 52 is used to respond to a data call command and call a target component from the component library of a preset service framework, wherein the target component is created using a target encoding language;

[0098] The second acquisition module 54 is used to acquire the executable file that the target component needs to execute from a local shared library, wherein the local shared library supports multiple programming languages;

[0099] It should be noted that the local shared library supports a variety of programming languages, including but not limited to C, C++, Java, Python, and PHP.

[0100] The execution module 56 is used to execute the executable file to call the Hive database API and obtain Hive data from the Hive database according to the API.

[0101] The aforementioned device responds to data call commands, calls a target component from the component library of a preset service framework, wherein the target component is created using a target coding language; obtains the executable file to be executed by the target component from a local shared library, wherein the local shared library supports multiple programming languages; executes the executable file to call the Hive database's API, and obtains Hive data from the Hive database according to the API, thus solving the technical problem of how to obtain Hive database data more efficiently in related technologies, thereby improving the efficiency of Hive data acquisition.

[0102] It should be noted that, in the above embodiments, the preset service framework can be, for example, a service framework such as Apache CamelK, but is not limited to this.

[0103] In an exemplary embodiment, the Hive data acquisition device further includes a construction module, configured to: create a custom component within the component library of the preset service framework, wherein the custom component is used to automatically call the executable file of the local shared library; wherein creating the custom component within the component library of the preset service framework includes: generating a first component for implementing a component interface based on a default component template within the component library of the preset service framework; and generating the custom component based on the first component and a second component for calling the executable file of the local shared library.

[0104] In an exemplary embodiment, the first acquisition module 52 is further configured to: acquire custom components already created in the component library of the preset service framework; search for a component whose name matches that of the target component from the custom components; if the search is successful, determine the found component as the target component and call the target component; if the search fails, generate the target component according to the default component template and the component information of the target component, and call the target component.

[0105] In one exemplary embodiment, the Hive data acquisition device further includes a parsing module, configured to: parse the data link provided by the Hive database to obtain the default programming language call interface supported by the Hive database; determine the application that interfaces with the default programming language call interface; and generate the local shared library based on the application and the query interface for providing data query functions of the Hive database, wherein the local shared library is created using the default programming language.

[0106] It should be noted that the aforementioned default programming language calling interface may include, for example, the Go programming language calling interface, but is not limited to this.

[0107] In an exemplary embodiment, the parsing module described above is further configured to: create a data cursor based on the data link; parse the received query instruction to obtain the query address of the data to be queried in the Hive database; traverse the query address using the data cursor, and determine the query value corresponding to the query address as the query result.

[0108] In the above embodiments, the process of creating a data cursor based on the data link may include, for example, creating a cursor using a connection, such as conn.Cursor(); parsing the received query instruction to obtain the query address of the data to be queried in the Hive database, for example, executing an SQL statement using a cursor, such as cursor.Exec(ctx,sql).

[0109] In an exemplary embodiment, the parsing module described above is further configured to: execute a first executable file of the local shared library to obtain a first object corresponding to the default programming language call interface, wherein the executable file includes the first executable file, which is used to obtain the object corresponding to the call interface; use the first object to initialize the data link provided by the Hive database to obtain a target data link, wherein the target data link is used to provide the call interface of the Hive database.

[0110] In an exemplary embodiment, the parsing module is further configured to: execute the second executable file of the local shared library to call the first object; and, if the first object is successfully called, use the target data link to call the Hive database's calling interface, wherein the executable file further includes the second executable file.

[0111] Optionally, in an exemplary embodiment, Spring Boot can also be used as the runtime for CamelK to retrieve Hive data from the Hive database. Since Spring Boot supports JDK 8, using Spring Boot as the runtime for CamelK can support JDK 8 for the Hive database.

[0112] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.

[0113] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:

[0114] S1, responding to the data call instruction, call the target component from the component library of the preset service framework, wherein the target component is created using the target encoding language;

[0115] S2, Obtain the executable file to be executed by the target component from the local shared library, wherein the local shared library supports multiple programming languages;

[0116] S3, execute the executable file to call the Hive database API and obtain the Hive data of the Hive database according to the API.

[0117] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0118] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0119] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0120] S1, responding to the data call instruction, call the target component from the component library of the preset service framework, wherein the target component is created using the target encoding language;

[0121] S2, Obtain the executable file to be executed by the target component from the local shared library, wherein the local shared library supports multiple programming languages;

[0122] S3, execute the executable file to call the Hive database API and obtain the Hive data of the Hive database according to the API.

[0123] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0124] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0125] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0126] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for acquiring Hive data, characterized in that, include: Create a custom component within the component library of the preset service framework, wherein the custom component is used to automatically call the executable file of the local shared library; In response to a data call instruction, a target component is called from the component library of the preset service framework, wherein the target component is created using a target coding language and includes at least a custom component already created within the component library of the preset service framework; The executable file to be executed by the target component is obtained from the local shared library, wherein the local shared library supports multiple programming languages; The executable file is executed to call the Hive database API and obtain Hive data from the Hive database based on the API.

2. The method for acquiring Hive data according to claim 1, characterized in that, Creating the custom component within the component library of the preset service framework includes: The first component is generated based on the default component template in the component library of the preset service framework to implement the component interface; The custom component is generated based on the first component and the second component of the executable file used to call the local shared library.

3. The method for acquiring Hive data according to claim 2, characterized in that, Call the target component from the component library of the pre-defined service framework, including: Obtain the custom components that have already been created in the component library of the preset service framework; Find the component within the custom component whose name matches that of the target component; If the search is successful, the found component is identified as the target component, and the target component is invoked. If the search fails, the target component is generated based on the default component template and the component information of the target component, and the target component is invoked.

4. The method for acquiring Hive data according to claim 1, characterized in that, Before retrieving the executable file required by the target component from the local shared library, the method further includes: Parse the data links provided by the Hive database to obtain the default programming language call interfaces supported by the Hive database; Identify the application that interfaces with the default programming language call interface; The local shared library is generated based on the application and the query interface used to provide data query functionality for the Hive database, wherein the local shared library is created using the default programming language.

5. The method for acquiring Hive data according to claim 4, characterized in that, After generating the local shared library based on the application and the query interface used to provide data query functionality for the Hive database, the method further includes: Create a data cursor based on the data link; The received query command is parsed to obtain the query address of the data to be queried in the Hive database; The data cursor is used to traverse the query address, and the query value corresponding to the query address is determined as the query result.

6. The method for acquiring Hive data according to claim 4, characterized in that, After generating the local shared library based on the application and the query interface used to provide data query functionality for the Hive database, the method further includes: Execute the first executable file of the local shared library to obtain the first object corresponding to the default programming language call interface, wherein the executable file includes the first executable file, and the first executable file is used to obtain the object corresponding to the call interface; The first object is used to initialize the data link provided by the Hive database to obtain the target data link, wherein the target data link is used to provide the calling interface of the Hive database.

7. The method for acquiring Hive data according to claim 6, characterized in that, Execute the executable file to invoke the Hive database's API, including: Execute the second executable file of the local shared library to invoke the first object; If the first object is successfully invoked, the Hive database's calling interface is invoked using the target data link, wherein the executable file also includes the second executable file.

8. A device for acquiring Hive data, characterized in that, include: The building module is used to create custom components within the component library of the preset service framework, wherein the custom components are used to automatically call the executable files of the local shared library; The first acquisition module is used to respond to data call instructions and call the target component from the component library of the preset service framework. The target component is created using the target coding language and includes at least the custom components already created in the component library of the preset service framework. The second acquisition module is used to acquire the executable file that the target component needs to execute from the local shared library, wherein the local shared library supports multiple programming languages; The execution module is used to execute the executable file to call the Hive database API and obtain Hive data from the Hive database according to the API.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 7 through the computer program.