CN101908045A - Data processing method - Google Patents

Data processing method Download PDF

Info

Publication number
CN101908045A
CN101908045A CN2009100859565A CN200910085956A CN101908045A CN 101908045 A CN101908045 A CN 101908045A CN 2009100859565 A CN2009100859565 A CN 2009100859565A CN 200910085956 A CN200910085956 A CN 200910085956A CN 101908045 A CN101908045 A CN 101908045A
Authority
CN
China
Prior art keywords
record
arrangement
data
processing method
data processing
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
CN2009100859565A
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.)
BEIJING RUNQIAN INFORMATION SYSTEM TECHNOLOGY Co Ltd
Original Assignee
BEIJING RUNQIAN INFORMATION SYSTEM TECHNOLOGY 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 BEIJING RUNQIAN INFORMATION SYSTEM TECHNOLOGY Co Ltd filed Critical BEIJING RUNQIAN INFORMATION SYSTEM TECHNOLOGY Co Ltd
Priority to CN2009100859565A priority Critical patent/CN101908045A/en
Publication of CN101908045A publication Critical patent/CN101908045A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a data processing method, belonging to the technical field of computer information processing. The most frequently used traditional technology is the query and access language SQL (Structured Query Language) technology based on a relational data base; however, because the data structure of the query and access language SQL technology is limited by the characteristics of tabular form, non-process property and the like, the process for solving complex logical relationship in certain applications is complex. The data is managed with 'recording' as a basic unit, pointer operations are used for substituting most of data operations, a set operation is supported from a bottom level, and thus, the efficiency and the flexibility of data management and calculation are greatly improved. The method can enable a user to work in a high-level data structure and an operation interface without contacting the data storage details of the bottom level; moreover, the operation interface has flexible data structure and powerful and free operating system so that the user can manage data more conveniently and efficiently.

Description

