Commit Graph
6441 Commits
Author SHA1 Message Date
discord9 7037fa80d5 feat(query): prepare native raw series without execution
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 09:33:06 +08:00
discord9 82147b98e1 feat(promql): evaluate instant selectors on shared typed samples
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 08:40:55 +08:00
discord9 80d167e4d9 feat(query): share native raw-series requests across datanode transports
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 08:10:19 +08:00
discord9 8880a03579 test(client): verify raw ordering metadata and response release
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 06:52:11 +08:00
discord9 4dcdfed7af feat(query): preserve native raw series ordering over Flight
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 06:45:32 +08:00
discord9 54a1b2d288 test(integration): verify stored histogram payloads over TCP Flight
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 05:56:21 +08:00
discord9 290e9a570a test(integration): verify histogram Rows ingestion into Mito
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 05:44:44 +08:00
discord9 731c4efbd7 test(integration): verify native raw series over TCP Flight
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 05:07:50 +08:00
discord9 8191e52cf8 fix(query): preserve cooperative native series scheduling
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 04:59:02 +08:00
discord9 17980304f3 fix(query): resolve scan filters against source schema
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 04:16:46 +08:00
discord9 658bcee96e feat(query): execute bound raw-series reads over Flight
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 03:47:49 +08:00
discord9 1b13ded508 feat(query): bind raw-series requests to prepared scans
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 03:31:37 +08:00
discord9 1cea0c00ed test(integration): cover region queries over TCP Flight
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 02:52:17 +08:00
discord9 527acc1fba fix(query): preserve remote series frame schema identity
Validate all reserved series-frame metadata and exact Arrow fields before
MergeScan replaces a remote schema with its local schema. Recognize frame
metadata on either side, including unknown reserved keys, while retaining
ordinary SQL metadata, timezone and JSON compatibility.

Cover empty advertised streams, later inner-batch divergence after a valid
frame, field identity, and complete typed payload and column sharing through
the existing MergeScan execution boundary.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 02:24:38 +08:00
discord9 d21e0d02a6 feat(promql): merge ordered raw series inputs
Merge explicitly supplied compatible primary-key streams by complete read key
and timestamp before label materialization. Preserve every projected field and
shared payload slice; reject duplicate timestamps instead of choosing a winner.

Keep one head and owned ordering history per input plus a pending output.
Compute finality across all supplied streams and release inputs and retained
payloads on cancellation, EOF or a terminal error without replay.

Expose the existing Legacy scan ordering through the raw-stream enum while
leaving TwoPhase streams Contiguous. Exercise real regional partitions, MVCC,
filters, projected fields, Frame roundtrips, complete labels and buffer lifetimes.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 01:36:14 +08:00
discord9 f926111784 feat(promql): materialize complete raw source labels
Decode native primary-key labels through the stream's bound metadata snapshot
using the existing complete-label decoder. Preserve explicit identities and all
raw keys, timestamps, fields, buffer owners, ordering and stream-local finality.

Validate raw schema, label mode and local chunk shape without adding another
cross-chunk validator. Release the owned upstream and decoder on EOF or error;
do not replay, merge input streams or infer authorization or global completion.

Exercise focused ownership and lifecycle contracts and the real Mito physical
Frame/unpack path against its existing visibility and label/sample oracles.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-16 00:02:43 +08:00
discord9 440a765043 chore: combine native Source execution and bound label decoding
Combine the independently reviewed native Frame scan and primary-key label decoder on the next feature branch, without adding a public query route.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 23:21:36 +08:00
discord9 a6462d3242 feat(query): execute prepared native raw-series scans
Select native Frame leaves through a non-consuming scanner schema preflight.
Keep the default raw scan TODO and ordinary input behavior unchanged when the
capability is absent. Reuse one Mito eligibility and typed-predicate preparation
for preflight and execution, declining live dynamic wrappers before native use.

Bind and revalidate the native schema, label source and partition count; never
replay a selected native execution through the ordinary scanner. Reuse existing
Frame packing, tracing, output metrics, memory tracking and reset behavior.

