Files
greptimedb/tests/compatibility/cases/column_encoding/verify.result
T
dennis zhuang 672e94f61d feat: add column encoding option and use it for trace span ids (#9629)
* feat: add column encoding option and set it for trace span ids

COMPRESSION WITH accepts encoding = 'plain' | 'delta_binary_packed'.
Either disables the dictionary for the column; delta_binary_packed is
limited to integer and timestamp columns.

OTLP trace v1/v2 tables now create span_id and parent_span_id with plain
encoding and 64KiB pages, and timestamp_end with delta_binary_packed.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test: add compatibility cases for column encoding options

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test: move column encoding downgrade checks into downgrade_compatibility

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-10-16 09:40:54 +00:00

68 lines
3.3 KiB
Plaintext

SELECT * FROM legacy_spans ORDER BY ts;
+-------------------------+---------+----------------------------+
| ts | span_id | ts_end |
+-------------------------+---------+----------------------------+
| 1970-01-01T00:00:00.001 | a1 | 1970-01-01T00:00:00.000001 |
| 1970-01-01T00:00:00.002 | a2 | 1970-01-01T00:00:00.000002 |
+-------------------------+---------+----------------------------+
CREATE TABLE encoded_spans (
ts TIMESTAMP TIME INDEX,
span_id STRING COMPRESSION WITH (encoding = 'plain', page_size = '64KiB'),
ts_end TIMESTAMP(9) COMPRESSION WITH (encoding = 'delta_binary_packed')
);
Affected Rows: 0
INSERT INTO encoded_spans SELECT * FROM legacy_spans;
Affected Rows: 2
ADMIN FLUSH_TABLE('encoded_spans');
+------------------------------------+
| ADMIN FLUSH_TABLE('encoded_spans') |
+------------------------------------+
| 0 |
+------------------------------------+
-- SQLNESS ARG restart=true
SHOW CREATE TABLE encoded_spans;
+---------------+---------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------------+---------------------------------------------------------------------------------------------------+
| encoded_spans | CREATE TABLE IF NOT EXISTS "encoded_spans" ( |
| | "ts" TIMESTAMP(3) NOT NULL, |
| | "span_id" STRING NULL COMPRESSION WITH(encoding = 'plain', page_size = '64KiB', type = 'zstd'), |
| | "ts_end" TIMESTAMP(9) NULL COMPRESSION WITH(encoding = 'delta_binary_packed', type = 'zstd'), |
| | TIME INDEX ("ts") |
| | ) |
| | |
| | ENGINE=mito |
| | |
+---------------+---------------------------------------------------------------------------------------------------+
INSERT INTO encoded_spans VALUES (3, 'b3', 3000);
Affected Rows: 1
ADMIN FLUSH_TABLE('encoded_spans');
+------------------------------------+
| ADMIN FLUSH_TABLE('encoded_spans') |
+------------------------------------+
| 0 |
+------------------------------------+
SELECT * FROM encoded_spans ORDER BY ts;
+-------------------------+---------+----------------------------+
| ts | span_id | ts_end |
+-------------------------+---------+----------------------------+
| 1970-01-01T00:00:00.001 | a1 | 1970-01-01T00:00:00.000001 |
| 1970-01-01T00:00:00.002 | a2 | 1970-01-01T00:00:00.000002 |
| 1970-01-01T00:00:00.003 | b3 | 1970-01-01T00:00:00.000003 |
+-------------------------+---------+----------------------------+