CN117312385A - Vehicle data query method, query device, electronic equipment and storage medium - Google Patents

Vehicle data query method, query device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117312385A
CN117312385A CN202311282525.4A CN202311282525A CN117312385A CN 117312385 A CN117312385 A CN 117312385A CN 202311282525 A CN202311282525 A CN 202311282525A CN 117312385 A CN117312385 A CN 117312385A
Authority
CN
China
Prior art keywords
vehicle data
data
hbase
vehicle
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311282525.4A
Other languages
Chinese (zh)
Inventor
崔海同
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hozon New Energy Automobile Co Ltd
Original Assignee
Hozon New Energy Automobile Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hozon New Energy Automobile Co Ltd filed Critical Hozon New Energy Automobile Co Ltd
Priority to CN202311282525.4A priority Critical patent/CN117312385A/en
Publication of CN117312385A publication Critical patent/CN117312385A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a vehicle data query method, a query device, electronic equipment and a storage medium. The data query method comprises the following steps: constructing a Jar package for inquiring HBase; invoking the Jar package based on node. Js under the condition that the screening condition is correct, so as to obtain the total number of data meeting the screening condition in the HBase; acquiring vehicle data meeting the screening conditions in the HBase by adopting thread; and carrying out data processing on the vehicle data, and assembling the processed vehicle data and the total data to obtain a vehicle data query result aiming at the HBase. The method not only can be used for inquiring the high-performance vehicle data of the HBase in the node. Js environment, but also can be used for better controlling the flow and the result of paging inquiry, realizing the efficient processing of large-scale complex vehicle data and ensuring the integrity and the accuracy of the vehicle data.

Description