Exercise actual Mito physical execution with MVCC, projection, multi-field/null
results, original Int64 predicate precision, empty output and dynamic wrappers,
plus focused binding, ownership, quota and no-replay regression tests.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 22:56:01 +08:00
discord9 d87f52b402 chore: synchronize native series source parents
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 22:16:11 +08:00
discord9 3b719c9ecc feat(query): adapt ordered record batches to raw series
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 21:56:30 +08:00
discord9 36843e8ceb chore: synchronize raw frame stream parent
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 21:19:25 +08:00
discord9 a7ca3cce4e fix(query): preserve raw time axis lifecycle proof across contract update
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 21:19:20 +08:00
discord9 35ba224c18 chore: synchronize reviewed raw time axis contract
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 21:17:46 +08:00
discord9 24ebc2e030 fix(mito2): synchronize reviewed raw scan contract
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 21:07:55 +08:00
discord9 4053026374 fix(mito2): share raw key buffers and validate legacy key order
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 20:55:24 +08:00
discord9 5fa4fed582 fix(datatypes): share raw axis validation and expose explicit buffer
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 20:53:35 +08:00
discord9 0428b4217d fix(query): verify logical frame field bindings
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 20:45:46 +08:00
discord9 d4a3f67f65 fix(datatypes): preserve series frame field names
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 20:37:16 +08:00
discord9 d47d28da2b style(mito): import raw series types by name
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 20:31:21 +08:00
discord9 8f757e6949 feat(mito-codec): decode scan-bound primary key labels
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 20:28:54 +08:00
discord9 4ad0ce71fe fix(store-api): mark default raw series scan as todo
Leave the raw entrypoint explicitly unimplemented until a scanner overrides it. Document the default panic and keep the real scanner regression proving that its legacy input remains readable after the placeholder is caught.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 19:35:48 +08:00
discord9 b774c32075 fix(query): bound raw frame validation history and empty polling
Keep only adjacent sequence state instead of retaining every completed key. The producer remains responsible for contiguous key runs; ordered streams still reject key regressions.

