구문
mergeTreeProjection(database, table, projection)
인수
| 인수 | 설명 |
|---|---|
database | 프로젝션을 읽어올 데이터베이스 이름입니다. |
table | 프로젝션을 읽어올 테이블 이름입니다. |
projection | 읽어올 프로젝션입니다. |
반환 값
사용 예시
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 │
└─────────────────────┴────────┘