CN104346330A - Method and device for data initialization - Google Patents
Method and device for data initialization Download PDFInfo
- Publication number
- CN104346330A CN104346330A CN201310311344.XA CN201310311344A CN104346330A CN 104346330 A CN104346330 A CN 104346330A CN 201310311344 A CN201310311344 A CN 201310311344A CN 104346330 A CN104346330 A CN 104346330A
- Authority
- CN
- China
- Prior art keywords
- user
- record
- date
- predetermined information
- day
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2358—Change logging, detection, and notification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a method and a device for data initialization. The method includes that a date dimension table is generated according to preset beginning and ending dates; a temporary table with one record of each user each day is generated according to a user list with preset information and the date dimension table; an initialization table with one record of each user each day is generated according to the temporary table and the preset information, and as for each user, each record in the initialization table includes content items which are relevant to the preset information. By means of the technical scheme, when accumulative indexes are required to be statistically calculated, all preset parameters of each user in the initialization table can be subjected to accumulation processing respectively.
Description
Technical field
The application relates to microcomputer data processing field, particularly relates to a kind of method and device of data initialization.
Background technology
In field of computer data processing, for the process of mass data, conventional way carries out initialization to data.But, in mass data initialization, often need to add up cumulative type index during all kinds record of counting user, such as, record sum year-to-date, the beginning of the month so far record sum etc., data due to user are likely discontinuous, therefore, no matter are inquire about by date, or it is all pretty troublesome for inquiring about by user, thus is difficult to obtain these cumulative type data.Described data are discontinuous refers to that the object of statistics might not have the information content item record of certain type in every day, and data will be caused so discontinuous.Such as, add up the situation that certain website user logs in, and log in situation according to user user is marked, and the user of this website may can not log in every day, if the user added up did not log in the same day, according to existing common practices, cannot to the sum of login year-to-date of user, so far log in the indexs such as sum the beginning of the month to add up, again such as, the seller of certain shopping website has punishment record every day, if the same day does not punish record, algorithm traditionally, just cannot to the sum of punishment year-to-date of those sellers, the cumulative type indexs such as punishment so far at the beginning of the month is total are added up.
Summary of the invention
The fundamental purpose of the application is the method and the device that provide a kind of data initialization, and the discontinuous information data for user existed to solve prior art is difficult to add up the problem of cumulative type index, wherein:
According to an aspect of the application, provide a kind of method of data initialization, the method comprises: according to predetermined date of formation commencement date and deadline dimension table; According to having the user list of predetermined information and described date dimension table, generate the temporary table of a record each user's every day; According to described temporary table and described predetermined information, generate the initial table of a record each user's every day, wherein for each user, each record of described initial table comprises the content item relevant to described predetermined information.
According to the embodiment of the application, in the method, according to having the user list of predetermined information and described date dimension table, generate the temporary table of a record each user's every day, comprise: have the user list of predetermined information and described date dimension table to do cartesian product by described, to generate the temporary table of a record each user's every day.
According to the embodiment of the application, in the method, generate the initial table of a record each user's every day according to described temporary table and described predetermined information, comprising: the every preset parameter in described predetermined information is added in the record on relative users corresponding date in described temporary table; Do not have, in the record of corresponding predetermined information, described every preset parameter is set to zero in described temporary table.
According to the embodiment of the application, in the method, also comprise: carry out from target date to the current record date respectively to the every preset parameter in the record of each user every day in described initial table cumulative.
The another aspect of the application, provides a kind of device of data initialization, and this device comprises: date dimension table generation module, for showing according to predetermined date of formation commencement date and deadline dimension; Temporary table generation module, for according to having the user list of predetermined information and described date dimension table, generates the temporary table of a record each user's every day; Initial table generation module, for generating the initial table of a record each user's every day according to described temporary table and described predetermined information, wherein for each user, each record of described initial table comprises the content item relevant to described predetermined information.
According to the embodiment of the application, in the apparatus, described temporary table generation module is further used for: have the user list of predetermined information and described date dimension table to do cartesian product by described, to generate the temporary table of a record each user's every day.
According to the embodiment of the application, in the apparatus, described initial table generation module comprises further: first adds module, for being added to by the every preset parameter in described predetermined information in the record on relative users corresponding date in described temporary table; Second adds module, in the record of corresponding predetermined information, described every preset parameter is set to zero for not having in described temporary table.
According to the embodiment of the application, in the apparatus, also comprise: accumulator module, carry out from target date to the current record date respectively for the every preset parameter in the record to each user every day in described initial table cumulative.
Compared with prior art, according to the technical scheme of the application, according to the temporary table having the date dimension table of the list of the user of predetermined information and generation to generate a record each user's every day, and then generate the initial table of a record each user's every day, when needing to add up cumulative type index with box lunch, accumulation process can be carried out respectively to every preset parameter of each user in described initial table.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide further understanding of the present application, and form a application's part, the schematic description and description of the application, for explaining the application, does not form the improper restriction to the application.In the accompanying drawings:
Fig. 1 is the process flow diagram of the method for a kind of data initialization of the embodiment of the present application;
Fig. 2 is the particular flow sheet of the step S103 in Fig. 1 of the embodiment of the present application; And
Fig. 3 is the structured flowchart of the device of a kind of data initialization of the embodiment of the present application.
Embodiment
The main thought of the application is, process there being the date dimension table of the user list of predetermined information and generation, generate the temporary table of a record each user's every day, and then obtain the initial table of a record each user's every day, make eachly have the user of predetermined information to have continuous print record, so that every preset parameter of each user carries out accumulation process respectively in his-and-hers watches.
For making the object of the application, technical scheme and advantage clearly, below in conjunction with drawings and the specific embodiments, the application is described in further detail.
In the following description, quoting of " embodiment ", " embodiment ", " example ", " example " etc. is shown that the embodiment of so description or example can comprise special characteristic, structure, characteristic, character, element or limit, but not each embodiment or example must comprise special characteristic, structure, characteristic, character, element or limit.In addition, reuse phrase " in one embodiment " although be likely refer to identical embodiment, and not necessarily refers to identical embodiment.
According to the embodiment of the application, provide a kind of method of data initialization.It is the process flow diagram of the method for the data initialization of the embodiment of the present application with reference to figure 1, Fig. 1.
As shown in Figure 1, in step S101, according to predetermined date of formation commencement date and deadline dimension table.Wherein, described date dimension table is the date dimension table on continuous date.Wherein, refer to the predetermined Start Date and predetermined Close Date carrying out adding up described predetermined commencement date and deadline, such as want the data in statistics first arrival in 2013 on July 8th, 2013, predetermined Start Date and predetermined Close Date are on January 1st, 2013 and on July 8th, 2013 respectively.Date and time information in described date dimension table can comprise: date, this date are all information such as which sky, which sky of the moon, which sky in season, which sky in year, which week that this week is the moon can also be comprised, year which week, this month be which in year the moon, current season is date, end of the season date at the beginning of the season of which in year, current season in the season, the date at the end of month date at the beginning of the month of this month, the information such as date, weekend dates at the beginning of the week of this week.Such as, the date dimension table on January 1st, 2013, can be as shown in table 1:
Table 1
In step s 102, according to having the user list of predetermined information and described date dimension table, generate the temporary table of a record each user's every day.Wherein, described predetermined information, can comprise the information will carrying out the preset parameter processed, described preset parameter comprises: the parameter that at least one item that user predefined action occurs and produces is relevant.Such as, user's login times, user punish number of times, user's penalty score etc.The described user list having predetermined information, can for be recorded in described date dimension table commencement date and deadline in have the ID(account of the user of described predetermined information) list.
Further, can by having the list of the user of predetermined information and described date dimension table to do cartesian product to generate the temporary table of a record described each user's every day by described.Specifically, each user in the user list of predetermined information (ID of user) can be had to combine with each date in date dimension table by described, be configured with ordered pair, finally generate the temporary table of a record each user's every day.
Such as, be respectively on July 1st, 2013 and on July 3rd, 2013 predetermined commencement date and deadline, have the ID of the user of predetermined information to be respectively ID1, ID2, ID3, date dimension table can be as shown in table 2, eliminates other information except the date in table 2.
Table 2
Have the user list of predetermined information can be as shown in table 3:
Table 3
Table 2 and table 3 are done cartesian product and can obtain temporary table, as shown in table 4:
Table 4
In step s 103, according to described temporary table and described predetermined information, generate the initial table of a record each user's every day.Wherein, for each user, each record of described initial table comprises the content item relevant to described predetermined information, and described content item can comprise: the parameter that at least one item that user predefined action occurs and produces is relevant.
Step S103 specifically can as shown in Figure 2, and Fig. 2 is the particular flow sheet of step S103.
As shown in Figure 2, in step s 201, the every preset parameter in described predetermined information is added in the record on relative users corresponding date in described temporary table.Namely according to the corresponding user of described predetermined information and date, the every preset parameter in described predetermined information is added in the record on relative users corresponding date in described temporary table.Wherein, described every preset parameter can comprise: the parameter that at least one item that user predefined action occurs and produces is relevant, such as user due to disobey return a certain rule and bear punishment punishment number of times produced, penalty score, user account is stolen and the parameter such as the stolen number of times of account, stolen penalty score that produces.
Alternatively, user's predetermined information day summary sheet can be obtained from data warehouse, described user's predetermined information day summary sheet can comprise: within the commencement date and deadline of described date dimension table, has the date that the ID of the user of predetermined information, described predetermined information, described predetermined information produce.The described predetermined information of each user can be added in record corresponding in described temporary table according to described user's predetermined information day summary sheet, specifically, can according to the date of user ID and described predetermined information, the every preset parameter of relative users in the predetermined information on corresponding date is added to during described temporary table records accordingly.
In step S202, do not have, in the record of corresponding predetermined information, described every preset parameter is set to zero in described temporary table.
Because user may can not have described predetermined information every day, such as, user can not every day all in violation of rules and regulations, so this user also would not have the information about punishment number of times and penalty score every day.0 can be set to by not having in temporary table the every preset parameter in the record of corresponding predetermined information, no matter user has for any one day within the commencement date and deadline of date dimension table does not have described predetermined information, there is a record in capital in this sky, the initial table of a record each user's every day can be obtained like this, the data of adding up are just continuous, want if follow-up to carry out cumulative statistics (such as to every preset parameter on each user's date, adding up of every preset parameter year-to-date, adding up of every preset parameter so far at the beginning of the month), can directly use described initial table to add up to these parameters to obtain.
Such as, above-mentioned user is returned to be punished number of times and penalty score of pre-defined rule add up because disobeying, and the initial table that can obtain a record each user's every day is as shown in table 5:
Table 5
Alternatively, according to the embodiment of the application, the initial table of a record each user's every day can also be set as by described temporary table and described user's predetermined information day summary sheet being done left connection, specifically, can with described temporary table for benchmark, travel through the predetermined information that user ID and date in described user's predetermined information day summary sheet correspond, and the every preset parameter in described predetermined information is added in the record on relative users corresponding date in described temporary table, and unwritten, described every preset parameter is set to 0.
According to an embodiment of the application, can also comprise after step s 103: the cumulative step from target date to the current record date is carried out respectively to the every preset parameter in the record of each user every day in described initial table.
In above step S101-S103, obtain the initial table of a record each user's every day, the cumulative of target date to current record date can be carried out respectively to the every preset parameter in each record of described initial table.Specifically, can to the every preset parameter of described each user in the record of every day with before record in every preset parameter add up, obtain the cumulative data of the every preset parameter in every day of each user, such as, obtain each user every preset parameter year-to-date of every day accumulated value, the beginning of the month every preset parameter so far accumulated value etc.
The application can be applied in Distributed Computing Platform, initialization is carried out to needing the data of the record carrying out cumulative statistics, to realize follow-uply carrying out accumulation calculating to described data, obtain such as record sum year-to-date, the interim statistics of record sum so far etc. at the beginning of the month.The application can use structuralized query (SQL) statement to realize.
It should be noted that form listed in the embodiment of the application is used to provide further understanding of the present application, be not limited to the application.
The application also provides a kind of device of data initialization, with reference to figure 3, Fig. 3 is the structured flowchart of the device of a kind of data initialization that the embodiment of the present application relates to, as shown in Figure 3, this device 300 can comprise: date dimension table generation module 310, temporary table generation module 320 and initial table generation module 330.
Wherein, date dimension table generation module 310, may be used for according to predetermined date of formation commencement date and deadline dimension table;
Temporary table generation module 320, may be used for the temporary table according to having the user list of predetermined information and described date dimension table to generate a record described each user's every day.
Initial table generation module 330, may be used for the initial table generating a record each user's every day according to described temporary table and described predetermined information, wherein for each user, each record of described initial table comprises the content item relevant to described predetermined information.。
Described temporary table generation module 320 can also be used for: have the user list of predetermined information and described date dimension table to do cartesian product by described, to generate the initial table of a record each user's every day.
Described initial table generation module 330 may further include: first adds module, second adds module.
Described first adds module, may be used for the every preset parameter in described predetermined information to add in the record on relative users corresponding date in described temporary table;
Described second adds module, and may be used for does not have, in the record of corresponding predetermined information, described every preset parameter is set to zero in described temporary table.
Device 300 can also comprise: accumulator module 340, may be used for carrying out from target date to the current record date respectively to the every preset parameter in the record of each user every day in described initial table cumulative.
In one typically configuration, computing equipment comprises one or more processor (CPU), input/output interface, network interface and internal memory.
Internal memory may comprise the volatile memory in computer-readable medium, and the forms such as random access memory (RAM) and/or Nonvolatile memory, as ROM (read-only memory) (ROM) or flash memory (flash RAM).Internal memory is the example of computer-readable medium.
Computer-readable medium comprises permanent and impermanency, removable and non-removable media can be stored to realize information by any method or technology.Information can be computer-readable instruction, data structure, the module of program or other data.The example of the storage medium of computing machine comprises, but be not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic RAM (DRAM), the random access memory (RAM) of other types, ROM (read-only memory) (ROM), Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc ROM (read-only memory) (CD-ROM), digital versatile disc (DVD) or other optical memory, magnetic magnetic tape cassette, tape magnetic rigid disk stores or other magnetic storage apparatus or any other non-transmitting medium, can be used for storing the information can accessed by computing equipment.According to defining herein, computer-readable medium does not comprise non-temporary computer readable media (transitory media), as data-signal and the carrier wave of modulation.
Those skilled in the art should understand, the embodiment of the application can be provided as method, system or computer program.Therefore, the application can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the application can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) of computer usable program code.
The foregoing is only the embodiment of the application, be not limited to the application, for a person skilled in the art, the application can have various modifications and variations.Within all spirit in the application and principle, any amendment done, equivalent replacement, improvement etc., within the right that all should be included in the application.
Claims (8)
1. a method for data initialization, is characterized in that, comprising:
According to predetermined date of formation commencement date and deadline dimension table;
According to having the user list of predetermined information and described date dimension table, generate the temporary table of a record each user's every day;
According to described temporary table and described predetermined information, generate the initial table of a record each user's every day, wherein for each user, each record of described initial table comprises the content item relevant to described predetermined information.
2. method according to claim 1, is characterized in that, according to having the user list of predetermined information and described date dimension table, generating the temporary table of a record each user's every day, comprising:
The user list of predetermined information and described date dimension table is had to do cartesian product by described, to generate the temporary table of a record each user's every day.
3. method according to claim 1, is characterized in that, generates the initial table of a record each user's every day, comprising according to described temporary table and described predetermined information:
Every preset parameter in described predetermined information is added in the record on relative users corresponding date in described temporary table;
Do not have, in the record of corresponding predetermined information, described every preset parameter is set to zero in described temporary table.
4. method according to claim 1, is characterized in that, also comprises: carry out from target date to the current record date respectively to the every preset parameter in the record of each user every day in described initial table cumulative.
5. a device for data initialization, is characterized in that, comprising:
Date dimension table generation module, for showing according to predetermined date of formation commencement date and deadline dimension;
Temporary table generation module, for according to having the user list of predetermined information and described date dimension table, generates the temporary table of a record each user's every day;
Initial table generation module, for generating the initial table of a record each user's every day according to described temporary table and described predetermined information, wherein for each user, each record of described initial table comprises the content item relevant to described predetermined information.
6. device according to claim 5, is characterized in that, described temporary table generation module is further used for:
The user list of predetermined information and described date dimension table is had to do cartesian product by described, to generate the temporary table of a record each user's every day.
7. device according to claim 5, is characterized in that, described initial table generation module comprises further:
First adds module, for being added to by the every preset parameter in described predetermined information in the record on relative users corresponding date in described temporary table;
Second adds module, in the record of corresponding predetermined information, described every preset parameter is set to zero for not having in described temporary table.
8. device according to claim 5, is characterized in that, also comprises: accumulator module, carries out from target date to the current record date respectively cumulative for the every preset parameter in the record to each user every day in described initial table.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310311344.XA CN104346330B (en) | 2013-07-23 | 2013-07-23 | A kind of method and device of data initialization |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310311344.XA CN104346330B (en) | 2013-07-23 | 2013-07-23 | A kind of method and device of data initialization |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104346330A true CN104346330A (en) | 2015-02-11 |
CN104346330B CN104346330B (en) | 2018-02-02 |
Family
ID=52501962
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310311344.XA Active CN104346330B (en) | 2013-07-23 | 2013-07-23 | A kind of method and device of data initialization |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104346330B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003058554A (en) * | 2001-08-10 | 2003-02-28 | Shimizu Corp | Technical information storing and answering system |
CN101150822A (en) * | 2006-09-18 | 2008-03-26 | 上海欣泰通信技术有限公司 | A method for telecommunication operator to collect user numbers |
CN101923576A (en) * | 2010-08-31 | 2010-12-22 | 北京云快线软件服务有限公司 | System for dynamically querying bandwidth data |
JP2012014613A (en) * | 2010-07-05 | 2012-01-19 | Kadokawa Group Publishing Co Ltd | Terminal, information processing method, and program |
CN102609786A (en) * | 2012-01-18 | 2012-07-25 | 广州市动景计算机科技有限公司 | Method and device for forecasting whether user is off network |
CN103002329A (en) * | 2012-12-03 | 2013-03-27 | 合一网络技术(北京)有限公司 | Device and method for predicting reach-frequency table data of network video advertisements |
-
2013
- 2013-07-23 CN CN201310311344.XA patent/CN104346330B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003058554A (en) * | 2001-08-10 | 2003-02-28 | Shimizu Corp | Technical information storing and answering system |
CN101150822A (en) * | 2006-09-18 | 2008-03-26 | 上海欣泰通信技术有限公司 | A method for telecommunication operator to collect user numbers |
JP2012014613A (en) * | 2010-07-05 | 2012-01-19 | Kadokawa Group Publishing Co Ltd | Terminal, information processing method, and program |
CN101923576A (en) * | 2010-08-31 | 2010-12-22 | 北京云快线软件服务有限公司 | System for dynamically querying bandwidth data |
CN102609786A (en) * | 2012-01-18 | 2012-07-25 | 广州市动景计算机科技有限公司 | Method and device for forecasting whether user is off network |
CN103002329A (en) * | 2012-12-03 | 2013-03-27 | 合一网络技术(北京)有限公司 | Device and method for predicting reach-frequency table data of network video advertisements |
Also Published As
Publication number | Publication date |
---|---|
CN104346330B (en) | 2018-02-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106547784B (en) | Data splitting and storing method and device | |
CN106897340A (en) | A kind of data table updating method and device | |
CN108170656A (en) | Template establishment method, document creating method, rendering intent and device | |
CN105391594A (en) | Method and device for recognizing characteristic account number | |
CN114004694A (en) | Public opinion information-based enterprise risk early warning method, equipment and medium | |
CN109325055A (en) | The screening of business association tables of data and checking method, device, electronic equipment | |
CN108121712B (en) | Keyword storage method and device | |
CN111159192B (en) | Big data based data warehousing method and device, storage medium and processor | |
CN111046267A (en) | Method, device and medium for processing network rumors based on block chains | |
CN111177093A (en) | Method, device and medium for sharing scientific and technological resources | |
CN104346330A (en) | Method and device for data initialization | |
CN111143546A (en) | Method and device for obtaining recommendation language and electronic equipment | |
CN106202049A (en) | A kind of hot word determines method and device | |
CN109598478A (en) | A kind of wind survey result describes generation method, device and the electronic equipment of official documents and correspondence | |
Balachandran et al. | An operator theory of parametric programming for the generalized transportation problem‐III‐weight operators | |
CN108171559B (en) | User level processing and target object pushing method and device | |
CN110968580A (en) | Method and device for creating data storage structure | |
CN114862326A (en) | Implementation method, device and medium for inventory account book | |
CN106874327B (en) | Counting method and device for business data | |
CN114138787A (en) | Bar code identification method, equipment and medium | |
CN111881091B (en) | Data storage method, device, electronic equipment and storage medium | |
CN110766546A (en) | Bank account management method | |
CN106844038B (en) | Method and device for determining resource use authority and resource provision | |
CN108572998A (en) | A kind of data search method and device for electronic card data | |
CN111444195B (en) | Method, device and equipment for clearing indexes in block chain type account book |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20191209 Address after: P.O. Box 31119, grand exhibition hall, hibiscus street, 802 West Bay Road, Grand Cayman, Cayman Islands Patentee after: Innovative advanced technology Co., Ltd Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands Patentee before: Alibaba Group Holding Co., Ltd. |