Here’s how to use memory() function.
Generate a memory table from a cursor.
Syntax:
cs.memory(K,…)
Note:
The function generates a memory table, whose key is K, from a cursor. When parameter K is absent, the newly-generated memory table will inherit the cursor’s key.
Parameters:
K |
The key; can be omitted |
cs |
A cursor |
Options:
@z |
Generate a compressed memory table to save space |
Return value:
A memory table
Example:
|
A |
|
1 |
=demo.cursor("select EID,NAME,GENDER,SALARY from EMPLOYEE where EID<10") |
Return the cursor with retrieved data |
2 |
=A1.memory(EID) |
Return a memory table whose key is EID |
Description:
Generate a cluster memory table from a cluster cursor.
Syntax:
cs.memory(K,…)
Note:
According to cluster cursor cs, the function generates a cluster memory table that distributed the same way as cs and whose key is K. If cs is a cluster multicursor, load a series of cursors in order.
Parameters:
K |
The key; can be omitted |
cs |
A cluster cursor |
Return value:
A cluster memory table
Example:
|
A |
|
1 |
=file("D:/test0.ctx":[2],"169.254.121.62:8281") |
Open a cluster file |
2 |
=A1.create() |
Create a cluster table |
3 |
=A2.attach(table) |
Retrieve cluster table table |
4 |
=A3.cursor(NAME,GENDER;EID<6) |
Get NAME field and GENDER field where EID<6 from cluster table table and return them as a cursor |
5 |
=A4.memory(GENDER) |
Generate a cluster memory table whose key is GENDER from a cluster cursor |
Description:
Generate a cluster memory table from a local memory table.
Syntax:
memory(h,V)
Note:
The function generates a cluster memory table from local memory table V, which is stored in a global variable, held in node sequence h.
Parameters:
h |
Node sequence |
V |
A memory table’s global variable |
Return value:
Cluster memory table
Example:
Suppose the global variable arg1 is already assigned value using env(v, data) in the initiation script init.dfx:
|
A |
|
1 |
=memory(["192.168.31.72:8281","192.168.31.72:8291"],arg1) |
Generate a cluster memory table from the local memory table arg1 |
2 |
=A1.cursor().fetch() |
|
Description:
Convert a compressed memory table into an uncompressed one.
Syntax:
T.memory()
Note:
The function converts a compressed memory table into an uncompressed one.
Options:
@z |
Convert an uncompressed memory table into a compressed one to save memory space |
Return value:
A memory table
Example:
|
A |
|
1 |
=demo.cursor("select EID,NAME,GENDER,SALARY from EMPLOYEE where EID<10") |
Return a cursor containing retrieved data |
2 |
=A1.memory@z(EID) |
Return a compressed memory table whose key is EID |
3 |
=A2.memory() |
Convert a compressed memory table into an uncompressed one |
4 |
=A3.memory@z() |
Convert an uncompressed memory table into a compressed one |
Description:
Generate a memory table from an entity table.
Syntax:
T.memory(C,…;w)
Note:
The function filters entity table T according to filtering condition w and imports the data into the memory to generate a memory table containing column C. we can handle a memory table as we do to a table sequence. When parameter C,… is absent but parameter w is present, the semicolon before w can’t be omitted. If a column C is preceded by # in the entity table, column C will be the key of memory table T. The memory table inherits the entity table’s key if you don’t set a key for it.
Parameters:
C |
A column name; import all columns when the parameter is omitted |
w |
Filtering condition; won’t perform filtering when the parameter is omitted |
T |
An entity table in a composite table |
Return value:
A memory table
Example:
|
A |
|
1 |
=file("D:\\employees.ctx") |
employees is an existing composite table file |
2 |
=A1.create() |
Open the composite table |
3 |
=A2.attach(t1) |
Return the composite table’s attached table t1 |
4 |
=A2.memory() |
Generate a memory table using all columns of the base table |
5 |
=A2.memory(EID,Dept,Name;EID<5) |
Get some columns where EID<5 from the base table to generate a memory table |
6 |
=A3.memory() |
Get all columns from the attached table to generate a memory table |
Description:
Generate a cluster memory table from a cluster entity table.
Syntax:
T.memory(C,…;w)
Note:
The function generates a cluster memory table from a cluster entity table T, which must have at least one dimension that is used to segment T and facilitates the segmentation. Clear a node’s memory at exit; will perform auto-clear when timeout occurs.
Parameters:
C |
A column name; import all columns when the parameter is omitted |
w |
Filtering condition; won’t perform filtering when the parameter is omitted |
T |
A cluster composite table’s entity table with dimensions |
Return value:
A cluster memory table object
Example:
|
A |
|
1 |
=file("emp1.ctx":[1],["192.168.0.116:8281","192.168.0.129:8281"]) |
Open a cluster file |
2 |
=A1.create() |
Create a cluster table |
3 |
=A2.attach(t1) |
Get cluster table t1 |
4 |
=A3.memory(NAME,GENDER;EID<5) |
Get columns NAME and GENDER with EID being less than 5 from t1 to generate a memory table |