Syntax
mergeTreeProjection(database, table, projection)
Arguments
| Argument | Description |
|---|---|
database | The database name to read projection from. |
table | The table name to read projection from. |
projection | The projection to read from. |
Returned value
A table object with columns provided by given projection.Usage Example
CREATE TABLE test
(
`user_id` UInt64,
`item_id` UInt64,
PROJECTION order_by_item_id
(
SELECT _part_offset
ORDER BY item_id
)
)
ENGINE = MergeTree
ORDER BY user_id;
INSERT INTO test SELECT number, 100 - number FROM numbers(5);
SELECT *, _part_offset FROM mergeTreeProjection(currentDatabase(), test, order_by_item_id);
โโitem_idโโฌโ_parent_part_offsetโโฌโ_part_offsetโโ
1. โ 96 โ 4 โ 0 โ
2. โ 97 โ 3 โ 1 โ
3. โ 98 โ 2 โ 2 โ
4. โ 99 โ 1 โ 3 โ
5. โ 100 โ 0 โ 4 โ
โโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
DESCRIBE mergeTreeProjection(currentDatabase(), test, order_by_item_id) SETTINGS describe_compact_output = 1;
โโnameโโโโโโโโโโโโโโโโโฌโtypeโโโโ
1. โ item_id โ UInt64 โ
2. โ _parent_part_offset โ UInt64 โ
โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโ