Commit Graph
6413 Commits
Author SHA1 Message Date
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 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 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 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 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 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
discord9 69c73740ec feat(datatypes): add raw series frame codec
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 15:35:59 +08:00
discord9 4f0cc3244a chore: sync histogram-only densification fix
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 14:47:37 +08:00
discord9 4769ddd939 chore: sync histogram-only densification fix
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 14:46:17 +08:00
discord9 cb0a75f2c0 fix(datatypes): skip float buffers for histogram-only densification
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 14:45:36 +08:00
discord9 bb84af91a8 chore: sync reviewed series test cleanup
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 14:34:16 +08:00
discord9 57e1c51eb5 chore: sync reviewed series test cleanup
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 14:33:24 +08:00
discord9 1bfef429e7 chore: sync reviewed foundation test cleanup
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 14:30:55 +08:00
discord9 10dd49564a test(series): assert densification values without table layout
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 14:29:58 +08:00
discord9 78e94ced92 test(series): clarify histogram nullable-item schema coverage
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 14:29:45 +08:00
discord9 8d0278876d Merge commit '971e1893973233332b51201c67bfcdab8b556dea' into feat/narthex-raw-contract
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 13:38:50 +08:00
discord9 971e189397 Merge commit '4ca29e88b12c07d0a0e623043afe8dd296db6468' into feat/narthex-borrowed-histogram
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 13:37:58 +08:00
discord9 4ca29e88b1 fix(datatypes): retain shared histogram tables when densifying
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 13:36:48 +08:00
discord9 a8bb74cbf9 feat(storage): define raw series and optional scanner contract
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 13:32:32 +08:00
discord9 9a4d53ea64 feat(query): normalize stored histograms into shared samples
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 13:08:24 +08:00
discord9 295fc8cfb8 Merge branch 'feat/narthex-series-samples' into feat/narthex-borrowed-histogram
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:52:02 +08:00
discord9 7e5acfb9a9 fix(datatypes): size dense sample buffers to the local result
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:51:54 +08:00
discord9 d632c062f4 Merge branch 'feat/narthex-series-foundation' into feat/narthex-series-samples
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:47:45 +08:00
discord9 bee536ff27 feat(datatypes): add shared native series samples and fields
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:47:45 +08:00
discord9 d9d8dfff68 feat(query): estimate quantiles from borrowed histogram views
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:41:56 +08:00
discord9 a6cdbf966b fix(datatypes): avoid oversized default histogram buffers
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:41:47 +08:00
discord9 e8f76480d8 test(datatypes): remove duplicate absent-label lookup assertion
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:22:56 +08:00
discord9 ab1ee752d6 refactor(datatypes): use standard series test module layout
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:19:28 +08:00
discord9 fbf5f0c544 feat(datatypes): add Narthex shared series identity and time foundations
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-15 12:07:03 +08:00
Ning Sun 40770ddb72 test: only assert genuinely invalid read-preference values at request ingresses (#9576)
The flow and nested-MergeScan ingress tests hardcoded "follower" among
the read-preference values that must be rejected, coupling them to the
current leader-only ReadPreference enum. Assert only genuinely invalid
values there, matching the wire-values test which already limits itself
to ["", "unknown"]. This keeps the ingress tests valid for builds that
extend ReadPreference with more variants.

Signed-off-by: Ning Sun <sunning@greptime.com>
2026-10-14 12:49:56 +00:00
Lei, HUANG 3b442adba2 feat(mito): decouple compaction unit execution and publication (#9131)
* feat(mito): decouple compaction unit execution and publication

Execute shared-input dependency groups as independent local compaction units. Publish and acknowledge each unit separately, retain successful sibling results, and release each unit's input leases after worker apply.

Preserve picker priority, panic notifications, snapshot-free execution context, and indexed input leases. Include regression coverage for independent visibility, purge, cancellation, partial failure, and restart recovery.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito): use crate visibility for compaction unit items

Replace the newly introduced pub(super) declarations with pub(crate), and make CompactingFiles::try_reserve private since it is only used within its module, per docs/style-guide.md.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito): simplify compaction unit state and test fixtures

Keep local input leases in the task and derive running units from tracked and pending work. Replace the single-implementation task trait with an inherent async method and align exposed state type visibility.