A kind of data processing method
Technical field
The invention belongs to technical field of computer information processing, be specifically related to a kind of data processing method.
Background technology
In the current business application at tissue, the management method of mass data information in the relational database, the inquiry thereon of main base is with modification language SQL's, because its data structure is restricted to characteristics such as the form of table and SQL non-procedural, can very loaded down with trivial details and inefficiency when handling the calculating of a lot of complex relationships.For example:
Painstakingly the weaken order of record of SQL is emphasized the unordered and equality of data, and this is the characteristic of SQL, but has also brought some inevitable defectives.Owing to the randomness of data, relate in the calculating of record order at some, for example more this calculating of this record and last registration just all must be sorted step redundancy, complex operation and inefficiency by earlier manual his-and-hers watches at every turn.
SQL does not have this convenient notion intuitively of set operation.For example existing " Beijing area employee " and " sales clerk " shows, if expect " Beijing area sales clerk " table, can not be as the direct computing of the method for getting common factor of people's intuitivism apprehension, all intersecting and merging and, the difference etc. set operation, SQL must be by the operation associated realization of condition between table, in this demand, just need add the correlation inquiry that the WHERE condition is made two tables with the SELECT statement, complex steps and logic are difficult for understanding.
SQL does not use pointer operation, and its most data manipulation all must realize by the batch duplicating data.The table that for example all SELECT inquiries are drawn all is to generate new table all duplicating out after the data computation in the table of source.For example need now " employee's personal information table " and " employee's sales situation table " are associated, to consult employee's sales situation, a concordance list can not be only created in the SELECT inquiry, generates a new table but the data after the association must be copied all.The supporting pointer operation does not cause its data manipulation inefficiency, and can waste a large amount of storage spaces, and cause it can't realize truly set operation, and also limited the degree of freedom of its work, for example it can not directly be kept at sublist within the field of master meter.
SQL emphasizes only just to finish inquiry with a statement, and the complicated query condition also will be finished in a long SELECT statement again.This causes under some complicated multilist correlation inquiry situations, all associations, grouping and screening etc. all must be finished in disposable consideration, thereby cause this statement to tend to be difficult to write, layman's intractable, for the computing that is difficult to or can't in a statement, finishes, then must preserve intermediate data by the manual creation temporary table, not only complicated operation, and this table all is that the batch duplicating data generate, so inefficiency and waste resource.
Summary of the invention
At problems of the prior art, the purpose of this invention is to provide a kind of new data processing method, mass data is handled and the convenience degree and the dirigibility of management so that improve.
To achieve these goals, the technical solution used in the present invention is that a kind of data processing method comprises the steps:
(1) data in the relational database are read in internal memory, each bar record wherein all saves as an object separately, and described record calls by pointer;
(2) orderly set formed in a plurality of records, be called arrangement, the record in the arrangement is orderly, and described arrangement is also called by pointer;
(3) record and arrangement are carried out computing and processing, and its computing and result still can be used for next step and handle, until the result who obtains demand; In processing procedure, all relate to record and the operation of arranging and quote, and all are to use pointer to quote, rather than copy data.
Further, aforesaid a kind of data processing method, a body is only stored in described each record and arrangement, and variable is interior, field is interior or arrange the address of all only storing target record or arrangement in the member, and various operations and calculating also all are the transfers of pointer and duplicate.
Further, aforesaid a kind of data processing method, in step (1), described record also can be newly-built, and the field in the record can be data type or another record or arrangement arbitrarily.
Further, aforesaid a kind of data processing method, in step (2), described arrangement is made up of any group record, and described record comes from same table or different tables, and the data structure of described record is identical or inequality.
Effect of the present invention is: the user can be worked on the data structure of high level and operation-interface for method of the present invention, and need not the data storage details of contact bottom layer, and this operation-interface has data structure and powerful arithmetic system freely flexibly, can make the convenient management data efficiently of user.Specifically, adopt method of the present invention to have the following advantages:
(1) to be recorded as the elementary cell management data
Being different from the relational database with the table is the elementary cell management data, this method is used the more basic elementary cell management data that is recorded as, this makes that the organization and management of data is more flexible and free, for the mixing array structure of back with freely divide into groups and powerful arithmetic system provides the foundation.
(2) data are orderly
Be different from the desalination of SQL to order, this method is just emphasized the meaningful property of order in the definition of the arrangement of the bottom.Thereby many need with relevant operation of order and comparison in can realize very easily that sequence number also makes many other computings easier realization that becomes, and higher arithmetic speed is arranged.
(3) freely the record and arrangement architecture
Because the freedom of record and arrangement architecture, allowing the field of record in the method directly is another record of quoting, even another arranges, and for example the son of the correspondence of certain record can be arranged indirect assignment in a certain field of this record, connects that quote will be very convenient; The existence that also allows " non-neat " to arrange in the method promptly allows the different separately data structure that records in the arrangement.These freely structure expanded the degree of freedom of organizing data greatly, data can be organized in more reasonable and succinct mode.
(4) more flexible computing
The direct set operation of method support can be carried out the friendship of data easily and wait processing with difference.The problem of " the Beijing area employee " who is for example mentioned in the preamble and " sales clerk " table, simply to get intersection operation once the step passable, very convenient as long as directly do.This method also provides powerful arithmetic system in addition, and computational data intuitively makes things convenient for.
(5) use pointer operation
All all are to use pointer to quote to record and quoting of arrangement in the arithmetic system of method, rather than copy data in batches, a body is only stored in each record and arrangement, so not only can save a large amount of storage spaces, has also significantly improved the operation efficiency of system.For example the related question of preamble " the employee's personal information table " mentioned and " employee's sales situation table " just can directly be created the concordance list an of centre, efficient height and saving resource in the method to their.
(6) realized the process processing
This method is emphasized to finish all computings unlike SQL in a statement, the operation part that this method provides allows substep to finish calculating, and middle result of calculation can be used for next computing, thereby the programming degree of freedom of Accounting Legend Code is increased greatly, code logic is also more clear, be easier to write, also strengthened readability.
Description of drawings
Fig. 1 is the process flow diagram of the embodiment of the method for the invention;
Fig. 2 is the data structure synoptic diagram of " arrangement " described in the specific embodiment of the invention.
Embodiment
Describe the present invention below in conjunction with the drawings and specific embodiments.
As shown in Figure 1, a kind of data processing method comprises the steps:
One, the data in the relational database are read in internal memory, each bar record wherein all saves as an object separately, and described record calls by pointer, S11.
Be directly to read table to create record from relational database in the present embodiment, each the bar record in the table all saves as an object separately.
Table 1 in the existing relational databases of example 1., its structure and theing contents are as follows:
Name Chinese language Mathematics English
Zhang San 82 85 91
Li Si 71 61 78
The king five 50 60 55
Zhao six 68 70 72
Grandson seven 73 90 75
After by this method it being imported to internal memory, will generate 5 independently records:
R1=={ name=Zhang San, Chinese language=82, mathematics=85, English=91}
R2=={ name=Li Si, Chinese language=71, mathematics=61, English=78}
R3=={ name=king five, Chinese language=50, mathematics=60, English=55}
R4=={ name=Zhao six, Chinese language=68, mathematics=70, English=72}
R5=={ name=grandson seven, Chinese language=73, mathematics=90, English=75}
And arrangement of generation automatically simultaneously:
A==[r1,r2,r3,r4,r5]
This structure arranged is similar to former table 1, but its essence is not form.
In this method, except the record that comes from relational database, also allow to create new record.
Ds; F i: x i..., representing a data structure (or claiming interrecord structure), ds is the data structure name, can omit, and F is a field name, and x is an expression formula.
Expression formula assignment in the data structure (or interrecord structure) being calculated, generated and stored the entity that gets off, is exactly record.
Definition new (dr) satisfies r.F for producing i==x iEntity record r, dr is an interrecord structure.
Example 2.dr=a:1, b:2, c: " test "
Below just defined an interrecord structure dr.Then use
r=new(dr)
Just generated an entity record r, it has three field a==1, b==2, c==" test ".
Compare with classic method, this method is with the more basic elementary cell management data that is recorded as, make the user can be more flexibly organization and management data freely.
Definition r.F is for extracting field from record, r is a record, and F is a field name.
X is an expression formula, and f is a function, and definition r.f (x) is when calculating f (x), and the field among the expression formula x is all taken from record r, f can for summation, average, produce, select or the like various functions.
Example 3. existing record r=new (a:1 b:2), then has:
r.a==1
r.b==2
r.(2*a+1)==3
(c:2*a d:b+3) can return recording { c=2, d=5} for r.new
Example 4. data structure dr=a:x, b:x+y
Wherein x and y are two variablees.Then:
x=0
y=1
r1=new(dr)
x=1
y=2
r2=new(dr)
Carry out after the above code, just obtain two records r1 and r2, r1.a==0 wherein, r1.b==1, r2.a==1, r2.b=3.
Example 5. definition records:
R1=new (sequence number: 1, title: " Beijing ", area code: 010)
R2=new (sequence number: 2, title: " Shanghai ", area code: 021)
Then use code:
A1=new (name: " Zhang San ", area: r1)
A2=new (name: " Li Si ", area: r2)
Two validation record a1 and a2 have below just been defined.Because allowing field in this method is another record, so their " area " field is r1 and the r2 field of directly quoting.After the definition, directly use like this:
A2. regional. area code
Just can return 021.
Compare with classic method, this reference mechanism in this method is that the association of setting up between data brings great convenience.
In the method, all are to quote by pointer to referencing operations (duplicate, newly-built etc. except) of record, rather than copy data, so promptly can improve the efficient of execution and computing greatly, also can save a large amount of storage spaces.
In realization, in the middle of one section internal memory, then the first address (being pointer) by this section internal memory calls this record to this method with recorded and stored.For example when calling record, just directly first address is kept in the field as the field of another record; When carrying out some friendships, also use pointer to export the result also with set operations such as differences; When writing down comparison, carry out pointer exactly relatively, with the similarities and differences of pointer result as a comparison; Having only duplicated record just is not that pointer calls, but copy data, standardized again section internal memory.
Two, orderly set formed in a plurality of records, be called arrangement, the record in the arrangement is orderly, and described arrangement is also called by pointer, S12.
In the present embodiment, the definition grammer of arrangement is A=[r1, r2 ...], wherein A is for arranging name, and r1, r2... are record.
Example 6. definition records:
R1=new (sequence number: 1, title: " Beijing ", area code=010)
R2=new (sequence number: 2, title: " Shanghai ", area code=021)
R3=new (sequence number: 3, title: " Guangzhou ", area code=020)
R4=new (sequence number: 4, title: " Shenzhen ", area code=0755)
Then: B=[r1, r2, r3, r4] be an arrangement.It is the arrangement of " neatly ", and it has just formed a structure that is similar to " table " in the traditional relational in other words, represents its structure with form, and is just as shown below.
Sequence number Title Area code
1 " Beijing " 010
2 " Shanghai " 021
3 " Guangzhou " 020
4 " Shenzhen " 0755
In traditional relational at the major part operation of table in the method can be by to the operation of this proper alignment with calculate and realize, but the essence of proper alignment is not a table.
A is for arranging, and definition A (i) extracts i bar record from A.
Example 7. is arranged based on the B in the example 6, then has:
B(1)==r1
B(3)==r3
Example 8. definition records:
A1=new (name: " Zhang San ", area: Beijing)
A2=new (name: " Li Si ", area: Shanghai)
G1=new (Male: man, Female: the woman)
B1=new (contract number: 00010, Customer ID: 01231, the amount of money: 100000, sell: a1)
B2=new (contract number: 00011, Customer ID: 01235, the amount of money: 200000, sell: a2, delivery area: Guangzhou)
B3=new (contract number: 00012, the amount of money: 150000, sell: a1)
B4=new (contract number: 00013, Customer ID: 01233, the amount of money: 170000)
Arrangement does not require that the data structure of record wherein is identical, and any group record can be formed arrangement.So A=[g, b1, b2, b3, b4] also be a legal arrangement.It is mixing row, and promptly " non-neat " arranged, and it has been not suitable for representing with form, because represent nonsensical substantially with form.
This method has more than support " neatly " and arranges, also can support the arrangement of " non-neat ", this has expanded the degree of freedom of organizing data greatly, makes it more freer than traditional method, and data can be organized in more reasonable and succinct mode in many cases.
In the method, all are to quote by pointer to referencing operations of arranging (newly-built, create a Copy etc. except), rather than copy data, so promptly can improve the efficient of execution and computing greatly, also can save a large amount of storage spaces.
In realization, this method will be arranged as an array and will be kept in the internal memory, wherein all preserve the pointer (being the first address of target record) that points to record in each member, and then whole arrangement also uses the first address (being pointer) of array to call.After this all use under the situation of arranging except that duplicating, and all call arrangement by pointer.Only duplicating and arranging the new arrangement that obtains just is not that pointer calls, but copy data, standardized again section internal memory.
Example 9. Fig. 2 are data structure synoptic diagram that A arranges in the example 8.
Every record among the figure all has its internal memory first address (being pointer, is circular expression among the figure).
" sale " field of b1 record among the figure, its content is record a1 in logic, in realization, the internal memory first address of preserving in the internal memory of " sale " field that just writes down a1, when calling " sale " field the user, system goes for the entity of a1 record according to this address, thereby extracts data.Same, " sale " field of record b3 also is record a1, when the user called " sale " field of b3, system can find same record entity a1.
The frame of broken lines in left side is the A arrangement among the figure, in this arranges, all member record g, b1, b2, b3, b4 are kept at its first address in the arrangement, the entity of not keeping records in the arrangement, when the user calls the arrangement member, system will find the entity of record according to these first addresss, thus reading of data.
Same, arranging A also has its first address, also is that first address by it carries out to arranging calling of A, when the user calls when arranging, equally be the entity that finds arrangement by first address, the demand according to the user finds corresponding record first address again ... quote so layer by layer.
The method that this use pointer of this method calls record and arranges, not only can save a large amount of storage spaces, and can make record and be arranged in and have high many processing speeds when participating in various computings (as set operation etc.), organizing also more rationally of data and efficient.
Three, record and arrangement are carried out computing and processing, and its computing and result still can be used for next step treatment S 13, judge whether to have reached requirement objective S14, if not, then proceed computing and processing, if then processing finishes.
Described computing and processing comprise:
To arrange directly carry out intersecting and merging and, the difference etc. the operation set operation, be A^B, A﹠amp in the present embodiment; B, A|B, A the B grammer;
Directly extracting record and directly extract field from arrange from record, is A (i) grammer and r.F grammer in the present embodiment;
According to condition record being positioned in arrangement, navigate to record by judgment expression is true and false in arrangement in the process that traversal is arranged, is A.select (x) function in the present embodiment;
At the aggregate function of arranging, promptly at based on the counting of the expression formula of arranging, sue for peace, ask average, ask and be worth, merge duplicate keys most and operate, be A.count (), A.sum (x), A.avg (x), A.max (x), A.min (x), A.id () function in the present embodiment;
According to condition specifying the record in the expression formula ordered arrangement, is A.sort (x) function in the present embodiment;
By specifying expression formula to connect the member of two arrangements, make just can directly get access to the record that being attached thereto of another arrangement connects from a certain record of an arrangement, be join (dr) function in the present embodiment;
Expression formula by any appointment is divided into groups to the record in arranging, and makes the identical record of transition formula evaluation all be divided into one group, is A.group (x) function in the present embodiment.
In all functional operation expression formulas, provide can directly quote current calculate institute at record or this be recorded in sequence number in the arrangement, in the example of present embodiment be~with the # grammer.
In the present embodiment, editing operation is carried out in arrangement is exemplified below:
A is for arranging, and x is a record, definition:
(k is to insert a record x to the k position in arranging A x) to A.insert@p.
A.delete (p) is p record among the deletion arrangement A.
(i is x) for revising the individual x that is recorded as of the i that arranges among the A for A.set.
Example 10. is arranged based on the B in the example 6, earlier definition
R5=new (sequence number: 5, title: " Nanjing ", area code=025)
Then carry out:
B.insert@p(0,r5)
Afterwards, B arranges and is [r1, r2, r3, r4, r5], and form is represented to be
Sequence number Title Area code
1 " Beijing " 010
2 " Shanghai " 021
3 " Guangzhou " 020
4 " Shenzhen " 0755
5 " Nanjing " 025
Carry out again:
B.delete(3)
B==[r1 then, r2, r4, r5].Carry out again:
B.set(1,r3)
So B==[r3, r2, r4, r5].
In the present embodiment, arrangement is carried out computing and processing is exemplified below:
The set operation of arranging
A, B are arrangement, and the number of members of A is n, and the number of members of B is m, definition:
Summation operation A|B be [A (1) ..., A (n), B (1) ..., B (m)];
Be difference operation A B be A
Figure B2009100859565D0000111
Ship calculate A^B be A (A B);
Union A﹠amp; B is A| (B A).
R1, r2, g, a1, the b1 of example below 11. is record, then has:
[r1,r2]|[g,r1,b1]==[r2,g,r1,b1]
[r1,r2,g,b1]\[r2,g,a1]==[r1,b1]
[r1,r2]^[g,r1,b1]==[r1]
[r1,r2,a1]&[g,r1,b1]==[r1,r2,g,a1,b1]
The polymerization computing of arranging
A is for arranging, and x is an expression formula, definition:
A.count () is the number of record in arranging.
A.sum (x) for calculate at all recording gauges expression formula x's and.
A.avg (x) is the mean value of expression formula x.
A.min (x) is the minimum value of expression formula x.
A.max (x) is the maximal value of expression formula x.
A.id () is an arrangement behind the record for the adjacent duplicate record that merges among the A.
Example 12. existing following record and arrangements:
R1=new (ID:1, the age: 28)
R2=new (ID:2, the age: 30)
R3=new (ID:3, the age: 18)
R4=new (ID:4, the age: 24)
A=[r1,r2,r3,r4]
B=[r1,r1,r1,r2,r3,r3,r4,r1]
Then have:
A.count()==4
A.sum (age)==100
A.avg (age)==25
A.min (age)==18
B.id()==[r1,r2,r3,r4,r1]
That arranges selects computing
A is for arranging, and x is an expression formula, definition:
A.minp (x) is for returning a record of the expression formula x minimum of calculating at all recording gauges among the A.
A.maxp (x) is for returning a record of x maximum among the A.
A.select (x) can make the x expression formula be genuine record for finding out among the A all, and forms to arrange and return.
First can make the x expression formula for really writing down and returning to A.select@1 (x) among the A in order to find out.
In addition definition: in expression formula x ,~expression is current calculate at A (i), # is the sequence number i of current A (i).
Example 13. then has based on example 12:
A.maxp (age)==r2
A.select(~>24)==[r1,r2]
A.select@1(~>24)==r1
The sorting operation of arranging
A is for arranging, and x is an expression formula, and the effect of definition A.sort (x) function is the arrangement of returning arranging after A resequences according to the ascending order of expression formula x.
Example 14. is existing based on example 12, carries out:
C=A.sort (age)
Then just have:
C==[r3,r4,r1,r2]
The division operation of arranging
A is arrangement, and x is an expression formula, and the effect of definition A.group@i (x) function is arranging A according to expression formula x grouping, make every group of interior expression formula x value equate, generating so that { _ i, _ g} are the arrangement of data structure, the corresponding x of _ i, the corresponding group membership's arrangement of _ g.
Example 15. existing following records:
A1=new (name: " Zhang Ying ", area: " Beijing ", sales volume: 100000)
A2=new (name: " Wang Wei ", area: " Guangzhou ", sales volume: 150000)
A3=new (name: " Li Fang ", area: " Shanghai ", sales volume: 300000)
A4=new (name: " Zheng Jianjie ", area: " Beijing ", sales volume: 500000)
A5=new (name: " Zhao Jun ", area: " Shanghai ", sales volume: 100000)
A6=new (name: " Sun Lin ", area: " Beijing ", sales volume: 350000)
A7=new (name: " Jin Shipeng ", area: " Beijing ", sales volume: 230000)
A8=new (name: " Liu Yingjiu ", area: " Guangzhou ", sales volume: 160000)
A9=new (name: " Zhang Xuemei ", area: " Beijing ", sales volume: 430000)
A10=new (name: " Wang Ming ", area: " Shanghai ", sales volume: 170000)
Arrange A=[a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]
Now carry out:
G=A.group@i (area)
Then G is now:
[_ i=" Beijing ", _ g=[a1, a4, a6, a7, a9] },
_ i=" Guangzhou ", _ g=[a2, a8] },
_ i=" Shanghai ", _ g=[a3, a5, a10] }]
For directly perceived, can show with form:
_i _g
Beijing [a1,a4,a6,a7,a9]
Guangzhou [a2,a8]
Shanghai [a3,a5,a10]
Directly use now
G (1) ._g.sum (sales volume)
Can return the total sales of Beijing area, similarly:
G (2) ._g.avg (sales volume)
Can return area, Guangzhou employee's sales volume for each person.
By adjusting the branch set condition x in the group function, also be easy to realize overlapping grouping, promptly a record belongs to a plurality of different groupings, and this often runs in actual applications, and in these were used, this method can be dealt with problems more efficiently than classic method.
The attended operation of arranging
Definition join (dr) function, dr is an interrecord structure, dr=F i: x i..., note z i=x iOr z i=x i. (y i), connect multiplication cross z with relation of equality i, produce with F i... be the arrangement that the record of structure constitutes, F iDifference assignment and z iCorresponding x iIn the member.
Promptly by in two arrangements separately the relation of equality of the expression formula of appointment connect two tables, and create concordance list.
Example 16. existing following records and arrangement definition:
A1=new (ID:1, name: " Wang Wei ")
A2=new (ID:2, name: " Zhang Xuemei ")
A3=new (ID:3, name: " Zhang Ying ")
Arrange: employee table=[a1, a2, a3]
B1=new (ID:10248, the amount of money: 150000, employee: 3)
B2=new (ID:10255, the amount of money: 100000, employee: 2)
B3=new (ID:10258, the amount of money: 200000, employee: 1)
B4=new (ID:10263, the amount of money: 500000, employee: 2)
B5=new (ID:10269, the amount of money: 230000, employee: 3)
Arrange: order table=[b1, b2, b3, b4, b5]
Order now:
Table 1=join (employee: employee's table: ID, order: order table: the employee)
Then table 1 is now:
[employee=a1, order=b3},
Employee=a2, order=b2},
Employee=a2, order=b4},
Employee=a3, order=b1},
Employee=a3, order=b5}]
So just two tables have been coupled together by " employee ID ", after this inquire about the order situation by the employee and just become very succinct, such as can directly selecting all orders that certain employee takes with the select function, perhaps divide into groups with group function his-and-hers watches 1, management data can be convenient.
An integrated application example
Be the actual application that example is introduced this method with simple requirements common in the practical application below the example 17..
Existing following record and arrangement definition:
A1=new (employee ID:1, name: " Wang Wei ", post: " vice president ")
A2=new (employee ID:2, name: " Zhang Xuemei ", post: " representative of sales ﹠ marketing ")
A3=new (employee ID:3, name: " Zhang Ying ", post: " representative of sales ﹠ marketing ")
A4=new (employee ID:4, name: " Zhao Jun ", post: " sales manager ")
A5=new (employee ID:5, name: " Li Fang ", post: " representative of sales ﹠ marketing ")
Arrange: employee=[a1, a2, a3, a4, a5]
C1=new (Customer ID: 1021, name: " Xu Wenbin ", area: " North China ")
C2=new (Customer ID: 1022, name: " Wang Xuanhao ", area: " North China ")
C3=new (Customer ID: 1023, name: " Fang Jianwen ", area: " East China ")
C4=new (Customer ID: 1024, name: " Wang Junyuan ", area: " North China ")
C5=new (Customer ID: 1025, name: " Hu Jiyao ", area: " East China ")
C6=new (Customer ID: 1026, name: " Lin Huiyin ", area: " southwest ")
C7=new (Customer ID: 1027, name: " Liu Weiguo ", area: " northeast ")
Arrange: client=[c1, c2, c3, c4, c5, c6, c7, c8]
B1=new (order ID:10248, the amount of money: 200000, Customer ID: 1021, sell: 5)
B2=new (order ID:10255, the amount of money: 350000, Customer ID: 1022, sell: 3)
B3=new (order ID:10258, the amount of money: 100000, Customer ID: 1024, sell: 1)
B4=new (order ID:10263, the amount of money: 220000, Customer ID: 1024, sell: 3)
B5=new (order ID:10269, the amount of money: 140000, Customer ID: 1026, sell: 5)
B6=new (order ID:10270, the amount of money: 280000, Customer ID: 1021, sell: 1)
B7=new (order ID:10275, the amount of money: 330000, Customer ID: 1027, sell: 1)
B8=new (order ID:10277, the amount of money: 120000, Customer ID: 1024, sell: 4)
B9=new (order ID:10280, the amount of money: 410000, Customer ID: 1022, sell: 2)
B10=new (order ID:10285, the amount of money: 230000, Customer ID: 1023, sell: 1)
B11=new (order ID:10292, the amount of money: 210000, Customer ID: 1023, sell: 4)
B12=new (order ID:10295, the amount of money: 280000, Customer ID: 1025, sell: 2)
B13=new (order ID:10297, the amount of money: 360000, Customer ID: 1026, sell: 5)
B14=new (order ID:10265, the amount of money: 470000, Customer ID: 1027, sell: 2)
B15=new (order ID:10254, the amount of money: 190000, Customer ID: 1022, sell: 4)
Arrange:
Order=[b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15] is present, and we want to obtain these data:
1, client's " Wang Xuanhao " order total charge;
2, the order number and the total charge of North China;
3, every order number and tabulation of order total charge that the employee takes.
Operating process is as follows:
Figure B2009100859565D0000161
The order total charge of computing client " Wang Xuanhao " at first, carry out:
ID1=client .select (name==" Wang Xuanhao ")
Just having obtained the Customer ID of client " Wang Xuanhao " like this in variable ID1, is 1022, carries out then:
Contract1=order .select (Customer ID==1022)
So just, obtained the arrangement of all orders of client " Wang Xuanhao ":
Contract1==[b2,b9,b15]
Carry out at last:
Amount1=Contract1. amount of money .sum ()
So we have just obtained the order total charge of client " Wang Xuanhao " in the Amount1 variable, are 950000.
Calculating so step by step, the result in each step can preserve for other computings and use, and has finished greater flexibility than a traditional step.Certainly in the method, above process also can merge execution, even merges into line code and carry out:
Amount1=order .select (Customer ID==client .select (name==" Wang Xuanhao ")). amount of money .sum ()
Its result also is the same.
Can carry out the characteristics that computing is this method step by step, the substep execution is finished much bigger programming degree of freedom than the step of one among traditional SQL, also makes the logical organization of code more clear, is easier to write, and has also strengthened readability.
Figure B2009100859565D0000171
Calculate the order number and the total charge of North China below, at first carry out:
Table1=join (client: client: Customer ID, order: order: Customer ID)
The Table1 that obtains is:
[client=c1, order=b1},
Client=c1, order=b6},
Client=c2, order=b2},
Client=c2, order=b9},
Client=c2, order=b15},
Client=c3, order=b10},
Client=c3, order=b11},
Client=c4, order=b3},
Client=c4, order=b4},
Client=c4, order=b8},
Client=c5, order=b12},
Client=c6, order=b5},
Client=c6, order=b13},
Client=c7, order=b7},
Client=c7, order=b14}]
Carry out then:
Contract2=Table1.select (client. the area==" North China "). order
Be all orders of North China during Contract2 arranges now, carry out at last:
Count1=Contract2.count()
Amount2=Contract2. amount of money .sum ()
So we have just obtained the order number of North China in the Count1 variable, it is 10; Just having obtained the order total charge of North China in the Amount2 variable, is 1680000.
Figure B2009100859565D0000181
Calculate the order total charge tabulation that every employee takes below again, carry out:
Table2=employee .new (employee: employee ID, order: order .select (order. sell==employee. employee ID))
A.new wherein (dr) be defined as and return [A (1) .new (dr), A (2) .new (dr) ...], A is for arranging, dr is the record definition.
The Tab1e2 that obtains is:
[{ employee=a1, order=[b3, b6, b7, b10] },
{ employee=a2, order=[b9, b12, b14] },
{ employee=a3, order=[b2, b4] },
{ employee=a4, order=[b8, b11, b15] },
{ employee=a5, order=[b1, b5, b13] }]
Carry out then:
Table3=Table2.new (employee: employee. name, order number: order .count (), total amount of the orders: order. amount of money .sum ())
The Table3 that obtains is the order total charge tabulation that every employee takes:
[employee=" Wang Wei ", and order number=4, total amount of the orders=940000},
Employee=" Zhang Xuemei ", and order number=3, total amount of the orders=1160000},
Employee=" Zhang Ying ", and order number=2, total amount of the orders=570000},
Employee=" Zhao Jun ", and order number=3, total amount of the orders=520000},
Employee=" Li Fang ", order number=3, total amount of the orders=70}]
More than be to adopt the partial arithmetic that method of the present invention carries out and the demonstration example of processing.Adopt method of the present invention that powerful computing and disposal system can be provided, comprise abundant function and operational method, powerful operation capacity is not only arranged, the data computation process is also succinct more directly perceived.
Method of the present invention is not limited to the embodiment described in the embodiment, and those skilled in the art's technical scheme according to the present invention draws other embodiment, belongs to technological innovation scope of the present invention equally.

