mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-12-04 08:25:29 +00:00
2ef0036d1afdb17a5e11bc111aae25fefacc8073
1081
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
69623e000b |
refactor(tests-integration): drop duplicated harness code and tests (#10856)
* refactor(tests-integration): extract datanode RPC transport Signed-off-by: WenyXu <wenymedia@gmail.com> * refactor(tests-integration): share cluster startup orchestration Signed-off-by: WenyXu <wenymedia@gmail.com> * refactor(tests-integration): share migration and repartition scenarios Signed-off-by: WenyXu <wenymedia@gmail.com> * refactor(tests-integration): clarify shared cluster helper APIs Signed-off-by: WenyXu <wenymedia@gmail.com> * test(repartition): check partition metadata as soon as ALTER returns The synchronous ALTER waits for its procedure and invalidates the local frontend cache before returning. Query the same frontend immediately to exercise that guarantee. Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(tests-integration): bound datanode registration by a configurable timeout Signed-off-by: WenyXu <wenymedia@gmail.com> * refactor(tests-integration): build slow-query and histogram PG/MySQL servers through the shared helpers Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(tests-integration): drop instance tests covered by sqlness and table-drive COPY and external table cases test_execute_insert_by_select and test_execute_query are covered by insert_select.sql and sum.sql, which assert the same rows and error messages in both modes; test_execute_insert and test_execute_create only checked affected rows. The four cloud COPY tests share one body, and the parquet and CSV external table fixtures hold the same rows. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(tests-integration): share the Kafka cluster setup of region migration tests Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(tests-integration): fold the OTel Arrow exemplar tests into one and share the metrics payload test_otel_arrow_exemplars_without_metric_engine and test_exemplar_otel_arrow_skips_non_metric_source checked the same skip; the surviving test now also verifies decoding and a following histogram batch in both deployments. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(tests-integration): share the GC garbage setup and checks across GC trigger tests Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(tests-integration): share submitted procedure lookup across event tests Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(tests-integration): box the metasrv startup future to fit the default test stack Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(tests-integration): require a boxed metasrv future and tidy cluster docs Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com> Signed-off-by: Dennis Zhuang <killme2008@gmail.com> Co-authored-by: WenyXu <wenymedia@gmail.com> |
||
|
|
4a1c8340a0 |
test(frontend): cover TTL rollup cache and perf (#10799)
* test(frontend): cover TTL rollup cache and perf Signed-off-by: discord9 <discord9@163.com> * test(integration): drop the rollup cache reset token #10570 removed RollupCacheOptions::reset_token: the reset is the debug endpoint behind the existing auth, and no test here read the token. The field made tests-integration fail to compile against the current cache. Signed-off-by: discord9 <discord9@163.com> * test(frontend): follow the promql_rollup_cache rename Adapt the rollup cache E2E tests and the perf harness to the parent's promql_rollup_cache rename, including the rendered [promql_rollup_cache] configuration table: a case that rendered [rollup_cache] would have measured two uncached frontends while presenting itself as a cache measurement. The parent's twenty-step chunk floor also changes the geometry the tests and the case describe, so the E2E data window moves to 20..65 minutes to still hold a whole canonical chunk, and the perf case comment now states the three 100-minute chunks and thirteen direct points. Every asserted value and every latency threshold is unchanged. Signed-off-by: discord9 <discord9@163.com> * perf(test): render only the rollup cache fields a case sets Signed-off-by: discord9 <discord9@163.com> * test(integration): drop the redundant rollup cache expiry test Signed-off-by: discord9 <discord9@163.com> * docs(test): trim rollup cache perf prose Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
442188319c |
test(promql): make planner test assertions able to fail (#10846)
* test(promql): make planner test assertions able to fail
- Replace 14 #[should_panic] planner tests that passed on any outcome
(empty plan name, mismatched output type) with full plan assertions.
- Assert the published value column's type instead of finding a column
by that type and re-checking it; drop the observer assertions in
http.rs that re-check the name the observer already filtered on.
- Tighten a `contains("false")` check to `Boolean(false)`.
- Format the plan in panic messages that used literal braces in expect().
- Align test names and docs with what they assert for label rewrites
and native histogram aggregates.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(promql): keep expect with plain messages and drop observer name checks
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
---------
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
|
||
|
|
6d38bd32d0 |
refactor(promql): drop a dead split gate and narrow two sub-millisecond histogram refusals (#10813)
* refactor(promql): drop a dead split gate and narrow two sub-millisecond histogram refusals - Remove `split_aggregate_folds_float_state_only`. The refused shape (histogram root over a cut that exports float state) is unreachable: the compiler binds `BoundAggregate.field_kind` from the aggregate's direct input, only `Sum`/`Avg × Histogram` yields a histogram state, and a successful split cuts exactly one aggregate, so a float cut can never sit under a histogram root. - Move `histogram_over_a_sub_millisecond_time_index` from selector preparation to the Window node. The old check refused every native histogram read over a microsecond/nanosecond time index, including pure instant queries (`avg(h)`, `count(h)`, `h @ 5`) that the Instant node answers correctly. It now refuses only a Window whose direct input is a raw histogram sample stream: raw ingest keeps no window time beside a histogram payload, which `RangeEvaluator::ingest` needs. Keyed on the units bound into the tree, so it covers mito raw scans and file-engine row sources alike. - Rename `range_modifier_over_a_sub_millisecond_time_index` to `experimental_range_modifier_over_a_sub_millisecond_time_index`: it refuses `anchored`/`smoothed` windows, not `@`/`offset`, which are applied on raw ticks before payloads are formed. Add planner tests for the narrowed gate: `avg(h)` over a microsecond histogram is admitted; `count_over_time(h[5m])` is still refused. Signed-off-by: discord9 <discord9@163.com> * test(promql): execute a microsecond native histogram avg against the existing plan The planner test only checks that `avg(h)` over a microsecond native histogram column is admitted; the shape moved from a planning-time decline to native execution, and nothing executed it. Add it to the sub-millisecond execution parity test: two series, two steps, the answer's `count`/`sum` asserted against hand-computed means for both routes, and the native run verified to carry a fused node. On main the query is refused with `histogram_over_a_sub_millisecond_time_index` (the old selector-stage gate), so the case is red there. Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
47f526e9bf |
feat(promql): narrow a __field__ scan, and declare the kind a broadcast answers (#10655)
* feat(promql): answer __field__ selectors and same-metric `or` groups natively
Let the native route plan three shapes it used to hand back:
- `__field__` selection (`m{__field__="f"}`) on mito raw scans, metric
logical scans and file-engine row sources: the scan is narrowed to the
selected fields (`field_first_projection`) so `RawSeriesSource` still
sees exactly the canonical frame, text columns are refused as value
kinds, and a matcher naming a column the selection drops is refused
(`row_matchers_need_a_dropped_column`) instead of degrading to a
literal `"" = …` that silently answers nothing.
- `or` groups within one metric (`m{host="a" or host="b"}`) as one scan
with one `Filter`: `AlternativeFilters` merges the groups' conjuncts,
groups that select different fields or tables are refused, and
`discovers_metric_name` learns the alternative groups so the
authorization layer and the planner agree on what a selector
discovers.
- A scalar operand in a composed binary (`(hist * on(job) floats) * 2`):
`native_scalar_operand` binds a scalar side that the composed path
previously required to be a frame.
`field_columns_selected_by` is extracted in `planner.rs` so the legacy
and native routes select the same columns; as a side effect the legacy
route's value-column order for a multi-field `__field__` selection goes
from HashSet order to table order.
Signed-off-by: discord9 <discord9@163.com>
* refactor(promql): share the scalar-binary binder and refuse a histogram over a dynamic scalar
- Fold the composed path's `bind_evaluated_broadcast` into a single
`bind_scalar_binary` shared with `binary_operation`'s scalar tail;
both carry the same modifier refusal and `broadcast(...)` call.
- In `try_plan_native_composed_binary`, decline a histogram frame met
by a *dynamic* scalar (`(hist * on(job) floats) / time()`) with
`histogram_over_a_dynamic_scalar`: the runtime refuses non-float
samples on that branch instead of dropping them. A constant scalar
(`* 2`) keeps planning natively. The refusal can go once the
histogram-aware dynamic kernel lands separately.
- Adapt the tests to the rebased base (#10701): a decline is now an
error carrying its cause, so the `plan_or_refusal` sites assert
`native_decline_reason(..)` and the integration rows that used to
unwrap a declined output assert the cause.
Signed-off-by: discord9 <discord9@163.com>
* refactor(promql): say a refusal is an error and drop the dead pre-or matcher loop
Review follow-ups:
- `histogram_over_a_dynamic_scalar` refused because the dynamic-scalar
kernel on main errors on a non-float sample (#10812), not because
Prometheus lacks a per-point histogram scale — it has one (`h / time()`).
Comment and the three test docs now say so and reference #10812.
- Since #10701 a decline is a planning error with its cause; nothing
falls back to the existing plan. Reword the doc comments and test
docs that still described a fallback.
- `native_promql_or_matchers_narrow_the_scan` asserted the existing
plan's rows for `{host="a" or host="b"}`, which answers `c`: the
parser moves the pre-`or` matchers into the first group and
`matchers_to_expr` reads `matchers.matchers` only, so the existing
plan applies none of them. That is the existing plan's bug, filed
separately; the test no longer states it as an expectation and keeps
only the route check.
- `AlternativeFilters::of_selector` looped over `selector.matchers.matchers`
before the group loop; with any `or` that list is empty, and if it
were not the loop would silently drop every non-selection matcher.
Removed.
Signed-off-by: discord9 <discord9@163.com>
---------
Signed-off-by: discord9 <discord9@163.com>
|
||
|
|
42e96e5bd9 |
fix(servers): spell Prometheus infinities as +Inf and keep Jaeger tags per trace (#10823)
* fix(servers): spell infinite Prometheus samples as +Inf and keep Jaeger process tags per trace Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(servers): serialize non-finite Prometheus samples from static strings Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
76209d6179 |
feat(frontend): add TTL-based PromQL range cache (#10798)
* feat(frontend): add TTL-based PromQL range cache Signed-off-by: discord9 <discord9@163.com> * feat(frontend): add rollup cache reset endpoint Signed-off-by: discord9 <discord9@163.com> * feat(frontend): honor nocache for rollup cache Signed-off-by: discord9 <discord9@163.com> * fix(frontend): key rollup cache by table id and invalidate on DDL Signed-off-by: discord9 <discord9@163.com> * fix(frontend): set transitional rollup cache bounds Signed-off-by: discord9 <discord9@163.com> * fix(frontend): trim rollup cache to ttl and reset Remove the reset token and all DDL/heartbeat invalidation so the transitional cache has one freshness rule (ttl) and one manual escape (reset). Charge variable-sized keys, honor POST-form nocache, fail on schema changes instead of falling back, and drop duplicate TTL/dead checks. Signed-off-by: discord9 <discord9@163.com> * docs(frontend): drop stale invalidation wording Signed-off-by: discord9 <discord9@163.com> * fix(frontend): bound rollup cache key and weight Share one QueryIdentity across a plan's chunk keys, refuse chunks whose weight does not fit a u32, and reject ttl values longer than moka accepts. Clarify schema-mismatch and wall-clock tail docs. Signed-off-by: discord9 <discord9@163.com> * docs(frontend): regenerate config.md for rollup_cache tail config/config.md was hand-updated and kept the previous wording of the rollup_cache.tail comment. Run make config-docs so it matches the example TOMLs, which is what CI checks. Signed-off-by: discord9 <discord9@163.com> * test(integration): expect rollup_cache in the /config snapshot test_config_api compares the whole TOML the /config endpoint returns with a hardcoded expectation. The rollup cache adds a [rollup_cache] section, so append it with the values the frontend defaults serialize to. Signed-off-by: discord9 <discord9@163.com> * refactor(frontend): rename rollup cache to promql_rollup_cache Rename the config key, the options and config types, the cache itself, the instance accessors, the reset endpoint and the session hint so the name says what is cached. query_cache becomes promql_query_cache for the same reason: it holds PromQL range-query chunks only. Signed-off-by: discord9 <discord9@163.com> * feat(frontend): log the promql rollup cache config when enabled Signed-off-by: discord9 <discord9@163.com> * feat(frontend): size the promql rollup cache from system memory by default Derive max_bytes from total memory like the OTLP trace aux cache (1/128, floor 32MiB, cap 8GiB) instead of a fixed 256MiB, so a small frontend does not give up a quarter of its memory and a large host gets a useful budget. An explicit max_bytes still wins. Signed-off-by: discord9 <discord9@163.com> * refactor(frontend): move the promql rollup cache wiring out of instance.rs Signed-off-by: discord9 <discord9@163.com> * refactor(query): expose plan_is_native from the native planner Signed-off-by: discord9 <discord9@163.com> * fix(frontend): key promql rollup cache chunks on the output schema The metric engine auto-alters a logical table when a new label arrives, which keeps the table id but changes the schema. Keying on the id alone let one request meet an old-schema hit with a new-schema fill and fail until the ttl. The output schema of the built plan is now a key dimension, so a schema change misses; a disagreement left after that is a race with an ALTER, and the request bypasses to its original plan instead of failing. Signed-off-by: discord9 <discord9@163.com> * perf(frontend): execute consecutive promql rollup cache misses as one window A cold request executed every missed chunk as its own subwindow, each re-reading the range its first point folds. Consecutive misses now run as one window and the rows are split back into chunks before insert. Signed-off-by: discord9 <discord9@163.com> * perf(frontend): size promql rollup cache chunks in steps and drop empty-chunk guards A fixed-time chunk holds chunk/step points and degrades to one point at a large step: a 7d panel at a 10m step became 1008 single-point chunks that all had to be looked up and merged even when warm. A chunk is now at least MIN_CHUNK_STEPS points wide, so the chunk count tracks points rather than range (7d at 10m: 50 chunks). plan_chunks never emits an empty chunk, so the guards in lookup and insert, the EmptyChunk bypass, Lookup::Bypass and Insert::Bypassed are gone along with the two tests that built an empty key by hand. Also applies the reviewer's doc suggestions and dedupes the tests that asserted one behavior at three layers. Signed-off-by: discord9 <discord9@163.com> * docs(frontend): regenerate config.md for promql_rollup_cache Signed-off-by: discord9 <discord9@163.com> * fix(frontend): copy split promql rollup cache chunks before storing them Signed-off-by: discord9 <discord9@163.com> * fix(frontend): store empty promql rollup cache chunks as complete answers Signed-off-by: discord9 <discord9@163.com> * refactor(frontend): key the promql rollup cache on the arrow schema directly Signed-off-by: discord9 <discord9@163.com> * fix(frontend): only bypass the promql rollup cache for a set nocache hint Signed-off-by: discord9 <discord9@163.com> * docs(frontend): record that rollup cache annotations belong to the read Signed-off-by: discord9 <discord9@163.com> * perf(frontend): read contiguous direct spans as one window Signed-off-by: discord9 <discord9@163.com> * docs(frontend): fix stale rollup cache comments and pin lookback_ms Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
fae5368d81 |
fix(postgres): check the COPY FROM STDIN payload bound first and make it configurable (#10632)
* fix(postgres): check the COPY FROM STDIN payload bound first and make it configurable The 64 MiB bound on a table-less COPY FROM STDIN payload (influxdb line protocol, OTLP, Prometheus Remote Write) was checked only after the chunk had been charged against the shared request-memory limiter, so a chunk the bound rejects could first stall on the limiter's Wait policy until its timeout and then surface a misleading "Timeout waiting for memory quota" (53000) instead of the bound's own error. The bound is now checked before the charge: a rejected chunk neither waits for nor takes permits. The bound also becomes `postgres.max_copy_in_payload` (default 64MB, 0 disables it), mirroring `http.body_limit`, and the error names it as a human-readable size (`64.0MiB`) instead of a raw byte count. Tests: unit tests for the bound; servers-crate tests driving it end to end against the OTLP double (default, configured, unbounded, and bound before quota); tests-integration coverage through the real line-protocol pipeline; config-loading assertions and the regenerated config docs. Signed-off-by: Ning Sun <sunning@greptime.com> * test(integration): add max_copy_in_payload to the config dump snapshot GET /config serializes the new postgres.max_copy_in_payload option, so test_config_api's expected TOML needs its line (ReadableSize renders in binary units: 64MiB). Signed-off-by: Ning Sun <sunning@greptime.com> * fix(postgres): require explicit zero to disable COPY payload limit Signed-off-by: Ning Sun <sunning@greptime.com> --------- Signed-off-by: Ning Sun <sunning@greptime.com> |
||
|
|
6ccf4d9341 |
fix(meta): honor user providers for admin endpoints (#10774)
* fix(meta): honor user providers for admin endpoints Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(meta): authorize admin operations through permission checker Signed-off-by: WenyXu <wenymedia@gmail.com> * test(meta): cover admin HTTP authentication from configuration Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(meta): enforce admin authorization on matched plugin routes Signed-off-by: WenyXu <wenymedia@gmail.com> * fix: reject unregistered metasrv user providers Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com> |
||
|
|
464ccc3abd |
fix(postgres): account CSV and JSONL COPY memory (#10493)
* feat(postgres): Prometheus Remote Write protobuf ingest via COPY FROM STDIN COPY FROM STDIN WITH (FORMAT promwrite [, version 2] [, <options>]) ingests one Prometheus Remote Write request body over the postgres wire protocol — a GreptimeDB-specific, binary COPY format (wire format code 1). The payload is byte-for-byte the body a remote-write client POSTs to /v1/prometheus/write, compression included: buffered until CopyDone and completed through the exact ingestion core that endpoint runs. To share that core, the HTTP handlers' ingestion bodies are extracted into axum-free functions (ingest_remote_write_v1/v2 plus the context extension stamping), and the HTTP routes become thin wrappers — their behavior is unchanged, and the copy layer runs the identical decode, validation, conversion, batched/prepared write paths, per-batch write-progress accounting and context extensions, under the connection's regular postgres context. The WITH options carry what the HTTP endpoint takes as its content-type/-encoding and query parameters; session-provided values (database, user) are not repeated: - version 1|2 (default 1), matching the content-type's proto - zstd, matching Content-Encoding: zstd (snappy by default) - physical_table, matching the ?physical_table= parameter - pipeline_name/pipeline_version, matching the pipeline headers (v1 only; for v2 they are accepted and ignored, exactly like the HTTP route ignores them) Table-less like the other ingestion formats; one COPY statement is one bounded request (shared 64 MiB limit); the row count reports written rows (v1) or written samples plus histograms (v2). The flush enforces the frontend's shared request-memory quota (max_in_flight_write_bytes) — the same limiter the HTTP ingestion protocols use, so COPY cannot bypass the aggregate budget. Wiring: PostgresServer::with_prom_remote_write carries the handler, metric-engine flag, validation mode and shared memory limiter. e2e: v1 body chunked across CopyData boundaries; v2 samples with readback; physical_table option routing; garbage-body decode failure with connection reuse; a tiny-quota regression where a compressed body whose decompressed size exceeds the budget fails like the HTTP route. Signed-off-by: Ning Sun <sunning@greptime.com> * feat(postgres): jsonl COPY FROM STDIN via the arrow-json engine COPY tbl [(cols)] FROM STDIN WITH (FORMAT jsonl) ingests newline-delimited JSON objects through arrow-json's incremental Decoder — the same engine behind file-based COPY ... FROM 'file.json' — so both COPY routes accept identical data. One JSON object per record; keys address the targeted columns by name, absent keys become NULL, and offset-free timestamp strings parse in the session timezone (the same schema substitution the csv codec makes), like SQL INSERT. The streaming contract mirrors arrow-csv's exactly (decode returns consumed bytes; a short read means a full batch), so the parser is a twin of the csv one: objects may span CopyData chunk boundaries, records surface in COPY_IN_FLUSH_ROWS batches, and a trailing object without its newline is accepted. Table-bound like csv (a named table is required; the column list fixes the target order); no options (the file format's layout options are writer-side; the reader parses date-times natively). The two table-bound codecs share the table path through a small TableBoundCodec trait (check_column_type + create_parser); csv's behavior is unchanged. e2e: chunked object-boundary ingest with absent-key NULLs; session-timezone parity against SQL INSERT; malformed JSON failure with table-left-clean and connection recovery. Signed-off-by: Ning Sun <sunning@greptime.com> * fix(postgres): account CSV and JSONL COPY memory Signed-off-by: Ning Sun <sunning@greptime.com> * fix(postgres): keep table COPY progressing within its memory quota Signed-off-by: Ning Sun <sunning@greptime.com> * fix(servers): preserve COPY headroom across admissions and batch boundaries Signed-off-by: Ning Sun <sunning@greptime.com> * fix(servers): admit first streamed body frame without counting wait probes Signed-off-by: Ning Sun <sunning@greptime.com> --------- Signed-off-by: Ning Sun <sunning@greptime.com> |
||
|
|
10b6cf9477 |
feat(query): add windowed PromQL evaluation (#10797)
* feat(query): add windowed PromQL evaluation Signed-off-by: discord9 <discord9@163.com> * docs(query): clarify window allowlist and drop unused grid bound The public end_ms_exclusive duplicated point_ms(points) without a caller. max_input_range_ms stays public for the stacked sequence-probe cache. Signed-off-by: discord9 <discord9@163.com> * refactor(query): trim window docs and merge overlapping allowlist tests Apply review: state the allowlist in a few lines instead of arguing for it, drop doc that restates the code or another item's doc, and make max_input_range_ms private since nothing outside window.rs calls it. Collapse the allowlist tests into one positive table that asserts the source table and the input range per row, and one negative table that asserts NotEligible once per shape. The grid tests keep the point_ms(points) continuation the frontend cache relies on and gain the negative-start phase case. The differential test drops asserts implied by full == merged and the SumRate arm that re-derived the aggregate. Signed-off-by: discord9 <discord9@163.com> * docs(query): shorten window docs and cover sum(selector) in the differential Apply review: state the grid rule and the caller's duty in a few lines, point the selector helper at windowed_source_table instead of repeating its reasoning, and drop the doc that restates the GridSpec bound. Add sum(window_diff) as a fourth differential shape so the aggregate the allowlist admits over a bare selector is compared on both routes too. Make max_input_range_ms public again: the sequence-probe cache reads the input range to bound what a chunk depends on, and WindowGrid::of alone does not expose it. Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
8ea60a155c |
fix(promql): keep NULL rows of native instant selectors (#10762)
* fix(promql): keep NULL rows of native instant selectors A selector at the statement root dropped a selected row whose fields are all NULL, so native TQL answered nothing where the existing planner answers a NULL row, and an all-NULL series disappeared. The root selection now reports stored rows (InstantValue::Row); selections that feed functions, aggregations and binary operands keep dropping them. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * style: format the merge and document root selection precedence Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
4d44909217 |
feat(promql): read sub-millisecond file-engine time indexes natively (#10703)
* feat(promql): read second, microsecond and nanosecond time indexes natively The native route declined every selector over a time index that is not in milliseconds. The existing plan wraps such a scan in a cast projection, so the decline surfaced as selector_plan_is_not_a_table_scan, and the region's raw series preflight refused the unit as well. The raw series path now hands ticks over in the stored unit, and each raw input of the native tree records that unit. Evaluation keeps the existing plan's semantics: windows and lookbacks are decided on the stored ticks, a kernel reads the time truncated toward zero to milliseconds after the offset, and samples less than a millisecond apart remain distinct samples. Since every bound is a whole millisecond, deciding membership on ceil(tick) in milliseconds is exact, so the evaluators keep a window time beside the payload only for microsecond and nanosecond inputs. Scan filters are built in the stored unit. Histogram fields and range modifiers over a sub-millisecond time index still decline. The append-mode decline is kept and renamed to append_mode_table. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): decline a discovered selector over mixed time index units Logical metrics on different physical tables can store their time index in different units, while the union a nameless selector reads is one native input bound to one unit. The union took the first source's unit and read the other sources' ticks in it, so a series stored in microseconds next to one in milliseconds dropped out of its windows. Such a selector now declines. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): run native PromQL over file-engine tables File-engine tables have no raw series scanner, so the native route declined them and they fell back to the legacy planner. Read such a table through a new RowSeriesSource node: an ordinary scan, filtered by the selector's matchers and time range, hash-partitioned by tags and sorted by (tags, time index, fields), then cut into explicit-label raw series chunks with Float64 values. The node declares its input distribution and ordering, so the physical optimizer inserts the repartition and a spillable SortExec. It stays above the merge scan, so it runs on the frontend in both standalone and distributed mode. Rows sharing labels and a timestamp keep one sample, as Prometheus storage does: the row whose field values sort lowest (nulls last). Non-string tags and histogram fields keep the existing plan. The cluster test builder can now pass the local file sandbox to datanodes and install frontend-only plugins, so the distributed case is covered. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read file-engine tags as Prometheus label values A row source now reads every tag column as text with NULL read as '', so a NULL and an empty tag are one series from the start and an empty value carries no label, as in Prometheus. Rows of that series at one timestamp keep one sample by the existing rule. Matchers apply to the text form above the scan, so an integer tag matches "200" but not "0200". This drops the row_source_tag_is_not_a_string decline. The legacy planner fails on such a table with "Unsupported tag column type: Int64". Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read native histogram fields from file-engine tables A row source passes a native histogram field on as histogram samples, converted with the same histogram_samples_from_arrow the mito raw scan uses, instead of casting every field to Float64. This drops the row_source_reads_floats_only decline, so the fixture of the sqlness case promql/delta_exponential_histogram runs natively; the integration test mirrors its statements and answers. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read second-precision file-engine time indexes natively The existing scan plan already promotes a second-precision time index to milliseconds through a projection, which is exact. A row source now reads that projection instead of declining, and pushes the time range into the scan only when the scan's time index is in milliseconds. Microsecond and nanosecond time indexes still keep the existing plan. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): decline file-engine tables with a `__name__` tag column A row source dropped a tag column named `__name__` from its labels, sort key and partition key, so rows that differed only in that column merged into one series and lost samples. Mito's raw scan refuses such a tag. Decline it at planning time instead, and make RowSeriesSource reject the tag rather than filter it out. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): dedupe file-engine samples per field A row source reduced rows sharing labels and a timestamp to one whole row picked by the first field, so a NULL in another field of that row dropped the value a discarded row held there. Each field is its own value series: at a duplicated timestamp every field now keeps its own lowest non-null value (NaN above numbers, histograms by struct order). The sort key drops the fields, and the rows of the last timestamp of a batch are held back until the next batch, so every duplicated timestamp is reduced within one batch. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read microsecond and nanosecond file-engine time indexes natively A row source read its time index through the existing plan's cast to milliseconds, which truncates a finer one, so it declined microsecond and nanosecond time indexes. It now reads the column as stored, as the raw series scan does, and the input it feeds is bound to the time index's unit. Evaluation then follows the rules mito tables already have: windows and lookbacks are decided on the stored ticks, a kernel reads the time truncated to milliseconds, and samples less than a millisecond apart stay distinct. Histogram fields and range modifiers over such a time index decline as they do for mito. The time range is pushed into the scan in the stored unit for pruning. A second-precision time index takes the same path. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): decline every table with a `__name__` tag column The native route names each series it reads by its table and has no label to read a tag column named `__name__` as. Only file-engine tables were declined; a mito table with such a column ran natively and lost the column: two series that differ only in it came back as two rows with one label set, and `sum by (__name__)` folded them into one. The existing plan reads the column's values as the metric name instead. Such a schema has no Prometheus reading: a series has one `__name__`, and the table name already is the metric name. Decline it on every engine so the statement keeps the existing plan's answer. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): keep a window open until its last millisecond has been read A sample finer than a millisecond is placed in the window ending at the millisecond above it. A chunk that ends on such a sample has not read the rest of that millisecond, so treating that millisecond as settled closed the window before a later sample in the same millisecond arrived in the next chunk. Settle only up to the millisecond the last sample lies in, rounded down. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): select only an exact sample under a zero lookback A zero lookback admits only a sample exactly at the instant. The window time of a sample less than a millisecond before the instant rounds up to the instant, so the native selection picked it where the existing route returns nothing. Compare the stored tick with the instant when the lookback is zero, on the grid and anchored paths. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover zero lookback on microsecond and nanosecond file-engine tables A zero lookback selects only a sample stored exactly at the instant. A row source hands its time index over as stored, so a sample 0.5ms before the instant shares that instant's window time and was selected. The exact-match rule from the time index precision branch covers the row source as well; these cases pin it for file-engine tables in both precisions and check that legacy gives the same answer. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover a stale marker in the second field of a wide file-engine table A Parquet file-engine table with a microsecond time index and two DOUBLE fields: a row whose first field is valid and whose second holds a stale marker is selected on both routes, and a row stale in the first field is dropped on both, as the existing plan reads staleness from the first field only. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
2916062cc4 |
feat(promql): answer an instant query of a range selector natively (#10672)
* feat(promql): answer an instant query of a range selector natively An instant query whose root is a range selector, such as `x[5m]`, declined with matrix_root_without_a_grid. Prometheus and the existing plan answer it with the samples of the window, keeping their own timestamps and dropping stale markers. Those samples are exactly the points of a one-millisecond subquery over the same window at which the bare selector, read with no lookback, finds a sample. The planner now compiles such a root that way, reusing the subquery-root path, so `offset` and `@` place the window as they do for a subquery. A range query with a range-vector root still declines and fails as before. A zero-lookback instant selection now walks the samples instead of the grid points, and bounds its workspace by the sample count, so the fine grid costs no more than the samples it answers. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover the HTTP matrix of a native range selector root The instant query API now answers `x[5m]` on both routes with the same matrix, and a series with no sample in the window is omitted. The range selector finder also gets its own doc comment back. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): keep a range selector root's null rows and leave sub-millisecond windows to the existing plan Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): drop a range selector root's rows stale in any field Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): leave histogram range selector roots with an offset to the existing plan Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(promql): keep any-field staleness specific to range selector roots Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): answer histogram range selector roots with an offset natively Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): leave range selector roots over sub-millisecond time indexes to the existing plan A range selector root runs as a one-millisecond subquery with no lookback. On a microsecond or nanosecond time index, a zero lookback selects only a sample exactly on a millisecond, so a sample between two grid points would be missing from the window. Decline the rewrite there. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * style(promql): format the range selector root time unit decline Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
5d3e22ce93 |
refactor(promql): report a declined shape instead of planning it the old way (#10701)
* refactor(promql): refuse with the recorded cause A native decline fails the offer instead of silently planning the statement again with the existing planner. Preserve upstream statement, alias and time-index shapes. Signed-off-by: discord9 <discord9@163.com> * refactor(promql): remove the dist-planner replan and the stale gates that fed it A statement the native route was asked for is planned once. The second planning pass with the route off, the gate that decided it, the histogram-aggregate refusal that cannot trigger, and the fallback option veto are gone; an unknown statement extension is refused by name. Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
fe01aeec89 |
feat(promql): run native PromQL over metric-engine physical tables (#10678)
* feat(promql): merge raw series that share a label set Add SeriesRouting::RawLabelSet: a raw router that routes by Prometheus label set and merges every stored series of one label set into one series, samples chained by timestamp like Prometheus' ChainedSeriesMerge. At a timestamp several stored series hold, the sample of the smallest primary key wins; pieces of one stored key must still agree there. A RawSeriesSource can ask for this merge. The flag is frontend-only: the router is placed where the source's frames arrive, above the region scan without a distributed planner and above the MergeScan with one. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): run native PromQL over metric-engine physical tables A selector naming a physical table used to keep the existing plan. The logical tables on it key their series by __table_id and __tsid, so two of them with equal labels store two series that Prometheus reads as one. The selector now reads through a RawSeriesSource that merges equal label sets, in standalone and across regions. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): merge physical-table label sets only above the merge scan Standalone hands the region the logical plan without serializing it, so the label-set flag reached the region and plan_raw_series_source added a second RawLabelSet router there. That buffered every region's answer twice, and a region could resolve a shared timestamp from its own share of the keys. The dist planner now gives MergeScanExec the source with the flag cleared and keeps the router above the merge scan. Planners without a dist planner still merge above the region scan. A single-chunk label set also skips the merge workspace. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): let a live sample win over a stale marker in label-set merges At one timestamp, the label-set merge now keeps the first sample that is not a stale marker in primary-key order, so a stale marker from one logical table no longer hides another table's sample. This matches the legacy plan, which drops stale markers before collapsing timestamps. The same-key conflict check now covers every key at the timestamp, not only the key that sorts first. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(promql): skip the stale check for single-row timestamp groups Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
dca65604a9 |
feat(promql): answer an append-mode table, and any k for limitk (#10650)
* feat(promql): answer append-mode tables and any k for limitk The append-mode collapse compares raw ticks, so two distinct ticks inside one millisecond both survive and a same-tick tie keeps the last write. limitk picks its members by a hash of the label set with the label set as tie-break, so the membership no longer follows the order the inputs arrive in. Signed-off-by: discord9 <discord9@163.com> * test(promql): compare the golden limit cases by membership, not by pick Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
64943b35b6 |
feat(promql): read second, microsecond and nanosecond time indexes natively (#10671)
* feat(promql): read second, microsecond and nanosecond time indexes natively The native route declined every selector over a time index that is not in milliseconds. The existing plan wraps such a scan in a cast projection, so the decline surfaced as selector_plan_is_not_a_table_scan, and the region's raw series preflight refused the unit as well. The raw series path now hands ticks over in the stored unit, and each raw input of the native tree records that unit. Evaluation keeps the existing plan's semantics: windows and lookbacks are decided on the stored ticks, a kernel reads the time truncated toward zero to milliseconds after the offset, and samples less than a millisecond apart remain distinct samples. Since every bound is a whole millisecond, deciding membership on ceil(tick) in milliseconds is exact, so the evaluators keep a window time beside the payload only for microsecond and nanosecond inputs. Scan filters are built in the stored unit. Histogram fields and range modifiers over a sub-millisecond time index still decline. The append-mode decline is kept and renamed to append_mode_table. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): decline a discovered selector over mixed time index units Logical metrics on different physical tables can store their time index in different units, while the union a nameless selector reads is one native input bound to one unit. The union took the first source's unit and read the other sources' ticks in it, so a series stored in microseconds next to one in milliseconds dropped out of its windows. Such a selector now declines. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): keep a window open until its last millisecond has been read A sample finer than a millisecond is placed in the window ending at the millisecond above it. A chunk that ends on such a sample has not read the rest of that millisecond, so treating that millisecond as settled closed the window before a later sample in the same millisecond arrived in the next chunk. Settle only up to the millisecond the last sample lies in, rounded down. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): select only an exact sample under a zero lookback A zero lookback admits only a sample exactly at the instant. The window time of a sample less than a millisecond before the instant rounds up to the instant, so the native selection picked it where the existing route returns nothing. Compare the stored tick with the instant when the lookback is zero, on the grid and anchored paths. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): version the FusedSeries envelope for input time units Move BoundInput::time_unit out of the positional tree encoding and append the input leaves' units after the v1 payload as envelope v2. A v1 payload from an older build still decodes, with millisecond inputs. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): answer two selectors over different time units, and pin the mixed-unit decline reason Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): drop the retired series scan v2 switch from the mixed-unit case Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): expect the v2 FusedSeries envelope in the native prefix test Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): adapt the time-unit tests to upstream instant and discovery changes Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): name the mixed-unit discovery refusal as unsupported A native input carries one time unit, so discovery across physical tables with different time index units is refused. Answering needs a per-source rescale that changes the RawSeriesSource wire format; tracked in #10767. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
f824004131 |
feat(promql): segment native histogram folds above a split (#10675)
* fix(promql): declare float columns for a float function over a split histogram sum `histogram_count(sum(h))` and `histogram_quantile(0.9, sum(rate(h[2m])))` over native histograms failed to plan on the native route: the split counted the statement's value columns by the type of the exported state (a histogram), while the columns carry the root's kind (Float), so it counted zero and returned a plan error. Count value columns of either value type; the layout declares one kind for all of them. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): segment native histogram folds the split declines A single-input histogram tree whose fold the split could not carry - `sum(sum by (job) (h))`, `count(sum(h))`, `topk(1, sum by (job) (h))`, `sort`, `scalar` or `absent` over a fold, or a fold over a collapsing `label_replace` - declined to the legacy plan. Segmenting it is correct for histograms as it is for floats: the per-series prefix is cut into its own segment and the fold runs once over every segment's frames, so the gate is removed. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): assert the outer histogram fold runs natively above a split Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): assert the histogram fold reads frames from several partitions Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
d5fe65df3a |
feat(promql): run native PromQL over file-engine tables (#10680)
* feat(promql): run native PromQL over file-engine tables File-engine tables have no raw series scanner, so the native route declined them and they fell back to the legacy planner. Read such a table through a new RowSeriesSource node: an ordinary scan, filtered by the selector's matchers and time range, hash-partitioned by tags and sorted by (tags, time index, fields), then cut into explicit-label raw series chunks with Float64 values. The node declares its input distribution and ordering, so the physical optimizer inserts the repartition and a spillable SortExec. It stays above the merge scan, so it runs on the frontend in both standalone and distributed mode. Rows sharing labels and a timestamp keep one sample, as Prometheus storage does: the row whose field values sort lowest (nulls last). Non-string tags and histogram fields keep the existing plan. The cluster test builder can now pass the local file sandbox to datanodes and install frontend-only plugins, so the distributed case is covered. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read file-engine tags as Prometheus label values A row source now reads every tag column as text with NULL read as '', so a NULL and an empty tag are one series from the start and an empty value carries no label, as in Prometheus. Rows of that series at one timestamp keep one sample by the existing rule. Matchers apply to the text form above the scan, so an integer tag matches "200" but not "0200". This drops the row_source_tag_is_not_a_string decline. The legacy planner fails on such a table with "Unsupported tag column type: Int64". Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read native histogram fields from file-engine tables A row source passes a native histogram field on as histogram samples, converted with the same histogram_samples_from_arrow the mito raw scan uses, instead of casting every field to Float64. This drops the row_source_reads_floats_only decline, so the fixture of the sqlness case promql/delta_exponential_histogram runs natively; the integration test mirrors its statements and answers. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read second-precision file-engine time indexes natively The existing scan plan already promotes a second-precision time index to milliseconds through a projection, which is exact. A row source now reads that projection instead of declining, and pushes the time range into the scan only when the scan's time index is in milliseconds. Microsecond and nanosecond time indexes still keep the existing plan. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): decline file-engine tables with a `__name__` tag column A row source dropped a tag column named `__name__` from its labels, sort key and partition key, so rows that differed only in that column merged into one series and lost samples. Mito's raw scan refuses such a tag. Decline it at planning time instead, and make RowSeriesSource reject the tag rather than filter it out. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): dedupe file-engine samples per field A row source reduced rows sharing labels and a timestamp to one whole row picked by the first field, so a NULL in another field of that row dropped the value a discarded row held there. Each field is its own value series: at a duplicated timestamp every field now keeps its own lowest non-null value (NaN above numbers, histograms by struct order). The sort key drops the fields, and the rows of the last timestamp of a batch are held back until the next batch, so every duplicated timestamp is reduced within one batch. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): rank NaN of either sign above numbers and bound the held-back run in RowSeriesSource Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(tests): install frontend plugins only when set so rebuilt clusters don't share them Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
88e98e60ed |
feat(promql): answer timestamp() over multi-field tables natively (#10670)
* feat(promql): answer timestamp() over multi-field tables natively The native compiler refused `timestamp()` over an input with more than one value field, so these statements fell back to the existing planner. A row of a multi-field table is one sample: the existing planner reports one `value` column holding the row's time wherever any field has a value. The native route now does the same. `timestamp` over several fields declares a single field, and both the selector form (sample time) and the evaluated form (evaluation time) report the time where any field of the row holds a value. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): read a native instant's stale marker from the first field only Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
426e3030da |
feat(promql): answer aliased TQL statements natively (#10669)
* feat(promql): answer aliased TQL statements natively `TQL EVAL ... AS name` (also used by CREATE FLOW) wraps the expression in an alias extension that the native compiler rejected, so these statements always fell back with `no_kernel_for_the_statement_shape`. The native route now offers the aliased expression and projects its rows into the layout the existing planner publishes: the value column under the alias, the labels, then the time index, with no metric name column. Labels follow the existing planner's order: a `by(...)` list keeps the order it names, `without(...)` sorts the rest, and a binary operation follows its vector operand. An alias over more than one value column fails with the same error the existing planner reports. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): take the aliased label order from the existing planner The alias layout guessed the existing planner's label order from the root's shape, which is wrong for `topk by(...)` (keeps its input's order), `count_values` (appends its label after the grouping), and any call or unary wrapper around a `by(...)` aggregate. The order is a by-product of planning the expression (`ctx.tag_columns`), so plan the aliased expression on the existing path with the native route off and project the native answer into that layout. A native answer whose label set differs from it declines, and the multi-value error now comes from the same field count the existing planner checks. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): fall back when a native output column name collides Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
ef1d505c2e |
fix(operator): reconcile inserts with auto-created tables (#10718)
* test: cover writes that need columns missing from the target table Each case writes columns that the table it reaches does not have: - a gRPC write to a new mito table whose CREATE loses to a concurrent writer, held after the DDL executor's existence check; - the same for a logical metric table, where the winner uses a nanosecond physical table and the losing write selected a millisecond one; - one gRPC batch with three entries for one new logical table and overlapping new tags; - one gRPC batch with two entries that need different new tags on an existing logical table; - an Elasticsearch _bulk request whose third document adds a field. Signed-off-by: dayan02dev <pawarudayan92@gmail.com> * fix(operator): check every auto-create request against the created table create_or_alter_tables_on_demand planned one CREATE for each request whose table was missing, and never checked the requests against the table that existed after the CREATE: - repeated entries for a new table in one batch sent one CREATE each. The later ones returned the first table without their columns, and repeated logical table names allocated several table IDs; - a CREATE that lost to a concurrent writer returned its own schema with the winner's table ID, so rows were converted against columns the region does not have; - a logical CREATE that lost returned the winner's table, but only tables found during planning were altered. Now the first request for a missing table defines its CREATE. A mito table is read back from the catalog after the CREATE, as logical tables already are, and every request for it is checked against that table. Missing columns go into one AddColumns per table, including tables found during planning, because an ALTER LOGICAL TABLES procedure reads each table once. Rows for a new logical table keep their timestamps until the table that exists is known, and are converted once. Signed-off-by: dayan02dev <pawarudayan92@gmail.com> --------- Signed-off-by: dayan02dev <pawarudayan92@gmail.com> Co-authored-by: dennis zhuang <killme2008@gmail.com> |
||
|
|
187facb58f |
feat(promql): let TQL discover metrics on the native route (#10674)
* feat(promql): let TQL discover metrics on the native route TQL statements never prepared a metric discovery scope, so the native route declined nameless and regex `__name__` selectors in TQL (`metric_discovery_unavailable`) and the legacy planner then rejected them, while the same query worked over the Prometheus HTTP API. SQL statement authorization now prepares the scope for the PromQL a statement evaluates (TQL EVAL/EXPLAIN/ANALYZE and TQL CTEs), keeping each discovered table that the statement's own permission request may read, and resolves the statement's table targets from the named tables plus that scope, as the HTTP path does. The returned context is the one the statement is planned with. A TQL CTE that discovers metrics publishes the native answer's columns: the legacy planner refuses such selectors, so there is no legacy schema to publish over it. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(frontend): pin TQL discovery to the statement's own permission request Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(query): plan a metric-discovering TQL relation natively once Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
007f9dea40 |
feat(promql): rate delta-marked native histograms natively (#10676)
* fix(promql): declare float columns for a float function over a split histogram sum `histogram_count(sum(h))` and `histogram_quantile(0.9, sum(rate(h[2m])))` over native histograms failed to plan on the native route: the split counted the statement's value columns by the type of the exported state (a histogram), while the columns carry the root's kind (Float), so it counted zero and returned a plan error. Count value columns of either value type; the layout declares one kind for all of them. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): pick OTLP delta math per series in native rate and increase rate and increase over a table that carries otlp_aggregation_temporality declined with delta_temporality_under_rate_or_increase. The existing plan picks the math per series: a series marked "delta" holds increments, so increase is the Kahan sum of the window and rate is that sum over the range in seconds, while every other series keeps the counter math. A range evaluator of rate or increase over raw input now checks each series' labels when it starts and evaluates a delta series with the sum kernel, outside the batch path. A rate or increase that reads its window directly is admitted; one that reads it through another expression, a histogram field, or a range modifier still declines. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover offset and @ for native delta rate and increase Pins the delta sum against the existing plan when the window is moved by `offset` or anchored by `@`, and puts the misplaced doc comments of `kernel` and `root_subquery` back on their functions. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): rate delta-marked native histograms natively `rate` and `increase` over a native histogram whose series carries the OTLP delta temporality marker declined to the legacy plan. The legacy plan sums the window only for float samples and rates a native histogram as a counter whatever its marker says, so the native window already answers the same thing: the delta kernel only ever reads floats. The decline now applies to float selectors only, both for a call that reads the selector through another expression and for a range modifier. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover OTLP delta exponential histograms under native rate The earlier case wrote counter-hinted histograms through remote write. OTLP ingest stores a delta point as a gauge-hinted histogram whose start timestamp is the previous point's end; rate and increase over that shape now run natively and agree with the existing plan. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): sum delta-marked evaluated series under native rate and increase A float derived from a delta-marked native histogram, such as `increase(histogram_count(h)[2m:1m])`, keeps the OTLP temporality marker. The existing plan picks the delta math off that marker and sums the window, but the native window over an evaluated series always used counter math, so the two routes disagreed (40 vs 55 in the new case). Pick the delta kernel for an evaluated series the same way as for a raw one. Histogram windows still go through the histogram rules, which ignore the marker on both routes. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(query): drop the unreachable range-modifier delta decline The native planner declined `rate`/`increase` over a delta-marked raw input when its window carried an anchored or smoothed modifier. Nothing in the query crate builds a `RangeModifier`, and promql-parser 0.10.0 does not parse either modifier, so the branch never ran. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): pin absolute values for native OTLP delta histogram rates The OTLP delta histogram test only compared the native route with the existing plan. Also assert the values the Prometheus formulas give for `histogram_count(increase(h[2m]))` (30 and 55) and for the subquery over `histogram_count` (55). Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(promql): decide batch eligibility for a delta window in one check Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(query): run delta-marked float subqueries under native rate and increase `increase(m[2m:1m])` and `rate(m[3m:1m])` over a delta-marked float series declined to the existing plan, because the native window over an evaluated series used counter math. That window now picks the delta math from the marker its series keeps, as the existing plan does, so the decline and the `under_rate_or_increase` flag the selector walk carried for it are removed. The OTLP delta corpus test asserts both queries run natively, match the existing plan, and sum the window's deltas (divided by the range for `rate`). Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
b4f8bc2263 |
feat(promql): split rankings and rewrites above a fold, refuse an empty count_values destination (#10720)
* fix(promql): answer rankings above a fold, topk splits and label rewrites
topk and bottomk above a global aggregate used to be refused and silently
answered by the legacy path; they now split into a producer over raw samples
and a final fold that ranks the merged state. A label rewrite no longer loses
the operand, an empty discovery is answered instead of refused, and
count_values("") keeps its empty label instead of panicking.
Signed-off-by: discord9 <discord9@163.com>
* fix(promql): reject an empty count_values destination on both routes
Prometheus rejects an empty label name at evaluation, and our legacy planner
accepted it, so the two routes disagreed. The destination is now checked on
the existing path too, with the same message the kernel already emits.
Signed-off-by: discord9 <discord9@163.com>
* test(promql): drop the admission case an integer field no longer declines
The route answers integer fields as Float64 since #10668, so the matrix
asserting they stay out of it describes a contract the base no longer has;
native_fused_numeric_fields_answer_float64 covers the same shapes.
Signed-off-by: discord9 <discord9@163.com>
---------
Signed-off-by: discord9 <discord9@163.com>
|
||
|
|
dc683ebe14 |
feat(auth): make table permission checks schema-aware and guard flow … (#10708)
feat(auth): make table permission checks schema-aware and guard flow sink creation Signed-off-by: shuiyisong <xixing.sys@gmail.com> |
||
|
|
c573f9e87c |
feat(promql): answer integer fields natively as Float64 (#10668)
* feat(promql): answer integer fields natively as Float64 The native PromQL route declined statements whose legacy plan publishes an integer field's own type (bare selectors, sum over integers, count, count_values) with `field_keeps_its_own_type`. In Prometheus every sample is a float64, and the raw series scan already casts numeric fields to Float64, so the native route now answers these shapes with Float64 values instead of declining. Integer samples are cast before any fold, so a sum of integers beyond 2^53 follows float64 arithmetic, as Prometheus does. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): check the existing plan sums the large integers exactly Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
6ffb0ec793 |
feat: answer scalar COUNT on Mito from SST metadata (#9891)
* feat: answer scalar COUNT on Mito from SST metadata Behind `experimental_metadata_aggr` (off by default), ScanHintRule marks an ungrouped scalar COUNT directly over a Mito scan. Mito then proves the scan's row count without reading SST data. Every file intersecting the query time range must be covered by the static predicates and have a known manifest row count. In deduplicating regions it must also share no (time, primary key) point with another file or a memtable, and its `__op_type` Parquet statistics must show no deletions. The statistics are read through the SST metadata caches, only for files that pass the manifest checks. RegionScanExec publishes the proven count as exact statistics, which lets DataFusion replace the scan with a literal. Other scans are unchanged. Overlaps are found with one time sweep over a segment tree of compressed primary key bounds, in O(N log N). The pairwise check remains as the test oracle and benchmark baseline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito): cover metadata COUNT and address core review Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito): match metadata aggregate fixture region IDs Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): prove SST row counts before publishing exact statistics Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): add SQLness coverage for the SST footer marker Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): verify tightened partition bounds and source estimates Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): keep lazy footer reads sendable Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): use valid sequence fences and SST owners Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): validate SST key bounds before metadata count Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): verify SST time bounds before metadata count Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): own SST inputs to asynchronous bound checks Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): match displayed scan names in COUNT fallback Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): keep SST replacements coherent with metadata counts Signed-off-by: aumnertic <aumnertic@gmail.com> * refactor(cmd): reuse the replacement SST reader during validation Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): verify listed SST sizes against object storage Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): keep metadata count proofs within the SST read set Signed-off-by: aumnertic <aumnertic@gmail.com> * docs(mito2): use the actual scan memory limit key Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): gate metadata counts on trusted SST dedup markers Record the provenance of engine-written dedup markers in the manifest. Clear it for external imports and preserve it during internal transfers. Require this proof for metadata counts over non-append multi-row SSTs. Keep the live file metadata consistent when an import supersedes a background publication, and cover checkpoint downgrade and reopen. Signed-off-by: aumnertic <aumnertic@gmail.com> --------- Signed-off-by: aumnertic <aumnertic@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
89990fa715 |
fix(promql): preserve precision in native histogram range sums and av… (#10657)
* fix(promql): preserve precision in native histogram range sums and averages Signed-off-by: shuiyisong <xixing.sys@gmail.com> * test(promql): cover avg_over_time overflow before histogram downscale Signed-off-by: shuiyisong <xixing.sys@gmail.com> --------- Signed-off-by: shuiyisong <xixing.sys@gmail.com> |
||
|
|
4d8e55909a |
feat(promql): fold native histograms over multi-input trees natively (#10677)
* feat(promql): fold native histograms over multi-input trees natively A histogram statement reading more than one selector through raw sources declined as soon as it needed placement, so `sum(h1 + h2)`, `sum without (instance) (h1 or h2)` or `histogram_count(sum(h1 + h2))` ran their fold on the legacy plan. Such a tree is segmented like a float one: each operand's per-series prefix publishes frames, and the fold runs once above all of them with histogram state. A bare vector-vector pairing of histograms keeps the composed plan, one frame per operand. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): run histogram pairs over raw sources natively Drop the gate that sent a vector-vector histogram pairing to the composed binary route. Evaluated as one node over both raw sources, `h1 + h2`, `sum(h1 + h2) * 2` and their kin answer the same values, so the gate only fixed a plan shape. The tests that pinned that shape now assert the pairing and its answer instead, and two stale comments say what the kind walk and the segment gate actually do. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): pin that a histogram pair reads both raw sources With the pairing gate restored, the composed route still roots a Binary with the same fills and columns, so the test passed either way. Assert that each operand is an instant selection over its own raw source, which only the single-node route builds. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
9fc061d125 |
feat(promql): apply OTLP delta math per series in native rate and increase (#10673)
* feat(promql): pick OTLP delta math per series in native rate and increase rate and increase over a table that carries otlp_aggregation_temporality declined with delta_temporality_under_rate_or_increase. The existing plan picks the math per series: a series marked "delta" holds increments, so increase is the Kahan sum of the window and rate is that sum over the range in seconds, while every other series keeps the counter math. A range evaluator of rate or increase over raw input now checks each series' labels when it starts and evaluates a delta series with the sum kernel, outside the batch path. A rate or increase that reads its window directly is admitted; one that reads it through another expression, a histogram field, or a range modifier still declines. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover offset and @ for native delta rate and increase Pins the delta sum against the existing plan when the window is moved by `offset` or anchored by `@`, and puts the misplaced doc comments of `kernel` and `root_subquery` back on their functions. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(promql): decide batch eligibility for a delta window in one check Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
86a81cc91d |
fix: pre-encode sparse primary keys for exemplar and SQL writes (#10625)
* fix: pre-encode sparse primary keys for exemplar and SQL writes Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: preserve sparse write guards and WAL policy Signed-off-by: shuiyisong <xixing.sys@gmail.com> * perf: skip sparse key decoding on initial routing Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: preserve sparse primary key order across upgrades and repartitioning Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: reject exemplar writes without destination preflight Signed-off-by: shuiyisong <xixing.sys@gmail.com> * test: compact sparse partitions before merging Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: clippy Signed-off-by: shuiyisong <xixing.sys@gmail.com> * test(compat): drop git-commit version constraint Signed-off-by: shuiyisong <xixing.sys@gmail.com> * refactor: simplify sparse write and exemplar paths Signed-off-by: shuiyisong <xixing.sys@gmail.com> * refactor: remove sparse key order check Signed-off-by: shuiyisong <xixing.sys@gmail.com> --------- Signed-off-by: shuiyisong <xixing.sys@gmail.com> |
||
|
|
fe4c603ea8 |
refactor(mito2): retire Parquet series and range indexes (#10709)
* refactor(mito2): retire Parquet companion indexes and two-phase series scans Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): read native series files with SST lifetime pins Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): remove retired scan and cache plumbing Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): finish isolating Narthex scan preparation Signed-off-by: evenyag <realevenyag@gmail.com> * test(mito2): verify retries while a failed range reader is pinned Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito2): import the set used by Narthex partition filters Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito2): remove stale series scan errors and lint failures Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): centralize Narthex manifest paths Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito2): propagate per-series scan errors and account for buffered batches Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): use Narthex names for series-index maintenance Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): read Narthex samples through the owning SST handle Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): keep the original Parquet series distributor Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> |
||
|
|
9aebf3a821 |
fix(delete): route deletes using partition columns on value-partitioned tables (#10710)
fix(query,operator): retain partition columns when routing delete requests Preserve non-key partition columns across DataFusion DML delete projection and Deleter::trim_columns so RowSplitter evaluates partition expressions against the row's actual value rather than NULL, and cover trim_columns schema/row alignment in operator unit tests. Fixes #10705 Signed-off-by: Ömer <60585342+zaidrain06@users.noreply.github.com> |
||
|
|
3be82bd956 |
fix: parse csv numbers from text for BIGINT UNSIGNED and with skip_bad_records in COPY FROM (#10643)
* fix: parse csv numbers from text for BIGINT UNSIGNED and with skip_bad_records COPY FROM a csv file read a BIGINT UNSIGNED column with the inferred type, so 9007199254740993e0 went through a Float64 and lost its last digit, or turned into NULL when the column was inferred as a string. With skip_bad_records the DECIMAL and BIGINT UNSIGNED columns were read by Arrow's csv reader. It dropped the digits of a decimal beyond the scale, returned 0.00 for some numbers in scientific notation, and rejected 0e0 and unsigned integers in scientific notation, so those records were skipped. Both csv paths now read such a column as a string and parse it from its text, like the json path does. Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> * fix: parse numbers for the table type with skip_bad_records The skip_bad_records reader takes its column types from the table. The columns to parse from text were still chosen by the inferred type, so a BIGINT UNSIGNED column inferred as a boolean from a first value of true went back to Arrow's reader, and a later 9007199254740993e0 was skipped. Choose them by the table type there. Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> --------- Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> |
||
|
|
15ca57ca20 |
fix(promql): publish legacy columns for native TQL in CTEs and flows (#10666)
* fix(promql): keep the native name column out of TQL CTEs and flows The native rows layout always appends a per-row `__name__` column. The Prometheus HTTP response reads it, but two SQL-visible consumers took it as part of the statement's columns: - A hybrid CTE published it after the existing planner's columns, so `WITH t (ts, val) AS (TQL EVAL ... metric)` failed with a column count mismatch on the native route. - A TQL flow matched it against the sink table and failed with "found 4 flow output columns and 3 sink table columns". A CTE now publishes exactly the existing planner's columns over the native plan. A TQL flow plans its query with the native route off, like CREATE VIEW does, because its output columns are the sink table's schema and the native route also names value columns differently. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(flow): plan TQL flows on the native route with the existing columns The previous commit kept a TQL flow's sink schema stable by forcing the existing PromQL planner. Plan it like a TQL CTE instead: run natively and publish the existing planner's columns over the native plan. `LogicalPlanner::plan_relation` plans a statement whose columns are read by SQL. The CTE path and `sql_to_df_plan` both use it. The standalone test harness now starts the flow consistency check task, which `ADMIN FLUSH_FLOW` syncs with, so the flow test can run the flow and compare the sink table and rows with the existing route's. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): pair per-series columns by role when a TQL CTE or flow runs natively publish_legacy_schema paired the columns it could not match by name by type alone, so a series with two string labels left both label columns ambiguous and the statement fell back to the existing plan. Per-series outputs such as rate(), topk(), offset binaries and label_replace() over a table with more than one tag never ran natively in a CTE or a flow. Pair the time index by its marker, labels by name, and the remaining value columns in order, with the same casts as before. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test: start the flow check task only in the flow test The standalone harness started the flow consistent-check task for every instance. The task runs on the global runtime and holds the flow engine, and nothing stopped it, so it outlived the instance and each rebuild started another one. The harness now exposes the flow engine, and the flow test that needs ADMIN FLUSH_FLOW starts the task and stops it. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): check a two-field TQL CTE keeps each value column The native route pairs value columns with the existing ones by position. Two fields with different values make a swapped pair visible. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * style: format the two-field CTE test Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(flow): key a TQL sink table on every label of the answer The sink table of a TQL flow took its primary key from the innermost aggregate when the plan had one. In `m / scalar(sum(m))` that aggregate groups by time alone, so the labels of `m` were created as DOUBLE fields, written as NULL, and every series collapsed into one row per timestamp. The native route has no such aggregate and keyed on the labels, so the two routes created different sinks for the same flow. Every string column of a PromQL answer is a label of its output series, so the sink now keys on all of them on both routes. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(flow): keep writing a TQL sink that has the native __name__ column Before TQL flows were planned with `plan_relation`, a native TQL flow auto-created its sink from the native plan's own columns: the value named by that route, the labels, and `__name__` as a primary key column. The relation plan publishes neither, so such a flow failed sink validation and stopped writing. When the sink has a `__name__` column, plan the statement with `plan`, which is what these flows ran before. They keep writing the same columns and the same `__name__` values: the metric name for a selector, NULL where PromQL drops the name. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
c2a66803ff |
fix(mito2): read narthex tables partitioned on a non-tag column (#10665)
* fix(mito2): report one identity for a narthex series across regions Prepared narthex reads with explicit labels prefixed each series key with the region id. The prefix dates from when identity was the (table_id, tsid) hash and kept colliding series in different regions apart. Since #10330 the key is the exact sparse key, so the prefix protects nothing, but it still gives the fragments of one series in two regions different primary keys. SeriesRepartitionExec groups raw chunks by primary key, so those fragments never met in one owner: native PromQL returned duplicate series or failed with "input repeated an exact series identity" on a time-partitioned table. Use the exact key as the only candidate key and drop the separate merge key. The storage-api and raw chunk docs now require the identity to be the same in every region instead of allowing a region-qualified one. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): filter narthex rows by a non-tag partition rule A narthex scan applied the region's partition rule to series-index rows during discovery. Those rows carry tags only, so a rule on any other column, such as `PARTITION ON COLUMNS (ts)`, failed to compile against them, and every read of such a region failed with "Failed to coerce partition expr against the schema", in SQL and PromQL alike. Keep series-level filtering for rules that reference tags only. Apply any other rule to sample rows, with the series' own values for the tags the rule references, since a file shared after repartition can hold rows of both partitions within one series. Compaction reads without the region predicate, so this filter is the only thing that keeps the other partition's rows out of its output. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): check native reads of a time-partitioned narthex table Every series of a narthex table partitioned on the time index is split across two regions. Native PromQL over it, and SQL, must answer like the same rows held whole in one default-storage region, standalone and distributed. This covers both the partition rule on sample rows and the region-independent series identity that lets the frontend merge the fragments. The promql guide no longer claims that a series split across regions is not merged. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): value __table_id from the series in a sample partition rule A partition rule that mixes `__table_id` with a non-tag column, which repartitioning a metric table can produce, is evaluated on sample rows. The filter looked `__table_id` up among the series' tag values, where the series index never puts it, so every read of such a region failed with "missing partition tag". Take it from the series' table ID instead. The time-partition test now also covers a tag + time rule and a `__table_id` + time rule. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): say which sample conflicts across regions and why A raw merge that finds two different samples of one series at one timestamp now names the series and the timestamp, and gives the likely cause: a table partitioned on a non-tag column, with the sample written on both sides of a partition bound, so each region kept one version. Behavior is unchanged; the query still fails. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
95e69f80c3 |
fix(promql): plan a float function over a split native histogram sum (#10663)
fix(promql): declare float columns for a float function over a split histogram sum `histogram_count(sum(h))` and `histogram_quantile(0.9, sum(rate(h[2m])))` over native histograms failed to plan on the native route: the split counted the statement's value columns by the type of the exported state (a histogram), while the columns carry the root's kind (Float), so it counted zero and returned a plan error. Count value columns of either value type; the layout declares one kind for all of them. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
8d4e9464d9 |
feat(mito): store native histograms in narthex samples (#10667)
* feat(mito): store native histograms in Narthex samples A physical table whose single value field is the canonical greptime_native_histogram struct can now use sst_format = 'narthex'. The samples format gets column encoding 8, which lays out a block's histogram field child by child: each struct child is encoded with the nullable XOR codec of encoding 5, integers ZigZag-mapped, and a list as its nullable lengths followed by its flattened items. The chunk header names the child count and child kinds, the manifest records the field type as "native_histogram", and a block whose field chunk encoding does not match its manifest type is rejected. Writers and bulk memtable parts cut a block before a histogram chunk's size bound would pass the 1 MiB chunk limit, and a Narthex region rejects a sample that cannot fit one chunk before accepting the write. The prepared columnar reader now serves histogram fields, so native PromQL raw scans read Narthex histogram regions; float-only projections still skip histogram chunks. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(mito): cover Narthex histogram bulk limits and sidecar reads Add tests for paths the histogram change relies on but no test pinned: the bulk write path refusing an oversized histogram sample before WAL and memtable, the bulk memtable splitting large histograms into blocks whose chunks stay within the samples chunk limit, and native PromQL reading histograms from a columnar series-index sidecar on a Parquet metric table, compared with the plain Parquet answer. Also wrap three long lines in the samples format doc. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * docs(mito): state that the block size formula does not bound histogram buffers Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito): release read-ahead before failing a histogram reservation Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * docs(mito): pin the native histogram chunk layout and child order Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito): check bulk histogram sizes after filling missing columns Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
59b108af84 |
fix(procedure): recover from the last readable checkpoint (#10612)
* fix(procedure): recover from the last readable checkpoint Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(procedure): keep unreadable checkpoints out of GC checks Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(procedure): use the SNAFU selector for corrupt checkpoints Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com> |
||
|
|
0127d63865 |
fix(mito2): require a region to own its files before a remap (#10646)
* fix(mito2): require a region to own its files before a remap A remap (split or merge) moves file references between regions. Today mito2 checks only that the inputs come from the same table, so a merge can be applied while a participant still holds files another region created; a later compaction then materialises a copy of the same rows and both references survive the file-id dedup, so the merged region reads those rows twice. Reject such a remap instead: every participating region must hold only files whose creation expression equals that region's own partition expression. The error names each offending (region, file, creator expression) so the caller can compact the region and retry. A one-source-to-many-targets split is exempt: no target combines file sets there and the region predicate keeps a split's rows apart. This trades a merge-time error and a compaction for the per-reference row range that #10616 adds. Signed-off-by: discord9 <discord9@163.com> * fix(mito2): treat a file without a recorded creator as the region's own Files written before the partition expression was recorded carry no creator, so their provenance cannot be established and the read path does not narrow them either. The merge guard compared such a file against the region's expression and rejected it, which would break the first repartition of an upgraded table. Also state the remedy as it is: the operator aborts the repartition, compacts and retries; nothing triggers that compaction automatically, and a region in a staging session is skipped by the compaction scheduler, so the abort comes first. Signed-off-by: discord9 <discord9@163.com> * fix(mito2): report only the region and file that a merge must settle The refusal does not need to restate either partition expression: the operator acts on the region, and no production caller parses the message. Drops the expression rendering and its now unreachable None arm. Signed-off-by: discord9 <discord9@163.com> * docs(mito2): drop the comments the trimmed diagnostics left behind Removes the orphaned renderer doc, stops the unit-test comment from promising creator diagnostics, describes the error payload as it is, and corrects the claim that a creator-less file is not narrowed on read. Signed-off-by: discord9 <discord9@163.com> * fix(mito2): reject an unstamped file on merge, and bound the refusal message An unstamped SST can still hold rows of both children of an earlier split, so letting it through a merge re-admits the duplicate: both children inherit it, one compacts into its own file, and the merged region then holds the same rows under two file ids. A split stays exempt, so an unstamped table can still repartition; its regions materialise (compaction stamps the output) before merging. Lists at most eight offending files and counts the rest, so a wide table cannot produce an unbounded message. Signed-off-by: discord9 <discord9@163.com> * fix(mito2): check merge ownership before the target routes are published The remap-time guard fires while fetching manifests, which the procedure does after UpdateMetadata::ApplyStaging has published the target write routes: a reused target can acknowledge a write that the rollback then routes elsewhere, and the row is flushed later under the old expression. Move the decision ahead of publication. Every incoming edge to ApplyStaging now asks each merge source leader, through RemapManifest with a validate-only flag, whether every file it holds records its own expression; the check reads the ordinary manifest, writes nothing and leaves the region out of staging. A refusal therefore keeps the old routes in force. The flag is serde-defaulted, so an older datanode ignores it and its ordinary remap is refused because the region is not in staging - a failure, not a silent pass. The remap-time guard stays as the second line of defence. The failure now reaches the SQL caller with the offending region and file: Collect keeps the sub-procedure errors instead of only their counts. Signed-off-by: discord9 <discord9@163.com> * fix(meta-srv): keep the refusal's cause and its retryability Collect formatted the child failure with Display alone, so ProcedureExec's "Failed to execute procedure" hid the region and file the operator needs; render the whole source chain instead, and assert in the test that the parent error names a known region and file. A mailbox timeout on the pre-publication check became a terminal "compact the region" error, although metasrv treats the timeout as retryable. Propagate anything whose retry hint is retryable, and build the offender list - and its compaction advice - only from non-retryable failures. Signed-off-by: discord9 <discord9@163.com> * fix(mito2): use one predicate for merge ownership at both stages Preflight skipped every single-source group, while the remap guard exempted only a one-to-many mapping: a one-to-one repartition could therefore be refused after the target routes were published. Both stages now read the same rule from the persisted mapping - a group needs the check iff some target is fed by two or more distinct sources - expressed once in store-api and used by the preflight and by is_split. A one-to-one repartition hands its target one source's files and combines nothing, so it is exempt at both stages instead of being refused late. Signed-off-by: discord9 <discord9@163.com> * test: materialise before merging in the repartition integration tests Both tests merge regions that still reference an SST written by an ancestor, which the merge guard refuses. Compact with the strict-window mode first - it rewrites even a lone inherited file - and keep the merges they were written for. Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
c887958b03 |
Merge commit from fork
Add query.remote_allowed_hosts and query.allow_server_credentials to frontend, datanode and standalone. - query.remote_allowed_hosts: when set, object stores built from SQL statements send every request, including credential requests, through an HTTP transport that only allows the listed hosts and does not follow redirects. Blocked requests are logged with their host and port. - query.allow_server_credentials = false: an object store without credentials in its connection options cannot use the server's own credentials. Independent of the options, explicit credentials are validated: incomplete S3/OSS key pairs, an S3 session token without keys, an Azure account key without a known account name, and a GCS credential that is not a service account key are rejected. Only the type, private key and client email of a GCS service account key are passed to the signer. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
82dec23d17 |
fix(query): prune logical metric scans by table ID (#10645)
* fix(query): prune logical metric scans by table ID Signed-off-by: evenyag <realevenyag@gmail.com> * perf(query): skip redundant single-region metric pruning Signed-off-by: evenyag <realevenyag@gmail.com> * perf(query): skip table ID pruning for tag-only metric routes Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> |
||
|
|
686005c2c9 |
feat(mito): build native series indexes with certified time-window coverage (#10615)
* feat(mito): stream exact sample keys into native PoC series files Signed-off-by: evenyag <realevenyag@gmail.com> * feat(mito): evaluate native series window frontiers in the pinned scan Signed-off-by: evenyag <realevenyag@gmail.com> * feat(mito): publish native window builds through serialized region edits Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): validate full index coverage across publication and recovery Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): repair incompatible native indexes and isolate sidecar capacity Signed-off-by: evenyag <realevenyag@gmail.com> * test(mito): fill the sidecar budget in native repair coverage Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito): remove source file IDs from native series indexes Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): release memtable snapshots before native index I/O Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): preserve local sidecar source list encoding Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): expose Narthex series entry to production writer Signed-off-by: evenyag <realevenyag@gmail.com> * feat: build incremental Narthex series indexes from manifest coverage Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): reuse series indexes across compatible schema changes Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito): simplify native series index coverage and publication Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito): require a window for native series indexes Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito): remove tag rename handling from series index reads Signed-off-by: evenyag <realevenyag@gmail.com> * feat(mito): batch native series index builds by uncovered file count Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): configure the native series index file threshold via TOML Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> |
||
|
|
83dd79491a |
fix: honor LIMIT when copying a table to a file (#10639)
* fix: honor LIMIT when copying a table to a file Signed-off-by: Alex <alex.castillog33@gmail.com> * test: verify zero-row COPY CSV output Signed-off-by: Alex <alex.castillog33@gmail.com> * style: format COPY LIMIT regression setup Signed-off-by: Alex <alex.castillog33@gmail.com> --------- Signed-off-by: Alex <alex.castillog33@gmail.com> |
||
|
|
51082c6d4e |
feat(promql): answer the shapes the native route refused for want of a rule (#10611)
* feat(promql): answer the shapes the native route refused for want of a rule Three refusals in the native fused route were admissions, not missing capability. Each is answered here against main's own structure. **Grouping by `__name__` over several sources.** A tree reading more than one named source could not report the label a `by (__name__)` keeps, because only a discovered source declared it. Every metric-bound input now declares its name as a source tag when the tree reads more than one, and the two refusals that guarded this - in the planner and in `segment_tree` - are gone with `groups_by_metric_name`. **A `__field__` matcher over an input with no table.** The matcher names the only field layout such an input can declare, so it answers an empty frame of that field. An operator other than `=` stays refused: it asks what set of fields the tables carry, and there is no table to ask. **A canonical merge over a partitioned table.** `per_source_inputs` now covers `any_partitioned && contains_canonical_merge`, so the boundary's producer runs above the regions and reads a raw-series source instead of a bare scan, which is what the distributed planner already does. Two smaller rules complete the kind walk: `output_field_kind` covered Window, Instant, Map, Binary and Aggregate and fell through for the rest, so a statement rooted at a vector operation, `info` or a parameterized map named no kind at all - each answers a kind already written one arm away, and the catch-all is gone so a variant added later has to be classified. A comparison between two different kinds produces no sample (`elem_binop` skips it), so its column is the empty float layout the arithmetic arm already names. Finally, a value field is classified by what the raw series scan produces rather than by its catalog type, and admitted where the statement's shape makes the existing planner publish `Float64` for it too: arithmetic, `min`/`max`, the float-answering aggregates and the range functions whose value window is a float. A `BIGINT` table's `sum(m)` and its bare `m` stay refused - DataFusion's `sum` answers `Int64`, and a bare selector copies the column's own type, so admitting either would publish a column the existing plan publishes differently. Signed-off-by: discord9 <discord9@163.com> * test(promql): pin a whole-vector operator standing on an aggregate The kind walk now names what a vector operation answers, so a ranking over an evaluated aggregate plans on this route - and the split declines it, which keeps the route rather than losing it: `split_aggregate` answers `None` and segmentation takes the whole statement. Both facts are load-bearing enough to pin. The plan-level test asserts a fused node and no final split for `topk`, `bottomk`, `limitk`, `limit_ratio` and `sort` over an aggregate, with a bare-scan control; the integration test compares the rows the two routes answer for the shapes both of them can run, and inspects the plan that actually executed to confirm the ranking sits above the evaluated input. Signed-off-by: discord9 <discord9@163.com> * fix(promql): an integer fold is not a float once something casts it The numeric admission asked what type the existing plan publishes for a field, and read every arithmetic operator as publishing `Float64`. That is true of the operator, not of what it wraps: `sum(v) * 1` over `BIGINT` sums the integers first and casts afterwards, so `9007199254740993` and `-9007199254740992` answer `1.0` there, while the raw scan casts each value before summing and answers `0.0`. Admitting that shape would have answered a different number. An arithmetic operator now publishes a float only when the fold under it does too. `sum(int_field) * 1`, `sum(int_field) + 1` and `count(m) + 1` keep the existing plan; `sum(rate(m[5m]))`, `m * 2` and the aggregates that answer a float of their own stay native. The series-scan preflight refused the raw path for every field of an ordinary table whenever the store was configured columnar, and nothing above could turn that refusal into a fallback, so a query `main` answered with 40 became a planning error. Only the prepared columnar reader is gated now: a table whose region needs preparation keeps the refusal, and one that merely lacks columnar coverage is served by the ordinary scan. The test that pinned the error is replaced by one that pins the answer: a columnar-configured store over ordinary `INTEGER` and `FLOAT` tables answers `sum_over_time` and `avg_over_time` from the ordinary scan, equal to the existing route. Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
22807a772e |
perf(promql): stop building label-set tables where they cannot collide (#10514)
* perf(promql): stop building label-set tables where they cannot collide Signed-off-by: discord9 <discord9@163.com> * fix(promql): let a canonical merge sit below a split aggregate Signed-off-by: discord9 <discord9@163.com> * test(promql): identify native pieces by what they read, not by rendered text Signed-off-by: discord9 <discord9@163.com> * perf(promql): judge a metadata drop by its labels alone The plan-time proof of whether two series can share a canonical label set asked two things: whether the labels tell them apart, and whether the scan's key columns do. The second half was defensive against storage series that differ only in a nullable tag holding NULL versus an empty string, which canonical comparison already treats as one label set. Every tag column of a metric-engine table is nullable, so that half was false for ordinary tables, and a root merge was inserted above point-wise shapes that cannot fold two series at all. A deep binary was cut into pieces by it, and a disjoint scan went from two routers to four. Judge the drop by the labels only. The physical partition-identity rule keeps its own copy of the key-column question; the plan no longer reads it, and a scanner whose pieces one storage series can reach is still collected under its primary key before any name-dropping kernel sees them. Signed-off-by: discord9 <discord9@163.com> * test(promql): admit a histogram fold on a nullable table, name the risk counter The fold-admission test ran on a stable-key fixture, which hid that the shapes it names decline on a nullable one; run it on the metric-engine fixture instead. A drop above a fold needs no collection there, which a new test pins. Rename what the plan could not prove from "skipped" to "unproved" throughout, including the test hook, now that the counter counts that rather than a collection. Signed-off-by: discord9 <discord9@163.com> * fix(promql): a kernel that answers one series per label set proves the drop above it `100 * (1 - avail / size)` kept a canonical merge above its vector-vector match. The match already files its rows by the result label set and refuses two values of one field at one point, so the broadcast above it removes a name no two of its series were told apart by; judging that drop by its sources alone got it wrong. A fold, a match between two vectors, a set operation, `info`, `count_values` and the histogram functions answer one series per label set by construction, and the proof now says so. A merge is deliberately not one of them: it answers one series per *canonical* label set, which still carries the name, so a drop above it can fold `a{job="x"}` and `b{job="x"}` and must be collected. With the proof fixed, the ranking case no longer collects between the fold and the sort, so the test that pinned the old shape now reads the fold inside the ranking's own tree. Signed-off-by: discord9 <discord9@163.com> * test(promql): a fold may plan as a collected split With the drop judged by its labels alone, `sum(label_replace(...))` no longer keeps a collection above the fold, so the fold plans as partial state per partition with the canonical merge below it instead of a complete aggregate over assembled series. The rows, the legacy comparison and the cross-partition collision all stay the same, so the three assertions that pinned the complete shape now accept either, and check that the merge is still there. Signed-off-by: discord9 <discord9@163.com> * fix(promql): derive a window's labels as the runtime drops them A window that drops the metric name removes every metadata label at runtime (`__name__`, `__type__`, `__unit__`), but the plan derived only `__name__` as gone. A fold above such a window was therefore judged unproved - it could still see a `__unit__` the runtime had already removed - and collected a canonical merge. That merge made the segment non-commutative with a bare scan under it, so the admission gate declined the whole statement and it was quietly replanned as legacy. Derive the labels the runtime leaves behind instead. The test that pinned the old derivation now says both things it was covering: a scan that still carries `__type__` is still collected, and a map that already removed it is not. Signed-off-by: discord9 <discord9@163.com> * test(promql): a single-metric drop needs one fused node, not two With the drop judged by its labels alone, `histogram_arithmetic * 2` on a single-metric table needs no root merge, so the statement runs as one fused node instead of a producer and a consumer. Accept either count and say why. Signed-off-by: discord9 <discord9@163.com> * fix(promql): report a cross-partition label-set collision instead of folding it A label rewrite that gives two series one label set is collected by a canonical merge, and a split keeps that merge inside its per-partition prefix. Two colliding series that landed in different partitions were therefore each folded apart, and the state router added the two partial states - a value no label set ever stood for - where Prometheus reports `vector cannot contain metrics with the same labelset`. Refuse the split across a canonical merge, in `split` and in `admit_prefix`, so the statement takes the boundary shape instead: each partition's producer collects what its own scan holds, the canonical router routes every piece of one label set to one owner, and the fold above reads whole series. Two colliding series are then reported wherever they were scanned. A discovered selector is a union of one source per metric, so a segment over it already reads frames that name their own metric: accept it in `build_evaluated_segment` the way `build_inner_segment` already does, which keeps `{host="a"}`-style selectors from declining once the split no longer carries them. A histogram fold above a boundary has no execution on this route (only the split's state carries one), so those statements keep the plan they have on `main`; the existing route reports their collision through its window function. Signed-off-by: discord9 <discord9@163.com> * docs(promql): the drop chain pays one merge, not the key columns The example claimed the merge was paid over a table whose key columns can spell the `NULL`/`''` pair. That pair is not part of the labels' proof any more, so no merge is paid for it: the merge in the example is the one the chain's first drop pays, and every drop above a merge asks only about the metadata labels. State that instead of a cause that no longer exists. Signed-off-by: discord9 <discord9@163.com> * test(promql): keep the pair the labels cannot prove apart The window test asked the pass for a metric-less selection, so the collection it asserted was paid for by the multi-metric guard rather than by the pair the test is about. `zone=""` and an absent `zone` meet after `rate` even when the metric name is known, and #10412 caught that with a node-level occupancy tracker. That tracker is gone here: the drop is judged by the labels alone, and the empty value a kernel also removes is deliberately outside that proof - collecting it would put a canonical merge over every statement whose kernel drops the metadata labels. The pair therefore leaves the window as two pieces of one label set, which the PR description records under "What this gives up" and "Out of scope". The case is restored as the shape #10412 approved and marked ignored with that reason, so the behaviour it pins stays in the record instead of being dropped again; the metric-less case it had replaced is kept as its own test. Also drops a disjunct `is_sourced_plan` already covers. Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
1110a0af36 |
fix(meta): preserve table column order and primary key indices during reconciliation (#10251)
* fix(meta): preserve table column order and primary key indices during reconciliation Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * fix(meta): address maintainer review on column order and PK validation during reconciliation Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * style(meta): simplify nested if blocks in reconciliation utils Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * test(meta): use OutputData::pretty_print for SHOW CREATE TABLE verification Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * test(meta): drop unused mut in reconcile_table integration test Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * test(meta): make reconcile SHOW CREATE TABLE assertion formatting-tolerant Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * test(meta): cargo fmt reconcile assertion Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * test(integration): parse quoted SHOW CREATE output in reconcile test Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * style(tests): rustfmt reconcile_table SHOW CREATE assertions Signed-off-by: Tyagiquamar <104281681+Tyagiquamar@users.noreply.github.com> Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * style(tests): fix clippy collapsible str replace in reconcile_table Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * fix(meta): address reconcile_table review on tests and docs Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * test(integration): fix q8 SHOW CREATE TABLE assertion with check_output_stream Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * fix(meta): take reconcile primary key order from the region tags build_table_meta_from_column_metadatas preserved the stale table_meta primary key order, so a consistent reconcile kept the post-ADD-COLUMN key (a, b) instead of restoring the regions' [b, a] and a later UseMetasrv SyncColumns rewrote the region key over SSTs encoded with the old order. The key order now follows the input tags, which the reconcile paths feed in region key order; the ResolveColumnMetadata consistent branch re-applies reorder_tag_columns so the region's key must match its tag columns. Column order still comes from table_meta for #10249. cargo test -p common-meta reconciliation: 41 passed. Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * style(meta): wrap the tag-order loop for rustfmt Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * fix(meta): address reconcile_table review on test fixtures and guards Address review comments from @WenyXu and @killme2008: - Add ALTER TABLE q8 ADD COLUMN c INT before table reconciliation to exercise stale key repair with added columns. - Remove redundant else-continue guard in the tag ordering loop. - Clarify rustdoc explaining physical versus logical table reconciliation paths. - Share new_test_q8_raw_table_info fixture helper across reconciliation tests. Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * test(meta): cover partition key order during reconciliation Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> Signed-off-by: Tyagiquamar <104281681+Tyagiquamar@users.noreply.github.com> Signed-off-by: Dennis Zhuang <killme2008@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: dennis zhuang <killme2008@gmail.com> |
||
|
|
f4ff272f37 |
fix: keep exact DECIMAL and BIGINT UNSIGNED values in COPY FROM csv and json (#10560)
* fix: keep exact DECIMAL and UInt64 values in COPY FROM csv and json Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> * style: format the reader schema test Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> * test: add the expected output of the exact numbers case Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> * fix: round decimals with extra fractional digits in COPY FROM Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> * fix: parse decimals from text in COPY FROM csv and json Arrow's decimal decoding is wrong for some numbers in scientific notation and drops the digits beyond the scale. Read a decimal column as a string and parse it, so that every digit is used and the value is rounded as the cast from a float did. Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> * fix: read unsigned integers from text and reject empty strings in COPY FROM json Arrow's json reader parses an integer in scientific notation through a Float64, so 9007199254740993e0 lost its last digit in a BIGINT UNSIGNED column. Such a column is now read as text and parsed from every digit, like a DECIMAL column. An empty json string loaded into a DECIMAL column as NULL. It is an error again, and only an empty csv field is read as NULL. Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> --------- Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> |