joinx()

Read(1058) Label: join, cluster cursor,

Description:

Join up synchronously segmented cluster cursors.

Syntax:

joinx(csi:Fi,xi,..;…)

Note:

Suppose that the joining fields/expressions xi are ordered in an ascending order, the function joins up multiple synchronously segmented cluster cursors according to the condition that the values of the joining fields/expressions xi and x1 are equal to generate a cluster cursor consisting of fields Fi,….

 

Parameter Fi is a referencing field that references records of the csi, the sequence of the original cluster cursors. Join up the cluster cursors by primary keys when parameter xj is absent; and by the values of xj when the parameter is present but no dimensions are set. The function supports cluster multicursors that should contain the same number of subcursors.

 

The join operation is performed by matching the joining field x1 in cs1 with the values of all the other joining fields/expressions, which means it is a one-to-many relationship. The to-be-joined cursors should be stored in one node; cross-node retrieval isn’t allowed.

Option:

@f

Full join; use null to correspond when there is no matching value

@1

Left join; the option is number 1 instead of letter l

@p

Join by positions; ignore parameter xj

@i

Used only to filter A1 cs1 and ignore parameter Fi; do not work with @f@1 options

@d

Used only to filter cs1 to retain records that cannot be found and ignore parameter Fi; do not work with @f@1 options

Parameter:

Fi

The resulting field

csi

To-be-joined cluster cursors

xi

Joining field/expression

Return value:

Cluster cursor

Example:

 

A

B

 

1

[192.168.0.114:8281,192.168.18.131:8281]

 

A cluster of two nodes.

2

=file("salespart.ctx", A1)

=file("orderpart.ctx":[1], A1)

Composite tables salespart.ctx  and orderpart.ctx are stored on the two nodes by segments.

3

=A2.open()

=B2.open()

Open the two composite tables respectively.

4

=A3.cursor()

=B3.cursor()

 

5

=B4.sortx(EID; A4)

=joinx(A4:s,EID;A5:o,EID)

A5 sorts B4’s result, distributes it according to the distribution way of salespart.ctx and generate a cursor for it; B5 joins up the two synchronously distributed cluster cursors.

 

 

A

 

1

=file("t1.ctx","192.168.0.111:8281")

 

2

=A1.open()

Open cluster composite table t1.ctx.

3

=A2.cursor@m(;;3)

Generate a synchrounous 3-parts multicursor from A2’s cluster composite table.

4

=file("t2.ctx","192.168.0.111:8281")

 

5

=A4.open()

Open cluster composite table t2.ctx.

6

=A5.cursor(;;A3)

Synchronously segment A5 according to A3’s multicursor.

7

=joinx(A3:t1,EID;A6:t2,EID).fetch()

Join up A3 and A6 to perform a multithreading computation.