Claims (12)

1. a data processing method comprises the steps:
(1) data in the relational database are read in internal memory, each bar record wherein all saves as an object separately, and described record calls by pointer;
(2) orderly set formed in a plurality of records, be called arrangement, the record in the arrangement is orderly, and described arrangement is also called by pointer;
(3) record and arrangement are carried out computing and processing, and its computing and result still can be used for next step and handle, until the result who obtains demand; In computing and processing procedure, all relate to record and the operation of arranging and quote, and all are to use pointer to quote, rather than copy data.
2. a kind of data processing method as claimed in claim 1, it is characterized in that: a body is only stored in described each record and arrangement, variable is interior, field is interior or arrange the address of all only storing target record or arrangement in the member, and various operations and calculating also all are the transfers of pointer and duplicate.
3. a kind of data processing method as claimed in claim 1 or 2 is characterized in that: in step (1), described record also can be newly-built, and the field in the record can be data type or another record or arrangement arbitrarily.
4. a kind of data processing method as claimed in claim 3, it is characterized in that: in step (2), described arrangement is made up of any group record, and described record comes from same table or different tables, and the data structure of described record is identical or inequality.
5. a kind of data processing method as claimed in claim 4 is characterized in that: in step (3), described computing and handle comprise to arrange directly carry out intersecting and merging and, the set operation of difference operation.
6. a kind of data processing method as claimed in claim 4 is characterized in that: in step (3), described computing and processing comprise directly extracts record and directly extract field from record from arrange.
7. a kind of data processing method as claimed in claim 4, it is characterized in that: in step (3), described computing and processing are included in the arrangement and according to condition record are positioned, promptly in the process that traversal is arranged by the true and false record that in arrangement, navigates to of judgment expression.
8. a kind of data processing method as claimed in claim 4 is characterized in that: in step (3), described computing and handle comprise at based on the counting of the expression formula of arranging, sue for peace, ask average, ask and be worth, merge duplicate keys most and operate.
9. a kind of data processing method as claimed in claim 4 is characterized in that: in step (3), described computing and processing comprise the record of according to condition specifying in the expression formula ordered arrangement.
10. a kind of data processing method as claimed in claim 4, it is characterized in that: in step (3), described computing comprises by specifying expression formula to be connected the member of two arrangements with handling, makes just can directly get access to the record that being attached thereto of another arrangement connects from a certain record of an arrangement.
11. a kind of data processing method as claimed in claim 4 is characterized in that: in step (3), described computing and processing comprise by the expression formula of any appointment the record in arranging are divided into groups, make the identical record of transition formula evaluation all be divided into one group.
12. a kind of data processing method described in claim 4 is characterized in that: in all computing and handling, directly quote current calculate at record or this be recorded in sequence number in the arrangement.
CN2009100859565A 2009-06-02 2009-06-02 Data processing method Pending CN101908045A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009100859565A CN101908045A (en) 2009-06-02 2009-06-02 Data processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009100859565A CN101908045A (en) 2009-06-02 2009-06-02 Data processing method