Vehicle data query method, query device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of automotive information technologies, and in particular, to a vehicle data query method, a query device, an electronic device, and a storage medium.
Background
In the digital informatization age, technologies such as the internet and cloud computing are rapidly developed. The new energy automobile industry faces challenges and opportunities in processing, querying, displaying, etc., large amounts of data. Such as vehicle generated travel records, charge records, user feedback records, etc., that scale exponentially with vehicle usage. Since these data cover a variety of sources, a variety of data types, and a variety of formats of data, efficient data processing and conversion for different complex types of data is currently not possible. Therefore, how to efficiently query and filter out data outside the scope of conditions for comparison, analysis, and processing to obtain effective and valuable information is a current need to be addressed.
Disclosure of Invention
The object of the present invention is to solve at least to some extent one of the above-mentioned technical problems.
Therefore, a first object of the present invention is to provide a method for implementing high-performance query and screening of large-scale vehicle data based on node. Js combined with thread to perform data paging query on HBase, so as to ensure the integrity and accuracy of vehicle data.
To achieve the above object, an embodiment of a first aspect of the present invention provides a vehicle data query method, including: constructing a Jar (Java archive) package for querying an HBase (Hadoop Database); invoking the Jar package based on node. Js under the condition that the screening condition is correct, so as to obtain the total number of data meeting the screening condition in the HBase; acquiring vehicle data meeting the screening conditions in the HBase by adopting thread; and carrying out data processing on the vehicle data, and assembling the processed vehicle data and the total data to obtain a vehicle data query result aiming at the HBase.
According to the vehicle data query method provided by the embodiment of the invention, the Jar package is constructed, the Jar package is called based on node. Js to obtain the total data, meanwhile, the vehicle data of the HBase is scanned by adopting thread, and finally, the scanned data is converted.
According to one embodiment of the present invention, the constructing a Jar package for querying HBase includes: creating Java codes for the node. Js to call; and calling a Java coprocessor by adopting JNI (Java Native Interface, java local interface), and packaging the Java codes to construct the Jar packet.
According to an embodiment of the present invention, the node. Js-based invoking the Jar packet when the filtering condition is correct to obtain the total number of data meeting the filtering condition includes: based on the node. Js, connecting the HBase through an API interface; judging whether the query parameters for the HBase are correct or not so as to determine screening conditions for vehicle data in the HBase; and under the condition that the query parameters are correct, invoking the constructed Jar packet by adopting the node.Java module of the node.Js to acquire the total number of data conforming to the screening condition, otherwise, returning a parameter error prompt.
According to one embodiment of the present invention, the acquiring, by thread, vehicle data satisfying the screening condition in the HBase includes: and adopting an integrated thread-Js library and using a getscannerrrESults method, and sending a data scanning request to the HBase based on the screening condition so as to acquire returned vehicle data from the HBase.
According to an embodiment of the present invention, the data processing of the vehicle data includes: analyzing the vehicle data to obtain the data type corresponding to the vehicle data; and converting the vehicle data based on a data reporting protocol according to the data type of the vehicle data.
According to one embodiment of the present invention, the converting the vehicle data based on the data reporting protocol includes: determining a specified format for reporting the vehicle data according to the data reporting protocol; and based on the specified format of the vehicle data, under the condition that the source value of the vehicle data is not empty, according to the type of the vehicle data, carrying out operation calculation on the source value of the vehicle data and corresponding preset characters so as to take the obtained calculation result as a target value of the vehicle data to be reported.
According to an embodiment of the present invention, the vehicle data query method further includes: the data query method further comprises the following steps: and when the metadata of the vehicle data has the object attribute, adjusting the calculation result according to the object attribute, and taking the adjusted calculation result as a target value of the vehicle data to be reported.
To achieve the above object, a second aspect of the present invention provides a vehicle data query device, including: the construction unit is used for constructing a Jar packet for inquiring the HBase; a calling unit, configured to call the Jar packet based on node. Js when the screening condition is correct, so as to obtain the total number of data in the HBase that meets the screening condition; an acquiring unit, configured to acquire vehicle data meeting the screening condition in the HBase by using thread; and the processing unit is used for carrying out data processing on the vehicle data, and assembling the processed vehicle data and the total data to obtain a vehicle data query result aiming at the HBase.
To achieve the above object, an embodiment of a third aspect of the present invention provides an electronic device, including: the vehicle data query method comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the vehicle data query method according to the embodiment of the first aspect of the invention when executing the computer program.
To achieve the above object, a fourth embodiment of the present invention provides a computer readable storage medium, where the computer program when executed by a processor implements the vehicle data query method according to the first embodiment of the present invention.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a flowchart illustrating a method of vehicle data query, according to an exemplary embodiment;
FIG. 2 is a flowchart illustrating a method of constructing a Jar package, in accordance with an exemplary embodiment;
FIG. 3 is a flowchart illustrating a method of querying a total number of data, according to an example embodiment;
FIG. 4 is a flowchart illustrating a method of data processing vehicle data, according to an exemplary embodiment;
FIG. 5 is a flowchart illustrating a method of data converting vehicle data, according to an exemplary embodiment;
FIG. 6 is a schematic block diagram of a vehicle data query device, according to an exemplary embodiment; and
fig. 7 is a schematic diagram of an electronic device according to an exemplary embodiment.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative and intended to explain the present invention and should not be construed as limiting the invention.
Therefore, the invention provides a data query method, a query device, electronic equipment and a storage medium.
Specifically, a data query method, a data query device, an electronic device and a storage medium according to embodiments of the present invention are described below with reference to the accompanying drawings.
FIG. 1 is a flowchart illustrating a method of vehicle data query, according to an exemplary embodiment. It should be noted that, the vehicle data query method according to the embodiment of the present invention may be applied to the vehicle data query device according to the embodiment of the present invention, and the vehicle data query device may be configured on an electronic device or may be configured in a server. The electronic device may be a PC or a mobile terminal. The embodiments of the present invention are not so limited.
As shown in fig. 1, the vehicle data query method includes:
step S110, constructing a Jar package for querying the HBase.
For example, jar packages, also known as Java archive (Java archive), are commonly used to aggregate a large number of Java class files, related metadata, and resource files into one file in order to develop Java platform applications or libraries. The embodiment of the invention is based on node.js calling Hbase paging query, and because node.js is not provided with a tool special for querying the Hbase, the vehicle data query method of the embodiment of the invention needs to construct a Jar packet for node.js calling, and solves the problem of total data required by the HBase paging query by loading and using the Jar packet through the node.js.
In the embodiment of the present invention, the specific implementation process of constructing the Jar package may refer to the subsequent implementation manner, and will not be described in detail herein.
Step S120, calling the Jar package based on node. Js under the condition that the screening condition is correct, so as to obtain the total number of data meeting the screening condition in the HBase.
For example, when responding to a data query request, node. Js needs to access the HBase, and needs to determine whether the screening condition for the vehicle data in the HBase is correct, and if the screening condition is correct, call the Jar packet to obtain the total number of data.
In the embodiment of the present invention, the specific implementation process of invoking the Jar packet may refer to the subsequent implementation manner, and will not be described in detail herein.
And step S130, acquiring vehicle data meeting the screening conditions in the HBase by adopting thread.
For example, for the data access query of HBase, since HBase is written in Java language, which itself provides Java interface natively, there is a certain difficulty for the data access query of HBase for cross-language call, especially for collaboration between different languages, which results in slower data access query. Thus, embodiments of the present invention employ thread technology, which is a software framework for the development of extensible and cross-language services. Thread may support languages including c++, java, python, PHP, and the like. That is, thread realizes the C/S mode, and the interface definition file is generated into the server side and client side codes through the code generation tool, thereby realizing the cross-language support of the server side and the client side. For example, the client is implemented in Python and the server is implemented in Java. The user declares own service in the Thirft description file, the service generates a code file of a corresponding language after compiling, and then the user realizes the service.
The specific implementation process of querying HBase based on thread in the embodiment of the present invention may refer to the subsequent implementation manner, and will not be described in detail herein.
And step S140, carrying out data processing on the vehicle data, and assembling the processed vehicle data and the total data to obtain a data query result aiming at the HBase.
For example, after screening the vehicle data, the vehicle data is data of various data sources, so that the vehicle data needs to be processed into a unified readable format for subsequent display and analysis. In addition, because the invention needs to assemble the HBase query data and call the Jar package at the same time, the data query and the data total query need to be carried out at the same time, and the two do not have the relation of executing before and after.
In the embodiment of the present invention, reference may be made to the following embodiments for the processing procedure of the vehicle data, and redundant description is omitted here.
Therefore, according to the vehicle data query method provided by the invention, on one hand, the Jar package is constructed to realize the query of the total number of vehicle data and data in the node. Js environment, so that the flow and the result of paging query are better controlled; on the other hand, by adopting the thread technology, cross-language calling is realized, and especially, complex large-scale vehicle data can be rapidly and accurately processed, so that the data access capability is improved.
The above steps are described in further detail below with reference to the accompanying drawings.
In a preferred embodiment, as shown in fig. 2, the constructing the Jar package for querying HBase includes:
step S210, creating Java code for node. Js to call.
And step S220, calling a Java coprocessor by using the JNI, and packaging the Java codes to construct the Jar packet.
For example, JNI, also known as Java native interface, is commonly written using Java native interface to facilitate code migration across different platforms. The embodiment of the invention adopts the JNI technology, can better call Java codes in node.js, so as to pack the Java codes through a Java coprocessor to construct the Jar packet which can be called by the node.js, and is convenient for loading and calling the Jar packet through the node.js.
Therefore, in the embodiment of the invention, the Jar packet is constructed by calling the Java coprocessor for subsequent node. Js call, so that the high-performance vehicle data query under the node. Js environment can be realized.
In a preferred embodiment, as shown in fig. 3, the node. Js-based call the Jar packet when the filtering condition is correct, so as to obtain the total number of data meeting the filtering condition, including:
Step S310, based on the node. Js and through an API interface, connecting the HBase.
For example, an API interface, also known as an application program interface, is a predefined function that is intended to provide applications and developers with the ability to access routines based on software or hardware. Therefore, in the embodiment of the present invention, when responding to the data query request, node. Js needs to connect to the HBase through the API interface to open access to the HBase.
Step S320, judging whether the query parameters for the HBase are correct or not to determine screening conditions for data in the HBase.
For example, after connecting to the HBase, in order to be able to perform a paging query on the HBase, it is necessary to determine the screening condition of the vehicle data for the HBase by determining the query parameters. Specifically, when the query parameter to the HBase is judged to be correct, the screening condition for the vehicle data in the HBase is determined based on the query parameter. And when judging that the query parameters are wrong, returning an error prompt to prompt that the vehicle data query fails.
Step S330, under the condition that the query parameters are correct, the node.Java module of the node.Js is adopted to call the constructed Jar package so as to obtain the total number of data meeting the screening condition.
For example, when the HBase paging query function is invoked to query a large amount of data, since node.js is not provided with a tool specially used for query, after the query parameters are determined to be correct in the above steps, the node.java module of node.js needs to invoke the Jar packet built in the Java coprocessor to obtain the total number of data meeting the screening condition.
In the following, a specific example will be described of how the total number of data is obtained based on node. Js invoking jar packets.
Node-Java is a Node module that allows Node programs to invoke Java classes. Since JNI is an API that allows C and c++ programs and Java programs to call each other, the Node-Java module uses JNI to connect the Node programs and Java programs. By using the module, not only Java objects can be created, but also Java methods can be called.
The method comprises the following specific steps:
first, path and Java modules are introduced to handle file paths and use Node-Java modules to interact with Java code.
Next, an auxiliary function resolvePath is defined for resolving the file path.
Again, a function called getRowCount is defined, the purpose of which is to obtain a qualified row count in the Hbase table. The yin, startTime, endTime, tableName, server parameters are received (tableName, server has predefined default values) and the result of a function process is returned.
Specifically, in the function processing, first, a try block adds a path of a Java jar file to a Java class through Java. Import. Push (), and creates two Java Long objects to represent a start time and an end time using a Java. Newlnstancesync () method. And then, calling an HBaseCont.count method, wherein the method can realize inquiry and calculate the number of rows meeting the conditions in the HBase table through interaction with Java codes, namely inquiring the total number of data meeting the screening conditions in the HBase.
If the function processing result has errors, the errors are transferred to the refusing part of Promise through a reject () method, and the data row count meeting the conditions is transferred to Promise through a reject () method.
Finally, the getlowcount function is taken as the export of the module, so that other modules can conveniently import and use the function.
Description of Java code referring to coprocessor:
first, the required package and class com.azonato.pivot.uteis.hbase.hbasedaohitls and org.appche, hadoop.habse.scan are imported.
Secondly, in the Hbasecount class, a static method named count is defined for calculating a qualified row count in the HBase table.
Inside the count method, an instance of HbaseDaoUtils is obtained by calling the HbaseDaoUtils. GetInstance () method for interacting with Hbase. The method can receive Hbase server address, user name and password as parameters. A Scan object is created using hbasedaoutils. The calculation of the Hbase table is performed using the HbaseDaoUtils.count () method, which receives the table name and the Scan object as parameters and returns the number of rows that meet the conditions. And finally, returning the result to the calling party.
Through the above example, it can be seen that the total number of data meeting the screening condition can be effectively obtained through the interaction between the Node program and the Java program.
In a preferred embodiment, the acquiring, by thread, the vehicle data satisfying the screening condition in the HBase includes:
and adopting an integrated thread-Js library and using a getscannerrrESults method, and sending a data scanning request to the HBase based on the screening condition so as to acquire returned vehicle data from the HBase.
For example, in the embodiment of the present invention, the getscannerrs method is used to scan and query the vehicle data in the HBase, and the returned data is the vehicle data satisfying the screening condition. Taking the inquiry of the historical data of the vehicle as an example, the returned vehicle data meeting the screening conditions in different formats, such as the vehicle driving data, the charging data or the user feedback data, and the like, can be obtained through scanning inquiry. The data come from different modules of the vehicle, so that the data of different formats need to be processed into a uniform readable format for facilitating subsequent analysis and presentation, see in particular the description below.
In a preferred embodiment, as shown in fig. 4, the data processing of the vehicle data includes:
Step S410, analyzing the vehicle data according to a data reporting protocol, and obtaining the data type corresponding to the vehicle data.
For example, as described above, the embodiments of the present invention are directed to data of multiple data sources, and thus, for HBase queries, vehicle data of different data types may be obtained. For example, in the case of vehicle history data query, different kinds of data such as vehicle running data, charging record data, user feedback data, etc. are queried, and the data types and formats are different. Therefore, after the vehicle data meeting the screening conditions are obtained, the vehicle data needs to be analyzed firstly to determine the type of the vehicle data, and then the vehicle data can be converted in a targeted manner.
Step S420, converting the vehicle data based on a data reporting protocol according to the data type of the vehicle data.
For example, the data reporting protocol defines the data format to be reported. Therefore, the embodiment of the invention needs to convert the vehicle data according to the data format defined by the data reporting protocol so as to uniformly process the vehicle data to be reported.
Therefore, in the embodiment of the invention, the vehicle data can be in a unified format by adopting analysis and conversion processing on the vehicle data, so that the subsequent data analysis and display are convenient.
In a preferred embodiment, as shown in fig. 5, the converting the vehicle data based on the data reporting protocol includes:
step S510, determining a prescribed format for reporting the vehicle data according to the data reporting protocol.
Step S520, based on the prescribed format of the vehicle data, in the case that the source value of the vehicle data is not null, performing operation calculation on the source value of the vehicle data and the corresponding preset character according to the type of the vehicle data, so as to take the obtained calculation result as the target value of the vehicle data to be reported.
For example, the data reporting protocol defines a prescribed format for vehicle data, such as vehicle data that needs to be returned in hexadecimal form, and so forth. After determining the prescribed format, the vehicle data needs to be formatted accordingly. Wherein the type (type) of data defines the type of value, and thus it determines the way in which the source value of the vehicle data is converted and ensures that the source value is within range. The embodiment of the invention firstly judges whether the source value is empty, and performs conversion operation on the vehicle data under the condition that the source value is not empty, and returns a default value corresponding to the corresponding data type under the condition that the source value is empty. Hereinafter, the types of vehicle data are respectively described as byte, short, and integer.
a) When the type (type) is byte, the source value (sourceValue) of the vehicle data is bitwise and operation calculated with 0xff, and the obtained calculation result is returned as the target value (targetValue) of the vehicle data. If the source value (sourceValue) is null (null), a preset byte default value is returned.
b) When the type (type) is short, the source value (sourceValue) and Oxffff of the vehicle data are bitwise and operated, and the obtained calculation result is returned as the target value (targetValue) of the vehicle data. If the source value (sourceValue) is null (null), a preset short integer default value is returned.
c) When the type (type) is integer, the source value (sourceValue) and Oxffffffff of the vehicle data are bitwise and operated, and the obtained calculation result is returned as the target value (targetValue) of the vehicle data. If the source value (sourceValue) is null (null), a preset integer default value is returned.
Taking vehicle historical data as an example, the type codes corresponding to different modules of the vehicle are distinguished in the data reporting protocol, so that whether the data of the modules need to be converted or not can be determined through the data reporting protocol.
Take data 05 00 07 2E F4 7F 01 D3 01 C2 as an example:
05: the vehicle position data module is represented in the data reporting protocol.
00: hexadecimal through decimal representation 0 represents the effective location, north latitude, east longitude.
07 2e F4 f 7f: longitude. The WGS84 coordinate system 16 is converted to decimal 120517759 divided by 1000000 to 120.517759 in degrees.
01 D3 01 C2: latitude. The WGS84 coordinate system 16 is converted to decimal 30605762 divided by 1000000 to 30.605762 in degrees.
It can be seen that the above processing method is to convert hexadecimal into decimal format, convert longitude and latitude representing vehicle position, and then return to the final target value after conversion.
It should be noted that, the embodiment of the present invention is not limited to the above manner for processing vehicle data, and those skilled in the art may adopt different processing manners according to actual application needs, which is not limited herein.
Therefore, in the embodiment of the invention, the source value of the vehicle data and different preset characters are operated and calculated based on the type of the vehicle data, so that the final target value is obtained, and the format unification processing is effectively carried out on the vehicle data.
In a more preferred embodiment, the vehicle data query method further includes: and when the metadata of the vehicle data has the object attribute, adjusting the calculation result according to the object attribute, and taking the adjusted calculation result as a target value of the vehicle data to be reported.
For example, in order to ensure accuracy of the finally reported vehicle data, the embodiment of the present invention may further adjust the calculated target value according to the object attribute by determining whether the metadata has the object attribute. Specifically, the adjustment process will be described in detail taking three attributes of metadata having minUnit, offset, scale as an example.
a) If the metadata has the object attribute of minUnit, multiplying the calculated target value (targetValue) by metaData.
b) If the metadata has an object attribute of offset, the calculated target value (targetValue) is added to metadata.
c) If the metadata has the object attribute of scale, rounding the calculated target value (targetValue) to a specified decimal place, and taking the rounded result as a final reported target value.
And combining and sorting the final returned target value and the total data meeting the screening condition to obtain the final returned query result.
It should be noted that the foregoing is only a preferred manner, and different adjustment manners may be flexibly adopted in the art according to actual application requirements to improve accuracy of the target value, which is not limited herein.
In summary, the vehicle data query method provided by the embodiment of the invention has the following advantages:
1) The Jar package is constructed for node.js call, so that the high-performance vehicle data query under the node.js environment is realized, the total data required by the paging query is effectively obtained, and the flow and the result of the paging query are better controlled;
2) By adopting the thread technology, cross-language calling is realized, mutual collaboration among different languages is facilitated, complex vehicle data can be efficiently processed, and data access capacity is improved;
3) The method can deal with the inquiry and screening of large-scale vehicle data and ensure the integrity and accuracy of the vehicle data.
Based on the same inventive concept as the vehicle data query method described above, an embodiment of the present invention provides a vehicle data query device, as shown in fig. 6, the vehicle data query device 600 includes: a construction unit 610, configured to construct a Jar packet for querying HBase; a calling unit 620, configured to call the Jar packet based on node. Js when the screening condition is correct, so as to obtain the total number of data in the HBase that meets the screening condition; an acquiring unit 630, configured to acquire vehicle data meeting the screening condition in the HBase by using thread; and the processing unit 640 is configured to perform data processing on the vehicle data, and assemble the processed vehicle data and the total data to obtain a vehicle data query result for the HBase.
Therefore, the data query device provided by the embodiment of the invention can better control the flow and result of paging query by constructing the Jar packet to realize the query on the total number of vehicle data and data in the node. Js environment; on the other hand, by adopting the thread technology, cross-language calling is realized, and especially, complex large-scale vehicle data can be rapidly and accurately processed, so that the data access capability is improved.
In a preferred embodiment, the construction module 610 is configured to construct the Jar package for querying HBase in the following manner: creating Java codes for the node. Js to call; and calling a Java coprocessor by using the JNI, and packaging the Java codes to construct the Jar packet.
In a preferred embodiment, the invoking module 620 is configured to invoke the Jar packet based on node. Js when the filtering condition is correct, so as to obtain the total number of data that meets the filtering condition in the following manner: based on the node. Js, connecting the HBase through an API interface; judging whether the query parameters aiming at the HBase are correct or not so as to determine screening conditions for data in the HBase; and under the condition that the query parameters are correct, invoking the constructed Jar package by adopting the node.Java module of the node.Js to obtain the total number of data conforming to the screening condition.
In a preferred embodiment, the obtaining unit 630 is configured to obtain, by thread, vehicle data in the HBase that satisfies the screening condition in the following manner: and adopting an integrated thread-Js library and using a getscannerrrESults method, and sending a data scanning request to the HBase based on the screening condition so as to acquire returned vehicle data from the HBase.
In a preferred embodiment, the processing unit 640 is configured to perform data processing on the vehicle data in the following manner, including: analyzing the vehicle data according to a data reporting protocol, and obtaining a data type corresponding to the vehicle data; and converting the vehicle data according to the data type of the vehicle data.
In a more preferred embodiment, the processing unit 630 is configured to convert the vehicle data based on a data reporting protocol in the following manner: determining a specified format for reporting the vehicle data according to the data reporting protocol; and based on the specified format of the vehicle data, under the condition that the source value of the vehicle data is not empty, according to the type of the vehicle data, carrying out operation calculation on the source value of the vehicle data and corresponding preset characters so as to take the obtained calculation result as a target value of the vehicle data to be reported.
In a more preferred embodiment, the processing unit 640 is further configured to, in a case where the metadata of the vehicle data has an object attribute, adjust the calculation result according to the object attribute, and use the adjusted calculation result as the target value of the vehicle data to be reported.
Accordingly, an embodiment of the present invention also provides an electronic device, as shown in fig. 7, which illustrates a schematic structure of an electronic device 700 suitable for implementing the embodiment of the present invention. The electronic device in the embodiment of the present invention may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a car-mounted terminal (e.g., car navigation terminal), etc., and a stationary terminal such as a digital TV, a desktop computer, etc. The electronic device shown in fig. 7 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments of the invention.
As shown in fig. 7, the electronic device 700 may include a processing means (e.g., a central processor, a graphics processor, etc.) 701, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage means 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other through the bus 504. An input/output (I/O) interface 705 is also connected to bus 704.
In general, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device 500 to communicate wirelessly or by wire with other devices to exchange data. While fig. 5 shows an electronic device 700 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present invention, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present invention provide a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 709, or installed from storage 708, or installed from ROM 702. When being executed by the processing means 701, performs the above-described functions defined in the method of the embodiment of the present invention.
The computer readable medium of the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers 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"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: constructing a Jar package for inquiring HBase; invoking the Jar package based on node. Js under the condition that the screening condition is correct, so as to obtain the total number of data meeting the screening condition in the HBase; acquiring vehicle data meeting the screening conditions in the HBase by adopting thread; and carrying out data processing on the vehicle data, and assembling the processed vehicle data and the total data to obtain a vehicle data query result aiming at the HBase.
Alternatively, the computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: constructing a Jar package for inquiring HBase; invoking the Jar package based on node. Js under the condition that the screening condition is correct, so as to obtain the total number of data meeting the screening condition in the HBase; acquiring vehicle data meeting the screening conditions in the HBase by adopting thread; and carrying out data processing on the vehicle data, and assembling the processed vehicle data and the total data to obtain a vehicle data query result aiming at the HBase.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of remote computers, the remote computer may be connected to the user computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (e.g., connected through the internet using an internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present invention may be implemented in software or in hardware. The name of the unit does not in any way constitute a limitation of the unit itself, for example the first acquisition unit may also be described as "unit acquiring at least two internet protocol addresses".
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: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of the present invention, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The above description is only illustrative of the preferred embodiments of the present invention and of the principles of the technology employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in the present invention is not limited to the specific combinations of technical features described above, but also covers other technical features formed by any combination of the technical features described above or their equivalents without departing from the spirit of the disclosure. Such as the above-mentioned features and the technical features disclosed in the present invention (but not limited to) having similar functions are replaced with each other.
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the invention. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (10)

1. A vehicle data query method, characterized in that the data query method comprises:
constructing a Jar package for inquiring HBase;
invoking the Jar package based on node. Js under the condition that the screening condition is correct, so as to obtain the total number of data meeting the screening condition in the HBase;
acquiring vehicle data meeting the screening conditions in the HBase by adopting thread;
and carrying out data processing on the vehicle data, and assembling the processed vehicle data and the total data to obtain a vehicle data query result aiming at the HBase.
2. The vehicle data query method according to claim 1, wherein said constructing a Jar packet for querying HBase comprises:
creating Java codes for the node. Js to call;
and calling a Java coprocessor by using the JNI, and packaging the Java codes to construct the Jar packet.
3. The vehicle data query method according to claim 1, wherein the node. Js-based invoking the Jar packet if the filtering condition is correct to obtain the total number of data meeting the filtering condition includes:
based on the node. Js, connecting the HBase through an API interface;
judging whether the query parameters for the HBase are correct or not so as to determine screening conditions for vehicle data in the HBase; and
and under the condition that the query parameters are correct, invoking the constructed Jar package by adopting the node.Java module of the node.Js to obtain the total number of data meeting the screening condition.
4. The vehicle data query method according to claim 1, wherein the acquiring the vehicle data satisfying the screening condition in the HBase by thread includes:
and adopting an integrated thread-Js library and using a getscannerrrESults method, and sending a data scanning request to the HBase based on the screening condition so as to acquire returned vehicle data from the HBase.
5. The vehicle data query method of claim 1, wherein the data processing of the vehicle data comprises:
analyzing the vehicle data to obtain the data type corresponding to the vehicle data; and
And converting the vehicle data based on a data reporting protocol according to the data type of the vehicle data.
6. The vehicle data query method of claim 5, wherein converting the vehicle data based on a data reporting protocol comprises:
determining a specified format for reporting the vehicle data according to the data reporting protocol; and
and based on the specified format of the vehicle data, under the condition that the source value of the vehicle data is not empty, according to the type of the vehicle data, carrying out operation calculation on the source value of the vehicle data and corresponding preset characters, and taking the obtained calculation result as a target value of the vehicle data to be reported.
7. The vehicle data query method according to claim 6, characterized in that the vehicle data query method further comprises:
and when the metadata of the vehicle data has the object attribute, adjusting the calculation result according to the object attribute, and taking the adjusted calculation result as a target value of the vehicle data to be reported.
8. A vehicle data query device, characterized in that the vehicle data query device includes:
The construction unit is used for constructing a Jar packet for inquiring the HBase;
a calling unit, configured to call the Jar packet based on node. Js when the screening condition is correct, so as to obtain the total number of data in the HBase that meets the screening condition;
an acquiring unit, configured to acquire vehicle data meeting the screening condition in the HBase by using thread;
and the processing unit is used for carrying out data processing on the vehicle data, and assembling the processed vehicle data and the total data to obtain a vehicle data query result aiming at the HBase.
9. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the vehicle data query method of any one of claims 1-7.
10. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the vehicle data query method of any one of claims 1-7.
CN202311282525.4A 2023-09-28 2023-09-28 Vehicle data query method, query device, electronic equipment and storage medium Pending CN117312385A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311282525.4A CN117312385A (en) 2023-09-28 2023-09-28 Vehicle data query method, query device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311282525.4A CN117312385A (en) 2023-09-28 2023-09-28 Vehicle data query method, query device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117312385A true CN117312385A (en) 2023-12-29

Family

ID=89242175

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311282525.4A Pending CN117312385A (en) 2023-09-28 2023-09-28 Vehicle data query method, query device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117312385A (en)

Similar Documents

Publication Publication Date Title
CN111475298B (en) Task processing method, device, equipment and storage medium
CN111291103B (en) Interface data analysis method and device, electronic equipment and storage medium
CN111581563B (en) Page response method and device, storage medium and electronic equipment
CN111930534A (en) Data calling method and device and electronic equipment
CN110378743B (en) Application invitation method, terminal device, server and medium
CN111324342B (en) Method, device, medium and electronic equipment for generating interface layer code
CN109726217B (en) Database operation method, device, equipment and storage medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN113391860B (en) Service request processing method and device, electronic equipment and computer storage medium
CN113220281A (en) Information generation method and device, terminal equipment and storage medium
CN111752644A (en) Interface simulation method, device, equipment and storage medium
WO2023056841A1 (en) Data service method and apparatus, and related product
CN117312385A (en) Vehicle data query method, query device, electronic equipment and storage medium
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN114780263A (en) Service calling method, device, equipment and storage medium
CN109669720B (en) Chain type asynchronous request processing method and device based on Promise and electronic equipment
CN111309323B (en) Parameter initialization method and device and electronic equipment
CN114047922B (en) Transcoding method, device, medium and equipment for precompiled device
CN111796865A (en) Byte code file modification method and device, terminal equipment and medium
CN112445517B (en) Inlet file generation method, device, electronic equipment and computer readable medium
CN110099122B (en) Method and apparatus for sending network request
CN116737122A (en) Processing method, processing device, terminal equipment and medium
CN115705193A (en) Distributed compiling method, device, equipment and medium
CN116562248A (en) Form processing method, apparatus, device, storage medium, and program product
CN117806739A (en) Method, device, medium and equipment for determining calling relation of cross-code warehouse

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination