Repository navigation
Description
Summary
A fields projection that omits a column named in tags makes the query return nothing, with HTTP 200 and truncated:false. And which rows are dropped depends on where the data currently lives, so the same query gives different answers as compaction runs.
buildTagMatchers refuses any condition on a column outside the projection:
if (columnIndices != null && !isInArray(cond.columnIndex(), columnIndices))
return null;and both scan directions turn that into an empty result:
final TagMatcher[] matchers = tagFilter == null ? null : buildTagMatchers(tagFilter, columnIndices);
if (tagFilter != null && matchers == null)
// A condition on a column the caller did not ask for: nothing can match.
return new ArrayList<>();The stated reason, in buildTagMatchers's javadoc, is that "a condition on a column that the caller did not request cannot be satisfied, because the row handed back would not carry it". The evaluation order in the same file says otherwise:
if (matchers != null && !matchesTagFilter(page, rowOffset, matchers))
continue;
final Object[] materialized = readRow(page, rowOffset, columnIndices);The filter is evaluated against the page, and the projection materialises the row afterwards. The row handed back not carrying the column is irrelevant, because the filter never reads the row handed back. The restriction is unnecessary rather than merely strict.
The layers then disagree with each other:
- the mutable bucket returns nothing (the code above);
- sealed SLOW_PATH blocks return nothing (
TagFilter.matchesMappedapplies the same rule); - sealed FAST_PATH blocks do return the matching rows.
So the answer to one unchanged query changes as data ages from mutable to sealed and as compaction promotes blocks between paths.
Where (HEAD 151799e)
engine/src/main/java/com/arcadedb/engine/timeseries/TimeSeriesBucket.java:673-681(buildTagMatchers, the refusal and its javadoc):565-568(scanRangeAscending) and:459-462(scanRangeDescending), the two callers that return an empty list:617-621(the evaluation order:matchesTagFilteron the page, thenreadRowwith the projection)TagFilter.matchesMappedfor the sealed SLOW_PATH half
Repro
POST /api/v1/ts/{database}/query
{"type":"cpu","fields":["value"],"tags":{"host":"web1"}}with samples present for host=web1. Response is {"rows":[],"count":0,"truncated":false} and HTTP 200. Adding "host" to fields returns the rows. Waiting for the data to seal and compact into FAST_PATH blocks also returns them, without any change to the query.
Suggested fix
Drop the projection check from buildTagMatchers and let the matcher carry the real column index, since matchesTagFilter reads the page and does not need the column to be projected. The same applies to TagFilter.matchesMapped on the sealed SLOW_PATH.
If the restriction is wanted for some reason not visible here, it must at least be uniform across the three layers, and it should be a 400 naming the column rather than an empty 200: a filter the engine silently declines to apply is indistinguishable from a filter that matched nothing.
Scope / confidence
High confidence on the mechanism and the evaluation order, both read directly at 151799eda2. The FAST_PATH divergence comes from the same audit and is what makes this a correctness bug rather than a documentation one.
Pre-existing via scanRange, but #7336 copied the guard verbatim into the new scanRangeAscending and routed POST /ts/{database}/query through it, which is how it reached this surface.
Activity
style(#7733): widen the projection by counting what is missing, not b…
Merge main: keep #7710's combinations fast path and the #7733 widened…
fix(#7733, #7741): enforce the projection contract, and say what is t…
test(#7733, #7743): the projection index arithmetic on its own, and t…
Merge pull request #7747 from ArcadeData/fix/issue-7733-7740-7741-774…
lvca commentedon Sep 17, 2026
Fixed in #7747, merged into
mainfor 26.10.1.A query that asked for some columns and filtered on a tag column it did not ask for - for example
{"fields":["value"],"tags":{"host":"web1"}}- came back empty with HTTP 200, as if nothing matched. Adding the tag tofieldsreturned the rows, and so did waiting for the data to be compacted, so the same query could give you two different answers depending on how old the samples were.The filter is now applied before the columns are narrowed down, on every storage layer, so it no longer matters whether the column you filter on is one you asked to see. As a side effect these queries are also a little faster: a row that does not match is never built.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(ArcadeData#7733, ArcadeData#7743, ArcadeData#7732, ArcadeData#7740,