Use snapshot-free region fixtures and named test scenarios, and cover independent input purging across three units with bounded parallelism.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito): align compaction task and test module names

Rename CompactionTaskImpl to CompactionTask now that the CompactionTask
trait has been removed and the Impl suffix no longer marks a trait
implementation. Rename the state test module from lease_tests to tests
to follow the test module naming convention.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito): align compaction task debug label

The Debug impl reported "TwcsCompactionTask" while the type is now
CompactionTask. Report the type name for consistency.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito): label compaction elapsed metric per published unit

Record greptime_mito_compaction_total_elapsed once per published unit and
label it by type: a local dependency unit or a remote job. Update the
metric docs and group the Grafana compaction OPS/latency panels by type.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito): clarify compacting file lease sharing

`CompactingFiles::for_inputs` clones the shared per-file leases instead of
transferring them. Document that the original collection keeps its leases,
so an input is released only after every owner drops its lease.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito): document local compaction unit map key

Document that `LocalCompaction::units` is keyed by each unit's execution
plan ID, which matches `CompactionExecution::plan_id()` and the `plan_id`
carried by unit notifications.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito): rename submit_prepared_compaction

The function submits remote jobs but only prepares local unit tasks; the
caller dispatches them after installing the returned phase. Rename it to
`prepare_or_submit_compaction` and document that ordering.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

---------

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
2026-10-14 12:21:32 +00:00
fengyue-xve a35661d69c fix(hdfs): clean up temporary file when an atomic write fails (#9483)
* fix(hdfs): clean up temporary file when an atomic write fails

Signed-off-by: fengyue-xve <1759519137@qq.com>

* style: apply rustfmt to hdfs layer test

Signed-off-by: fengyue-xve <1759519137@qq.com>

* fix(hdfs): report earlier write failures and log cleanup failures

- Later `write`/`close` calls on a writer whose failed write was
  cleaned up now mention the original failure instead of the bare
  "unavailable after close or abort" message.
- `abort_and_delete` logs abort and deletion failures with the
  temporary path instead of discarding them; the original write error
  is still returned to the caller.
- The temporary-file cleanup test now lists the directory holding the
  temporary file, so it fails if the cleanup is reverted.

Signed-off-by: 风月 <1759519137@qq.com>
Signed-off-by: fengyue-xve <1759519137@qq.com>

---------

Signed-off-by: fengyue-xve <1759519137@qq.com>
Signed-off-by: 风月 <1759519137@qq.com>
2026-10-14 09:46:15 +00:00
Weny Xu 36423a95c6 fix(operator): reuse catalog table resolution for write retries (#9574)
* fix(operator): inherit logical table partitions when retrying writes

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(operator): resolve retried writes through catalog manager

Signed-off-by: WenyXu <wenymedia@gmail.com>

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-10-14 08:42:51 +00:00
dennis zhuang 5c4d9eb4f8 fix: align fulltext bloom tokens with matches_term and use them for LIKE (#9470)
* fix: align fulltext bloom tokens with matches_term and use them for LIKE

The bloom fulltext index stored tokens that did not follow
matches_term's word boundaries (`_`, ASCII next to Han, Han substrings),
so pruning dropped rows matches_term accepts.

Tokens and query probes now share the character classes of
matches_term, Han runs are indexed as bigrams, and LIKE patterns use the
same probes. The bloom blob is written under a new key; blobs from older
versions are no longer probed. Tantivy no longer serves matches_term.

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

* chore: drop unused lazy_static from index and avoid typo-flagged test tokens

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

* docs: link like_probes to tokenize instead of the downstream ScriptTokenizer

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

* refactor: name probe extraction with verbs and document CharClass

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

* feat: rebuild legacy fulltext bloom indexes and probe lower(col)

The manifest records the fulltext bloom version per column, so ADMIN
BUILD_INDEX now rebuilds SSTs whose bloom index predates the current
tokens, and ssts_index_meta shows the version.

Case-insensitive bloom indexes also store the tokens of the whole
lowercased text for rows where it can differ (U+0130, U+212A, sigma),
so matches_term(lower(col), ..) and lower(col) LIKE .. use the index.

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

* test: cover legacy bloom index rewrite by compaction in the compat case

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

* chore: log outdated fulltext bloom indexes in the consistency check

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

* docs: explain the unrecorded fulltext bloom version

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-10-14 08:07:24 +00:00