Publications (1)

Publication Number Publication Date
CN101908045A true CN101908045A (en) 2010-12-08

Family

ID=43263507

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009100859565A Pending CN101908045A (en) 2009-06-02 2009-06-02 Data processing method

Country Status (1)

Country Link
CN (1) CN101908045A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115552391A (en) * 2020-05-12 2022-12-30 谷歌有限责任公司 Zero copy optimization of Select query

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115552391A (en) * 2020-05-12 2022-12-30 谷歌有限责任公司 Zero copy optimization of Select query
CN115552391B (en) * 2020-05-12 2023-08-25 谷歌有限责任公司 Zero-copy optimization of Select queries

Similar Documents

Publication Publication Date Title
Goil et al. High performance OLAP and data mining on parallel computers
US6334125B1 (en) Method and apparatus for loading data into a cube forest data structure
US6141655A (en) Method and apparatus for optimizing and structuring data by designing a cube forest data structure for hierarchically split cube forest template
US6424967B1 (en) Method and apparatus for querying a cube forest data structure
US6122644A (en) System for halloween protection in a database system
CN106547809A (en) Complex relation is represented in chart database
Chavalier et al. Document-oriented data warehouses: Models and extended cuboids, extended cuboids in oriented document
KR20010083096A (en) Value-instance-connectivity computer-implemented database
WO2008009018A2 (en) Spreadsheet-based relational database interface
CN102867066B (en) Data Transform Device and data summarization method
Ngu et al. B+-tree construction on massive data with Hadoop
CN105159971B (en) A kind of cloud platform data retrieval method
Wang et al. A mapreducemerge-based data cube construction method
Rolland The essence of databases
Lechtenbörger Data warehouse schema design
Celko Joe Celko's data and databases: concepts in practice
CN101789024A (en) Method for processing data
Shrestha et al. Survey on the Evolution of Models of Data Integration
Borić et al. Unified spatial analytics from heterogeneous sources with Amazon Redshift
CN101908045A (en) Data processing method
Fan et al. DIRECT: a system for mining data value conversion rules from disparate data sources
Jürgens Index structures for data warehouses
Zdepski et al. An Approach for Modeling Polyglot Persistence.
Ayyavaraiah et al. Database Management System
Nordbotten Automatic files in statistical systems

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20101208