Files
greptimedb/tests/compatibility/cases/exemplar_legacy_keys/setup.sql
T
shuiyisong ec240ad7e6 feat(mito): preserve ordinary sparse keys across writes and schema changes (#9920)
* feat(mito): support ordinary sparse append tables

Ordinary append tables need sparse keys for optional series tags, including JSON2 values written through row and bulk paths. This change validates sparse tag schemas and defaults, keeps key identity stable when nullable tags are added, selects flat SST storage, and preserves append-mode semantics when reopening regions.

Includes storage, bulk-write, schema-evolution and repartition tests, plus SQL and mixed-version fixtures. Existing metric-engine sparse key handling remains supported. This is the storage prerequisite for exemplar ingestion; it introduces no exemplar protocol endpoint.

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* fix(mito): preserve reserved sparse key semantics

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* fix(mito): clarify sparse errors and avoid panics

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* perf(mito): reduce sparse key validation overhead

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* fix: sqlness

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* perf(mito-codec): reduce sparse validation cost

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* refactor(mito): remove ordinary sparse support

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

---------

Signed-off-by: shuiyisong <xixing.sys@gmail.com>
2026-10-29 05:45:07 +00:00

18 lines
964 B
SQL

CREATE TABLE dense_keys (ts TIMESTAMP TIME INDEX, host STRING PRIMARY KEY, val DOUBLE);
INSERT INTO dense_keys (ts, host, val) VALUES (1, 'api', 1.5), (2, NULL, 2.5);
ADMIN FLUSH_TABLE('dense_keys');
CREATE TABLE metric_keys (ts TIMESTAMP TIME INDEX, val DOUBLE) ENGINE=metric
WITH ('physical_metric_table'='', 'memtable.type'='bulk', 'primary_key_encoding'='sparse');
CREATE TABLE logical_keys (ts TIMESTAMP TIME INDEX, host STRING PRIMARY KEY, val DOUBLE) ENGINE=metric
WITH ('on_physical_table'='metric_keys');
INSERT INTO logical_keys (ts, host, val) VALUES (1, 'api', 3.5), (2, NULL, 4.5);
ADMIN FLUSH_TABLE('metric_keys');
-- Historical OTLP infinity labels must retain their identity after upgrade.
CREATE TABLE otlp_upgrade_bucket (
greptime_timestamp TIMESTAMP(3) TIME INDEX,
le STRING PRIMARY KEY,
greptime_value DOUBLE
);
INSERT INTO otlp_upgrade_bucket VALUES (10000, 'inf', 1), (20000, 'inf', 2);
ADMIN FLUSH_TABLE('otlp_upgrade_bucket');