Yield after 32 validated empty batches per unpack poll without losing pending rows or terminal errors. Preserve whole-batch atomicity and document the producer contract.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 19:18:07 +08:00
discord9 cfb66f5f2e chore: synchronize raw frame stream stack base
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 18:23:37 +08:00
discord9 db702dc894 chore: synchronize Mito raw series stack base
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 18:22:52 +08:00
discord9 489c9453cd chore: synchronize series frame stack base
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 18:22:41 +08:00
discord9 380fde19df chore: synchronize merged histogram foundations
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 18:21:36 +08:00
discord9 9e2991f098 feat(query): bridge native histograms to columnar samples (#9602)
I hereby agree to the terms of the [GreptimeDB
CLA](https://github.com/GreptimeTeam/.github/blob/main/CLA.md).

## Refer to a related PR or issue link (optional)

Target: `narthex`, which now contains merged #9598 and #9599. Their
landed changes have been synchronized without rewriting feature history,
so this PR remains the histogram bridge increment.

## What's changed and what's your intention?

Connect the existing native-histogram representation to the shared
columnar sample containers. The incremental diff is limited to
`common-query/src/native_histogram.rs`.

- Re-export the shared `CounterResetHint` at its existing query-module
path, preserving numeric conversions and unknown values. Add an
owned-histogram adapter to `HistogramBatchBuilder`.
- Add a quantile entrypoint for borrowed `HistogramView` values. It
shares the existing quantile calculations and preserves early-return
precedence, custom/exponential bucket behavior and NaN information.
Borrowed-view validation does not tighten the legacy owned histogram's
malformed-layout behavior.
- Normalize persisted Arrow histogram structs directly into an owning
`Samples` value, without reconstructing a per-row owned
`NativeHistogram`. Preserve row positions, parent nulls, complete
payload bits, both bucket sides, reset/start metadata, and sliced-parent
offsets. Float payloads take precedence when present; stored integer
bucket counts are already absolute and are converted directly, with a
missing zero count defaulting to zero.
- Reject missing required scalar values, null list items and invalid
span layouts. The existing `read_histogram` decoder and persisted struct
schema remain unchanged.

Normalization borrows source values while reading and then copies them
into the canonical owning batch; integer conversion uses temporary
buffers. The borrowed quantile path still derives bucket/index buffers.
This is not an allocation-free or measured-performance claim. Scanner,
frame/Flight, execution-operator and public HTTP/TQL/SQL integration are
not included, and no persisted or network format changes.

### Validation

Ten new focused tests cover borrowed quantiles and NaN information,
malformed/overflow spans and early-return precedence, legacy
owned-layout compatibility, complete payload bit preservation, nonzero
batch/parent slices after original owners drop, empty/all-null input,
integer counts and float-family selection, and
required-field/list-item/span errors.

- Rust 1.98.1: `cargo check --locked -p datatypes -p common-query -p
promql --all-targets` — passed.
- Rust 1.98.1: `cargo nextest run --locked -p datatypes -p common-query
-p promql --retries 0 --no-fail-fast` — 707 passed, 0 skipped, both
before and after the final test-noise cleanup. The actual listing
includes all new tests and the parent buffer-capacity regression.
- The three cleanup-affected payload/lifecycle/empty tests were also run
explicitly — 3 passed; the complete unfiltered suite then passed all
707.
- Rust 1.99.0: `rustfmt --edition 2024 --config skip_children=true
--check src/common/query/src/native_histogram.rs` — passed.
- Scoped `hawkeye format` and `hawkeye check` on a byte-identical source
copy, plus `git diff --check` — passed. A missing-header negative
control confirmed that the scoped license check inspects the file.
- Rust 1.99.0: `cargo clippy --locked --no-deps -p common-query -p
promql --all-targets -- -D warnings` — blocked by
`async_trait`-generated `clippy::double_must_use` at unchanged
`common-query/src/logical_plan.rs:129`. The exact same command on the
exact parent commit `7e5acfb9a9c` reproduces that failure. Pinned 1.98.1
Clippy is unavailable in the local read-only toolchain. No lint or CI
policy was weakened; this is not a passing Clippy or full-workspace
validation claim.

### Diff-scoped cleanup

No whole tests were deleted. Removed only an empty-result assertion that
accepted every dense-storage representation after exact length was
already verified; the same named test retains empty/two-null conversion,
length and missing-position checks. Simplified payload assertions to
explicit histogram bindings and a shared complete bitwise assertion
helper, and renamed the payload test to describe its explicit
expected-value oracle. Public API rustdoc, ownership rationale and
compatibility/precedence contracts remain. No scanner, protocol or
unrelated cleanup is bundled.

### Verified review follow-up

- Current tested/pushed head:
`1164877b5a5982d0cea2860e01e1c28714299e9e`, including the merged #9599
parent. The only query-file conflict resolution relocates the same enum
re-export and retains the exact landed reset-hint identity regression;
no bridge/helper code was dropped. Independently reviewed after
resolution.
- Owned `all_buckets` and borrowed-view quantile execution now share one
private `assemble_bucket_sides`; no duplicate negative reversal or
zero-bucket rule remains. Fallible side builders, validation and
custom-bound handling are unchanged.
- A focused expected-sequence regression independently checks bounds,
counts and boundary rules, including insertion for nonzero count and
omission for both signed zeros.
- On the final synchronized head, Rust 1.98.1 all-target check and
complete `common-query / promql / datatypes` nextest: **712/712, 0
skipped** (76 + 301 + 335). Strict datatypes-only Rust 1.99 Clippy
passes. The earlier strict three-package run reports the existing
common-query macro diagnostic; the final known-category comparison
passes, not strict query lint. Normal formatting/TOML/license hooks
pass.

## PR Checklist
Please convert it to a draft if some of the following conditions are not
met.

- [x] I have written the necessary rustdoc comments.
- [x] I have added the necessary unit tests and integration tests.
- [ ] This PR requires documentation updates.
- [x] API changes are backward compatible.
- [x] Schema or data changes are backward compatible.
- [ ] This PR needs to be backported to release branches, and I have
added the `backport-<target>` labels (e.g. `backport-v1.3` targets
`release/v1.3`).
2026-10-15 18:20:43 +08:00
discord9 1164877b5a chore: synchronize merged series samples
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 18:18:18 +08:00
discord9 16d478a4c3 feat(datatypes): add Narthex series samples and fields (#9599)
I hereby agree to the terms of the [GreptimeDB
CLA](https://github.com/GreptimeTeam/.github/blob/main/CLA.md).

## Refer to a related PR or issue link (optional)

Stack base: `narthex` (includes merged #9598). This PR targets
`feat/narthex-series-foundation`; review and merge the foundation first,
then retarget this increment to `narthex`.

## What's changed and what's your intention?

Add the typed sample and field containers that complete the next
in-memory series increment. The incremental diff is limited to the
`datatypes` samples module, its focused tests, and its module export.

- `Samples` retains typed Arrow float, histogram, mixed, or chunked
storage. Null means missing; ordinary NaNs and float payload bits remain
values. Histogram indices retain their immutable owning batch, and mixed
storage rejects overlapping float/histogram validity.
- Clones and checked nonzero slices share numeric buffers, validity
bitmaps and histogram tables. Chunk construction flattens descriptors
without flattening sample buffers; sequential iteration reports exact
remaining length.
- Explicit `into_dense()` concatenates only when requested. When every
histogram-bearing chunk references the same `Arc<HistogramBatch>`, it
reuses that complete table and joins only values and indices, including
mixed and all-null histogram chunks. With different table owners, it
preserves and concatenates the complete participating tables and
checks/remaps their indices; it does not perform per-call owner or
content deduplication in that fallback. Numeric builders use the checked
local result length rather than Arrow's 1,024-slot default reservation.
Pure-histogram densification does not create a float builder; a float
payload is allocated only when a Float or Mixed representation requires
it, including an all-null Mixed float component.
- `SeriesFields` stores one field inline or multiple fields in a boxed
slice, rejecting empty or unequal-length fields. `SeriesSchema` shares
field descriptions and an optional evaluation grid.
- `Series::try_new` validates field count, local time/field alignment
and timestamp order. A grid axis requires a value-equal schema grid;
explicit and explicit-chunk axes require no schema grid. A short series
can hold 20 values on `[800,820)` of a 2,017-point grid without padding
its fields to the full grid.

This only adds in-memory types. It does not switch HTTP/TQL/SQL queries
to a new execution path or change persisted data or network formats.
Scanning, frame/Flight integration, execution operators and
producer-side synchronized value trimming are not included. Supporting a
short range here does not prove that a future computation producer
avoids allocating full-grid values; that producer needs its own
acceptance tests.

### Focused validation

Current verified head: `cb0a75f2c0a7` (the test cleanups plus the
histogram-only temporary-allocation fix). The allocation follow-up
changes only builder creation, append and finish conditions; table
reuse/remapping and sample semantics remain unchanged.

Thirteen samples tests cover valid/missing/NaN/stale values, malformed
indices and mixed validity, nested/empty chunks, nonzero shared slices,
complete histogram payload and whole-table remapping, single/multiple
fields, grid policy, invalid explicit ordering, and actual Arrow
allocation retention/release. The shared-table regressions cover
histogram-only, mixed, and all-null indices; different-owner cases check
every logical value and missing position without prescribing table
deduplication or index layout.

- Rust 1.98.1: `cargo check --locked -p datatypes --all-targets` —
passed.
- Rust 1.98.1: `cargo nextest run --locked -p datatypes --retries 0
--no-fail-fast` — 335 passed, 0 skipped, both before and after this
review cleanup. This includes the parent capacity regression and all
thirteen samples tests; the renamed candidate tests were checked in the
actual test listing. The five affected or explicitly retained samples
tests also passed in a targeted run.
- The added numeric-buffer assertion in
`densification_preserves_values_nulls_nan_and_remaps_multitable_histograms`
fails on the preceding implementation at 12,544 retained bytes and
passes with the fix. A temporary measurement of the fixed fixture
reported 212 bytes across its float/index buffers, excluding
histogram-table storage. These are retained Arrow buffer capacities, not
RSS.
- A separate local allocator probe around the actual `into_dense()` call
used 1,048,576 histogram positions, 64 segments, one shared table and
alternating values/missing positions. Requested allocation bytes fell
from **12,845,472 to 4,325,584** (10 allocation requests to 5); the one
8,388,608-byte temporary allocation and its in-call free disappeared.
Histogram representation, shared table identity and all positions were
unchanged. These are requested allocations during this fixture, not RSS,
final retained bytes or a throughput benchmark. The probe is not added
to the production or unit-test allocator.
- Rust 1.99.0: `cargo fmt --all -- --check` — passed.
- Rust 1.99.0: `cargo clippy --locked --no-deps -p datatypes
--all-targets -- -D warnings` — passed. The pinned 1.98.1 Clippy
component is unavailable in the local read-only toolchain;
dependency-inclusive 1.99 linting is still blocked by pre-existing
`double_must_use` diagnostics in `common-base/src/range_read.rs`. No
lint level or CI rule was weakened.
- `hawkeye format`, `hawkeye check`, and `git diff --check` — passed.

### Diff-scoped cleanup

The earlier cleanup removed an unused crate-private chunk accessor and a
single-use generic parameter from the private field container. Public
API rustdoc, rationale, SAFETY comments, and all whole tests remain.
This review makes only these additional local changes:

| Changed test | Removed constraint or duplicate | Retained behavior and
actual evidence |
| --- | --- | --- |
| `densification_preserves_distinct_shared_table_owner_values` (renamed)
| Exact output-table cardinality, prescribed remapped indices, and
forced distinct output allocation | Genuinely different histogram
tables, including repeated owners and missing positions; every output
value is checked by the existing complete histogram/float-bit comparator
and every non-null index is in bounds. The renamed test passed. |
|
`short_multifield_series_uses_its_grid_range_and_checks_explicit_chunk_order`
| Only the final duplicate single-axis `[2, 1]` rejection block |
`fields_clone_buffers_and_series_validate_schema_alignment_and_time_order`
retains that rejection with valid matching fields and an ordered
positive control. Both tests passed. Short-grid, multifield and
cross-chunk checks remain. |

The two same-`Arc` sharing regressions retain their pointer-equality
guarantees and passed. The mixed regression additionally checks that an
all-null float component does not erase the Mixed representation. Owner
retention/release, malformed-input, grid-boundary and histogram
regressions are not removed. The earlier shared-table memory fix was
also checked red/green: the pre-fix implementation retained 64 or 2
table rows where the shared-table fixtures require one; the fixed
implementation passes without changing fallback semantics.

### Verified review follow-up

- Retargeted to `narthex` after #9598 merged; synchronized its merge
commit without rewriting feature history. Current tested/pushed head:
`ad1d1ee0fb748dca664726a01508d3fdf499ffe8`.
- Consolidate ordering and checked length in crate-private
`TimeAxis::try_len`, used by both constructors and `Series::try_new`;
remove the duplicated Series helper. Preserve direct-public-payload
validation, chunk sharing, error ordering, grids and slicing.
- Strengthen the existing clone-owner regression with nonempty
value-buffer pointer identity, actual values, and release only after
both Series and clone are dropped.
- Rust 1.98.1 all-target checking for `datatypes / common-query` passes;
complete nextest **400/400, 0 skipped** (335 + 65). Strict
datatypes-only Rust 1.99 Clippy and ordinary fmt/TOML/license
commit/push hooks pass. No expanded two-package strict-lint claim.
- The previous hosted MySQL SQLness job's durable failure annotation
reports that the runner lost communication; its raw log is unavailable
(`BlobNotFound`). This is not presented as a successful SQLness run, and
no SQL semantics or CI settings were changed to mask it.

## PR Checklist
Please convert it to a draft if some of the following conditions are not
met.

- [x] I have written the necessary rustdoc comments.
- [x] I have added the necessary unit tests and integration tests.
- [ ] This PR requires documentation updates.
- [x] API changes are backward compatible.
- [x] Schema or data changes are backward compatible.
- [ ] This PR needs to be backported to release branches, and I have
added the `backport-<target>` labels (e.g. `backport-v1.3` targets
`release/v1.3`).
2026-10-15 18:16:53 +08:00
discord9 ad1d1ee0fb refactor(datatypes): share series time validation
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 18:15:01 +08:00
discord9 70a6c4551f refactor(query): share native histogram bucket assembly
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 18:14:47 +08:00
discord9 44b3022a73 chore: synchronize merged series foundation
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 18:08:39 +08:00
discord9 76c9c1c5be feat(datatypes): add shared series foundations for Narthex (#9598)
I hereby agree to the terms of the [GreptimeDB
CLA](https://github.com/GreptimeTeam/.github/blob/main/CLA.md).

## Refer to a related PR or issue link (optional)

First Narthex foundation PR, targeting the `narthex` development branch.

## What's changed and what's your intention?

Introduce the first shared in-memory building blocks for native series
execution, extracted from the earlier local implementation and updated
to use shared evaluation grids and per-series ranges.

- Add `Label` and `MetricName`: shared strings and sorted labels,
content-based identity, separate metric-name handling, and copy-on-write
label changes.
- Add `GridSpec`, `EvalGrid`, and `GridRange`: validate numeric and
range bounds, materialize a grid once, and let short results reference
their absolute range without copying timestamps.
- Add `TimeAxis` support for grid ranges, explicit timestamps, and
explicit chunks, including checked zero-copy slicing.
- Add Arrow-backed `HistogramBatch`, borrowed histogram/bucket views,
and a builder with structural validation. Preserve all histogram
components, float bits, and unrecognized reset-hint codes.
- Cover label isolation, numeric extremes, malformed inputs,
nonzero/nested slices, and real Arrow-allocation retention and release.
- Start histogram primitive builders at zero capacity rather than
Arrow's 1,024-slot default. A one-row retained-buffer regression rejects
the old large reservation; no finish-time shrinking or new capacity API
is added.

This PR adds types to `datatypes` and re-exports the shared reset-hint
enum from `common-query` instead of defining it twice. It does not
enable a new query path or change existing HTTP/TQL/SQL results, storage
formats, or network protocols. `Samples`, `SeriesFields`, and
`SeriesSchema` follow in the next structural increment; producer-side
synchronized value trimming, scanning, Flight integration, and execution
operators are not included.

### Verification at `bdc12034e559cbabc227ce3e53405928f568a22a`

- Rust 1.98.1: `cargo check --locked -p datatypes -p common-query
--all-targets` — passed.
- Rust 1.98.1: `cargo nextest run --locked -p datatypes -p common-query
--retries 0 --no-fail-fast` — **387 passed, 0 skipped** (`datatypes`
322; `common-query` 65).
- Rust 1.98.1: `cargo test --locked -p datatypes -p common-query --doc`
— command passed; both crates currently have zero doctests, so this is
not additional behavior coverage.
- Rust 1.99.0: scoped Rust formatting, workspace formatting through
ordinary commit/push hooks, TOML checks, Hawkeye format/check, and `git
diff --check` — passed.
- Rust 1.99.0: `cargo clippy --locked --no-deps -p datatypes -p
common-query --all-targets -- -D warnings` — **not passed**: one
existing `async_trait` `double_must_use` diagnostic in
`common-query/src/logical_plan.rs` is emitted for both lib and lib-test
targets. The identical command on immutable parent `78e94ced920` reports
the same diagnostics. A diagnostic-only comparison allowing that
category passes; no lint setting changed. The earlier datatypes-only
strict result below does not certify the expanded two-package command.

### Review follow-up

- Keep public `TimeAxis` payloads and clarify the validation boundary.
The next increment #9599 already validates directly constructed explicit
and chunked axes inside `Series::try_new`, including strict ordering and
checked total length. Its direct-construction and cross-chunk-order
regressions were run again at published head `cb0a75f2c0a7`: **2
passed**.
- Remove `TimeAxis`'s unused representation-derived equality rather than
add a timestamp-comparison implementation.
- Remove the discarded chunk-total accumulator; ordering validation,
empty-chunk removal and zero-copy storage/slicing remain unchanged. The
Series boundary keeps its checked aggregate-length validation.
- Use the datatypes-owned `CounterResetHint` through a public
query-module re-export. Existing query imports and known/unrecognized
`i32` conversions remain unchanged. A new focused test checks direct
cross-crate type identity and all known codes, unrecognized codes, and
both integer extremes; the existing Arrow unknown-hint round trip
remains covered.

### Diff-scoped cleanup

- Use ordinary `mod tests;` discovery; remove the three redundant
`#[path]` attributes without moving or dropping tests.
- Remove one duplicate ordinary-label miss assertion from
`src/datatypes/src/series/tests.rs`. No whole tests are deleted; all 18
original new tests remain, with one additional retained-capacity
regression. Keep invalid-input, boundary and allocation-lifetime
coverage and the public API, invariant and SAFETY comments.

| Removed assertion | Protected behavior | Surviving coverage | Actual
verification |
| --- | --- | --- | --- |
| `one.get("__name_missing") == None` in
`metric_identity_uses_contents_and_distinguishes_absent_from_empty` |
Absent ordinary-label lookup | `one.get("missing") == None` in the same
test; empty-label and exact `__name__` checks also remain | Named
nextest run: 1 passed; full suite before and after: 321 passed, 0
skipped |

At the prior checkpoints, the datatypes all-target check, formatting,
license and datatypes-only strict primary-crate Clippy checks passed
after cleanup and after the capacity fix (322 passed, 0 skipped). A
redundant comment restating the new capacity test was also removed
before the final checks. No skip, lint level, CI policy or production
behavior was changed.

### Small histogram retained-buffer regression

The exact new test failed against the pre-fix source: a one-row fixture
retained 90,352 bytes of Arrow buffers. With the final production fix,
the same fixture retained 528 bytes. These are
`get_buffer_memory_size()` capacity measurements, including offsets and
validity where present, not RSS measurements. The committed test
requires less than 4,096 bytes. Its failure on the original builder and
success on the candidate were both run locally.

## PR Checklist
Please convert it to a draft if some of the following conditions are not
met.

- [x] I have written the necessary rustdoc comments.
- [x] I have added the necessary unit tests and integration tests.
- [ ] This PR requires documentation updates.
- [x] API changes are backward compatible.
- [x] Schema or data changes are backward compatible.
- [ ] This PR needs to be backported to release branches, and I have
added the `backport-<target>` labels (e.g. `backport-v1.3` targets
`release/v1.3`).
2026-10-15 18:07:49 +08:00
discord9 bdc12034e5 fix(datatypes): address series foundation review feedback
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 17:56:57 +08:00
discord9 ac5ba11255 fix(mito): filter typed residuals before raw sample conversion
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 17:56:48 +08:00
discord9 696259a1ce feat(query): add incremental raw series frame streams
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 17:16:16 +08:00
discord9 3717cc2e2a fix(datatypes): retain histogram table views across frame densification
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 16:31:56 +08:00
discord9 8ca73a813f chore: address raw series candidate lint findings
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 16:16:58 +08:00
discord9 0f8e5330f7 feat(mito2): expose scan-bound raw series candidates
Adapt the existing series reader through an optional scanner entrypoint with
owned snapshot-bound label metadata and complete encoded series keys. Preserve
selected field order and Arrow segment views without eager label decoding.

Keep ordinary storage pushdown and MVCC semantics. Inexact field predicates
can leave false-positive candidates; callers must retain residual columns and
evaluate the ordinary residual filter before final projection. This adds no
public native query consumer or replacement filter evaluator.

Exercise both internal batch forms, stream finality/time/error/drop boundaries,
real Mito candidate parity, and logical metric routing with immutable binding.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 15:56:52 +08:00
discord9 cdca81ed9e chore: sync reviewed series foundation fixes
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 15:37:25 +08:00