Description:
Get structure information of a composite table.
f.structure()
Note:
The function gets composite table f’s structure information, which includes the following contents:
|
Structure |
Description |
|
[field] |
A sequence of fields |
|
name |
Field name |
|
dim |
Whether a field is dimension |
|
type |
Data type; enter null if a field isn’t pure |
|
key |
Whether a dimension field is the primary key |
|
del |
Whether there is a deletion mark |
|
row |
Whether row-wise storage is used |
|
zip |
Whether data is compressed |
|
seg |
Whether data is segmented by the first field |
|
zonex |
Zone table expression |
|
Index |
|
|
hash |
HASH index length; =0 means an ordered index and null represents a full-text index |
|
[keys] |
A sequence of fields on which index is created |
|
[field] |
A sequence of fields to which values are attached |
|
where |
Filter condition |
|
Pre-aggregation |
|
|
[keys] |
Grouping key |
|
[aggr] |
Aggregate |
|
name |
Field name |
|
exp |
Aggregate expression |
|
[attach] |
Attached table; fill in this field with nulls if there isn’t any attached table |
|
name |
Name |
|
… |
List structures of other composite tables recursively |
|
block |
Block size |
Parameter:
|
f |
A composite table/multizone composite table/index file/preaggregation file. |
Option:
|
@i |
Means f is an index file. |
|
@c |
Means f is a preaggregation file. |
Return value:
Table sequence
Example:
When f is a composite table:
|
|
A |
|
|
1 |
=demo.query("select EID,NAME from employee") |
|
|
2 |
=demo.cursor("select EID,SALARY from employee") |
|
|
3 |
=file("str.ctx") |
|
|
4 |
=A3.create@y(#EID,NAME) |
Create a composite table whose key is EID and that is column-oriented and uses compression; block size uses the system default. |
|
5 |
=A4.append(A1) |
|
|
6 |
=A4.attach(salary,SALARY) |
Add an attached table named salary to the composite table. |
|
7 |
=A6.append(A2) |
|
|
8 |
>A5.close() |
|
|
9 |
=A3.structure() |
|
When f is an index file:
|
|
A |
|
|
1 |
=file("emp1.ctx") |
|
|
2 |
=A1.create@y(#EID,NAME,GENDER,DEPT,SALARY) |
Create a composite table. |
|
3 |
=demo.cursor("select EID,NAME,GENDER,DEPT,SALARY from employee ") |
Return a cursor. |
|
4 |
=A2.append(A3) |
Append cursor A3’s data to the composite table. |
|
5 |
=file("index1") |
Return a file object. |
|
6 |
=A2.index(A5:10,GENDER=="F";EID) |
Create a HASH index file of length 10 for the composite table on indexed field EID. |
|
7 |
=A5.structure@i() |
Return structure of index file index1:
|
When f is a preaggregation file:
|
|
A |
|
|
1 |
=file("emp1.ctx") |
|
|
2 |
=A1.create@y(#EID,NAME,GENDER,DEPT,SALARY) |
Create a composite table. |
|
3 |
=demo.cursor("select EID,NAME,GENDER,DEPT,SALARY from employee ") |
Return a cursor. |
|
4 |
=A2.append(A3) |
Append cursor A3’s data to the composite table. |
|
5 |
=file("cub1") |
Return a file object. |
|
6 |
=A2.cuboid(A5,DEPT;avg(SALARY)) |
Create a preaggregation file for the composite table. |
|
7 |
=A5.structure@c() |
Return structure of preaggregation file cub1. |