Skip to content

feat(facets): faceting 7/9 - HIERARCHY, DISTINCT, STATS, AFTER, searchValues and GROUP BY acceleration - #11344

Merged
robfrank merged 1 commit into
mainfrom
feat/columnar-faceting-7-facets-advanced
Nov 6, 2026
Merged

robfrank merged 1 commit into
mainfrom
feat/columnar-faceting-7-facets-advanced

Conversation

@robfrank

@robfrank robfrank commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Part 7 of 9 of columnar faceting (umbrella #10355; this part: #10360, plan 5 and plan 6 task 0).

Adds the advanced facet kinds and GROUP BY acceleration: HIERARCHY (definition in COLUMNAR METADATA, AncestorExpander, HierarchyView / HierarchyBuilder, HierarchyManager with page-change generation), DISTINCT (HyperLogLog), STATS (with a public NumericSum), dictionary prefix search and the AFTER cursor, the facet.searchValues() SQL function, GROUP BY acceleration (eligibility, EXPLAIN, execution and equivalence), transports for the new kinds and the lag floor in FacetExecutor. It also emits the DOUBLE value hint for non-finite facet values and declares the hierarchy types in the export/import test.

One commit on main (parts 1-6, #11338 to #11343, are merged), 122 files, +17,557 / -390 (main 6,819, tests 10,595, docs 142).

Reviewer map

Read first Why
engine/.../index/columnar/HierarchyBuilder.java, HierarchyManager.java, HierarchyView, AncestorExpander + HierarchyDefinition hierarchical facets
engine/.../query/facet/HierarchyFacetCollector.java HIERARCHY collector
DistinctFacetCollector.java + HyperLogLog DISTINCT (approximate)
StatsFacetCollector.java + function/sql/math/NumericSum.java STATS
engine/.../index/columnar/DictionaryPrefixSearch.java AFTER cursor and prefix search
function/sql/facet/SQLFunctionFacetSearchValues.java facet.searchValues()
query/sql/executor/ColumnarGroupByPlanner.java, ColumnarGroupByStep.java, ColumnarGroupByAggregator.java GROUP BY acceleration

Mechanical, skim: grammar records for the new kinds, transports for the new kinds, the non-finite hint.
Plan: docs/superpowers/plans/2026-10-19-columnar-faceting-5-advanced.md.

Review focus

  • GROUP BY acceleration equivalence: it changes the plan of existing GROUP BY queries on types that carry a COLUMNAR index, so eligibility must be conservative and results identical
  • Hierarchy validation and cycles; page-change generation invalidation of hierarchy views
  • HLL error bound documented as approximate
  • The lag floor in FacetExecutor

Exposure

New facet kinds, facet.searchValues(), GROUP BY acceleration.

Behavior changes, release note owed:

  • GROUP BY acceleration is ON by default for every type with a COLUMNAR index: an eligible GROUP BY on such a type is answered from the projection without any change to the query. The database-scoped kill switch is arcadedb.columnar.groupByAcceleration (set it to false to get the normal plan back)
  • GROUP BY min() / max() over a DOUBLE or FLOAT column can return 0.0 where a plain scan returns -0.0 (the projection stores a negative zero as 0.0)
  • Every TERMS facet ordered by VALUE (ascending, without INCLUDE) now carries an after member (the cursor of the next page), and its MISSING bucket moves outside TOP onto the last page
  • Parts 6 (feat(facets): faceting 6/9 - FACETS over HTTP, ndjson, OpenAPI, gRPC and RemoteDatabase #11343, already in main) and 7 must ship in the same release: main's OpenAPI and proto already document hierarchy/distinct/stats/after, and a client built from main alone reading a server with this part loses after/min/max/sum/avg from extensions_json

Stack and merge order

Stack: #11338 -> #11339 -> #11340 -> #11341 -> #11342 -> #11343 -> #11344 -> #11345 -> #11346

CI

No mvn-test run completed on any earlier tip of this PR. The push of 8117a77ab5 started run 42238115450; it must be green before merge, otherwise dispatch mvn-test.yml (workflow_dispatch) on feat/columnar-faceting-7-facets-advanced. GROUP BY acceleration changes the plans of existing queries, so the engine suite is the real test here. Locally, this tip passed test-compile over engine, server and grpcw plus the facet, hierarchy, GROUP BY acceleration and ACL test classes; full suites were not run locally.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added hierarchy, distinct-count, and statistical facets, including hierarchy details, missing-value counts, and optional approximate distinct counts.
    • Added AFTER cursors for paging through terms facets and facet.searchValues for prefix-based value suggestions.
    • Eligible GROUP BY queries can now use columnar projections, with a setting to disable acceleration.
    • Added conversion and query-path metrics for columnar operations.
  • Bug Fixes
    • Facet and grouped-query results respect read triggers, listeners, and access permissions.
    • Improved typed facet values and pagination cursor handling across JSON and gRPC.

@robfrank robfrank added this to the 26.12.1 milestone Nov 5, 2026
@robfrank robfrank added the enhancement New feature or request label Nov 5, 2026
@robfrank robfrank self-assigned this Nov 5, 2026
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request adds hierarchy, distinct, stats, and paged facet support; columnar GROUP BY acceleration; conversion tracking; read-event fallbacks; typed JSON and gRPC transport; facet.searchValues; and extensive unit and integration coverage.

Changes

Columnar faceting and query execution

|:---|:---|
|Facet contracts and planning
engine/src/main/antlr4/..., engine/src/main/java/com/arcadedb/query/..., engine/src/main/java/com/arcadedb/schema/...|The SQL grammar and planner now support HIERARCHY, DISTINCT PRECISION, STATS, and terms AFTER. Schema validation checks hierarchy metadata and stats property types.|
|Hierarchy views and maintenance
engine/src/main/java/com/arcadedb/index/columnar/...|Hierarchy definitions, immutable views, builders, managers, watcher updates, background rebuild coordination, and lifecycle cleanup are added.|
|Facet collectors and search
engine/src/main/java/com/arcadedb/query/facet/..., engine/src/main/java/com/arcadedb/function/sql/facet/...|Hierarchy, distinct, and stats collectors are added. Terms paging, dictionary prefix search, read-event fallback, memory accounting, and facet.searchValues are implemented.|
|Columnar GROUP BY and conversion state
engine/src/main/java/com/arcadedb/query/sql/executor/..., engine/src/main/java/com/arcadedb/index/columnar/...|Eligible GROUP BY queries can use columnar projections. Unknown or nonzero conversion counts, read events, transaction conditions, and resource limits select the normal plan.|
|Transport, metrics, documentation, and tests
grpc/..., server/..., ha-raft/..., integration/..., engine/src/test/...|Facet value typing, cursors, hierarchy attributes, metrics, OpenAPI descriptions, HA responses, remote APIs, and execution comparisons are covered.|

Estimated code review effort: 5 (Critical) | ~120 minutes

Change: Feature

Suggested reviewers: lvca, tae898

Merge Risk: Minimal · up to dd50e

This change adds advanced faceting and GROUP BY acceleration. The review found no concrete merge-blocking defect. Run the full test suites before merging, since the author notes they were not run per tip.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 65.99% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title clearly identifies the main facet features and GROUP BY acceleration.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is detailed, on topic, and covers the change scope, motivation, related issues, review focus, behavior changes, merge order, and CI status. It does not use the required template headin…
Full details: Description check

Explanation

The description is detailed, on topic, and covers the change scope, motivation, related issues, review focus, behavior changes, merge order, and CI status. It does not use the required template headings and does not include the checklist, but it provides equivalent information for most sections.

Full details: Docstring Coverage

Explanation

Docstring coverage is 65.99% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 297 functions across 50 files. (70 skipped: 9 unsupported, 61 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ac35f74f-cf52-40e1-8e6b-6b366b3c9b36
Commits

Reviewing files that changed from the base of the PR and between c03061d and dd50e47.

Files selected for processing: 122

  • .claude/skills/engine-concurrency/SKILL.md
  • docs/superpowers/plans/2026-10-19-columnar-faceting-0-roadmap.md
  • docs/superpowers/plans/2026-10-19-columnar-faceting-6-resilience-load.md
  • docs/superpowers/specs/2026-10-18-columnar-faceting-design.md
  • docs/superpowers/specs/2026-10-28-columnar-faceting-overview.md
  • engine/src/main/antlr4/com/arcadedb/query/sql/grammar/SQLLexer.g4
  • engine/src/main/antlr4/com/arcadedb/query/sql/grammar/SQLParser.g4
  • engine/src/main/java/com/arcadedb/GlobalConfiguration.java
  • engine/src/main/java/com/arcadedb/database/LocalDatabase.java
  • engine/src/main/java/com/arcadedb/function/sql/DefaultSQLFunctionFactory.java
  • engine/src/main/java/com/arcadedb/function/sql/facet/SQLFunctionFacetSearchValues.java
  • engine/src/main/java/com/arcadedb/function/sql/math/NumericSum.java
  • engine/src/main/java/com/arcadedb/function/sql/math/SQLFunctionAverage.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarApplier.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarFlusher.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarIndexManager.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarMaintenancePool.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarManifest.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarProjection.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarRebuilder.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarSnapshot.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarStats.java
  • engine/src/main/java/com/arcadedb/index/columnar/ColumnarValueExtractor.java
  • engine/src/main/java/com/arcadedb/index/columnar/DictionaryPrefixSearch.java
  • engine/src/main/java/com/arcadedb/index/columnar/HierarchyBuilder.java
  • engine/src/main/java/com/arcadedb/index/columnar/HierarchyDefinition.java
  • engine/src/main/java/com/arcadedb/index/columnar/HierarchyManager.java
  • engine/src/main/java/com/arcadedb/index/columnar/HierarchyView.java
  • engine/src/main/java/com/arcadedb/index/columnar/ProjectionState.java
  • engine/src/main/java/com/arcadedb/query/facet/AncestorExpander.java
  • engine/src/main/java/com/arcadedb/query/facet/CollectorReservations.java
  • engine/src/main/java/com/arcadedb/query/facet/ColumnConversion.java
  • engine/src/main/java/com/arcadedb/query/facet/DistinctFacetCollector.java
  • engine/src/main/java/com/arcadedb/query/facet/DistinctFacetSpec.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetBounds.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetExecutionStats.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetExecutor.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetFallbackScanner.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetFilterEvaluator.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetPatcher.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetRanker.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetResult.java
  • engine/src/main/java/com/arcadedb/query/facet/FacetSpecCompiler.java
  • engine/src/main/java/com/arcadedb/query/facet/HierarchyFacetCollector.java
  • engine/src/main/java/com/arcadedb/query/facet/HierarchyFacetSpec.java
  • engine/src/main/java/com/arcadedb/query/facet/MatchSet.java
  • engine/src/main/java/com/arcadedb/query/facet/StatsFacetCollector.java
  • engine/src/main/java/com/arcadedb/query/facet/StatsFacetSpec.java
  • engine/src/main/java/com/arcadedb/query/facet/TermsCollector.java
  • engine/src/main/java/com/arcadedb/query/facet/TermsFacetSpec.java
  • engine/src/main/java/com/arcadedb/query/sql/antlr/SQLASTBuilder.java
  • engine/src/main/java/com/arcadedb/query/sql/executor/ColumnarGroupByAggregator.java
  • engine/src/main/java/com/arcadedb/query/sql/executor/ColumnarGroupByPlanner.java
  • engine/src/main/java/com/arcadedb/query/sql/executor/ColumnarGroupByStep.java
  • engine/src/main/java/com/arcadedb/query/sql/executor/CorrelatedSubQueryCache.java
  • engine/src/main/java/com/arcadedb/query/sql/executor/FacetCollectStep.java
  • engine/src/main/java/com/arcadedb/query/sql/executor/QueryPlanningInfo.java
  • engine/src/main/java/com/arcadedb/query/sql/executor/SelectExecutionPlanner.java
  • engine/src/main/java/com/arcadedb/query/sql/parser/FacetItem.java
  • engine/src/main/java/com/arcadedb/schema/ColumnarIndexMetadata.java
  • engine/src/main/java/com/arcadedb/schema/TypeColumnarIndexBuilder.java
  • engine/src/main/java/com/arcadedb/serializer/JsonSerializer.java
  • engine/src/main/java/com/arcadedb/utility/HyperLogLog.java
  • engine/src/test/java/com/arcadedb/function/Issue10850NoNarrowingReadsInFunctionsTest.java
  • engine/src/test/java/com/arcadedb/function/sql/facet/SQLFunctionFacetSearchValuesTest.java
  • engine/src/test/java/com/arcadedb/function/sql/math/Issue9496NumericSumTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarIndexDdlTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarIndexManagerLifecycleTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarManifestTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarRebuilderTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarReconcilerTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarStatsTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarTestAccess.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarTestData.java
  • engine/src/test/java/com/arcadedb/index/columnar/ColumnarValueExtractorTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/DictionaryPrefixSearchTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/FacetOracle.java
  • engine/src/test/java/com/arcadedb/index/columnar/HierarchyBuilderTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/HierarchyDefinitionTest.java
  • engine/src/test/java/com/arcadedb/index/columnar/HierarchyManagerTest.java
  • engine/src/test/java/com/arcadedb/query/facet/AdvancedFacetParserTest.java
  • engine/src/test/java/com/arcadedb/query/facet/AdvancedFacetsFixture.java
  • engine/src/test/java/com/arcadedb/query/facet/AncestorExpanderTest.java
  • engine/src/test/java/com/arcadedb/query/facet/DistinctFacetCollectorTest.java
  • engine/src/test/java/com/arcadedb/query/facet/DistinctFacetIntegrationTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetExecutorTermsTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetPatchingTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetQueryLifecycleTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetReadEventsTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetResultsJsonTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetRowTypesTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetSpecCompilerTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetsExplainTest.java
  • engine/src/test/java/com/arcadedb/query/facet/FacetsVsGroupByBenchmark.java
  • engine/src/test/java/com/arcadedb/query/facet/HierarchyFacetCollectorTest.java
  • engine/src/test/java/com/arcadedb/query/facet/HierarchyFacetIntegrationTest.java
  • engine/src/test/java/com/arcadedb/query/facet/StatsFacetCollectorTest.java
  • engine/src/test/java/com/arcadedb/query/facet/StatsFacetIntegrationTest.java
  • engine/src/test/java/com/arcadedb/query/facet/TermsAfterCursorTest.java
  • engine/src/test/java/com/arcadedb/query/sql/executor/ColumnarGroupByAccelerationTest.java
  • engine/src/test/java/com/arcadedb/query/sql/executor/ColumnarGroupByEligibilityTest.java
  • engine/src/test/java/com/arcadedb/query/sql/parser/FacetsKeywordsAsIdentifiersTest.java
  • engine/src/test/java/com/arcadedb/query/sql/parser/SQLFacetsParserTest.java
  • engine/src/test/java/com/arcadedb/serializer/JsonSerializerFacetsTest.java
  • engine/src/test/java/com/arcadedb/utility/HyperLogLogTest.java
  • grpc-client/src/test/java/com/arcadedb/remote/grpc/FacetProtocolTest.java
  • grpc-client/src/test/java/com/arcadedb/remote/grpc/FacetsGrpcIT.java
  • grpc/src/main/java/com/arcadedb/server/grpc/FacetProtocol.java
  • grpc/src/main/proto/arcadedb-server.proto
  • ha-raft/src/test/java/com/arcadedb/server/ha/raft/FacetsFollowerQueryIT.java
  • ha-raft/src/test/java/com/arcadedb/server/ha/raft/ParseResultSetFromJsonFacetsTest.java
  • integration/src/test/java/com/arcadedb/integration/ColumnarIndexExportImportTest.java
  • native/src/main/resources/META-INF/native-image/com.arcadedb/arcadedb-native/reachability-metadata.json
  • server/src/main/java/com/arcadedb/server/http/handler/AbstractQueryHandler.java
  • server/src/main/java/com/arcadedb/server/http/handler/openapi/CoreApiSpec.java
  • server/src/main/java/com/arcadedb/server/monitor/ColumnarMetrics.java
  • server/src/test/java/com/arcadedb/remote/RemoteDatabaseFacetsIT.java
  • server/src/test/java/com/arcadedb/server/http/FacetAdvancedHttpIT.java
  • server/src/test/java/com/arcadedb/server/http/handler/NdJsonResultStreamFacetsTest.java
  • server/src/test/java/com/arcadedb/server/http/handler/openapi/FacetsApiSpecTest.java
  • server/src/test/java/com/arcadedb/server/monitor/ColumnarMetricsIT.java
  • server/src/test/java/com/arcadedb/server/security/FacetsSubtypeAclIT.java
Files with no reviewable changes: 2

  • engine/src/test/java/com/arcadedb/query/facet/FacetSpecCompilerTest.java
  • engine/src/test/java/com/arcadedb/query/sql/parser/SQLFacetsParserTest.java

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@claude

claude Bot commented Nov 5, 2026

Copy link
Copy Markdown

Review of #11344. The diff exceeds GitHub's 20k-line limit, so I read the PR description and the GROUP BY planner (ColumnarGroupByPlanner) and skimmed the file list. I did not read the rest line by line. I did not build the PR or run any tests.

What looked good

  • ColumnarGroupByPlanner is conservative, which is what the equivalence focus asks for. It falls back to the normal plan for WHERE, DISTINCT, EXPAND, UNWIND, LET, LIMIT or SKIP without ORDER BY, extra projections after ORDER BY, multi-key GROUP BY, non-bare properties, non-schema targets and timeseries types.
  • Each of the new facet kinds (HIERARCHY, DISTINCT, STATS, AFTER, searchValues) comes with its own tests, as do the GROUP BY acceleration and the lag floor.
  • The bulk of the new test classes are the regression coverage that CLAUDE.md asks for.

Suggestions

  1. CI: this PR gets no Maven CI because it is stacked. Please run workflow_dispatch on mvn-test.yml for this branch before merging. GROUP BY acceleration changes plans for existing queries, so the full engine suite matters here.
  2. Equivalence tests: ColumnarGroupByAccelerationTest should compare accelerated and non-accelerated output for the cases where they could differ. Those are NULL keys, mixed-type keys, sum overflow on LONG, avg on integral columns, empty types, subtype buckets and uncommitted transaction state. Please confirm each is covered. I only checked the planner, not the test.
  3. Hierarchy validation: confirm that cycles and self-parents are rejected at build time, and that the depth or expansion in AncestorExpander is bounded, so malformed data cannot cause unbounded work or memory use.
  4. HLL: DISTINCT is approximate, so document the error bound in the user docs and in the result metadata, not only in the code.
  5. searchValues() and the prefix search: check that the result size is capped (limit clamped to a max), because these inputs come from the query text.
  6. Test timing: the lag-floor tests should use StallAwareStopwatch rather than raw wall-clock assertions, per CLAUDE.md. Benchmarks such as FacetsVsGroupByBenchmark should carry @Tag("benchmark").

I found no security issues in what I read. There is no new dependency, no new network or file surface, and the author is a maintainer.

@codacy-production

codacy-production Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage · +0.11% coverage variation

Metric Results
Coverage variation ✅ +0.11% coverage variation
Diff coverage ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (7f8ea68) 309090 257643 83.36%
Head commit (8117a77) 312276 (+3186) 260650 (+3007) 83.47% (+0.11%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#11344) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@robfrank
robfrank force-pushed the feat/columnar-faceting-6-facets-transports branch from 22b501b to 4a30884 Compare November 6, 2026 09:15
@robfrank
robfrank force-pushed the feat/columnar-faceting-7-facets-advanced branch from c6ec8a7 to 443131c Compare November 6, 2026 09:15
@claude

claude Bot commented Nov 6, 2026

Copy link
Copy Markdown

Automated review (limited): the diff is over GitHub's 20,000-line limit, so I could not read it in full. I did not run the code or the tests.

  • Source: the PR comes from a maintainer and is part 7 of a documented stack. I saw no sign of malicious changes.
  • GROUP BY acceleration: this is the riskiest piece, because it changes the plans of existing queries on types that carry a COLUMNAR index. Please confirm that eligibility is conservative and that there are equivalence tests covering NULLs, multi-valued properties, DISTINCT/aggregate mixes, ORDER BY/LIMIT, and a fallback when the index is stale or lagging.
  • Hierarchy: please check that cycle and depth validation is bounded, and that malformed COLUMNAR METADATA cannot cause unbounded memory or recursion in AncestorExpander and HierarchyBuilder.
  • facet.searchValues() and prefix search: please check that limits on the result size and the prefix length are enforced, and that the function respects per-type read permissions.
  • HLL: please document in the user-facing docs that DISTINCT is approximate, with its error bound.
  • Tests: per CLAUDE.md, long-running tests need @Tag("slow"), wall-clock assertions should use StallAwareStopwatch, and server tests should not use fixed ports.
  • Merge order: the PR needs a merge commit or a rebase merge, not a squash, as the description says.

🤖 Generated with Claude Code

@robfrank
robfrank force-pushed the feat/columnar-faceting-6-facets-transports branch from 4a30884 to 54f1227 Compare November 6, 2026 09:36
@robfrank
robfrank force-pushed the feat/columnar-faceting-7-facets-advanced branch from 443131c to bfa9805 Compare November 6, 2026 09:36
@claude

claude Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review of #11344 (limited scope). The diff exceeds GitHub's 20,000-line limit, so I couldn't read the whole PR. I read SQLFunctionFacetSearchValues in full and did not review the rest, including the GROUP BY acceleration, the hierarchy code and HLL.

facet.searchValues: no problems found

  • Type and property names are rejected if they contain a backtick before they are quoted into the internal SQL. Candidate values go in as query parameters, so I see no injection path.
  • It checks READ_RECORD per bucket and raises the normal security error when no bucket is readable.
  • The limit is capped by COLUMNAR_TOP_MAX. Batches, rows and ordinal buffers are charged to FacetMemoryBudget, and the search stops after MAX_BATCHES rounds.

Suggestions

  • For GROUP BY acceleration, add a randomized equivalence test that runs each query with and without the COLUMNAR index. Cover NULLs, multi-valued properties, polymorphic types, uncommitted transactions and security-restricted buckets. This is the riskiest change because it alters the plans of existing queries.
  • For hierarchy definitions, check that cycles and over-deep chains are rejected where the definition is read, not only in the builder.
  • Keep documenting the HLL error bound as approximate in the user docs.
  • For the lag floor, StallAwareStopwatch should be used in the timing tests, per CLAUDE.md.

I found no security hazard in the code I read.

@robfrank
robfrank force-pushed the feat/columnar-faceting-6-facets-transports branch from 54f1227 to 0fb8f15 Compare November 6, 2026 11:07
@robfrank
robfrank force-pushed the feat/columnar-faceting-7-facets-advanced branch from bfa9805 to 784eeed Compare November 6, 2026 11:07
@claude

claude Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review note: this PR is too large for the GitHub diff API (122 files, +17k lines), so I could not do a full line-by-line pass. I read SQLFunctionFacetSearchValues only, and only its first 150 lines (Javadoc, argument validation, bucket/permission selection). I did not read the other classes in the reviewer map.

What I saw there:

  • It checks READ_RECORD per bucket before it reads that bucket's dictionary.
  • It caps the limit and charges allocations to FacetMemoryBudget.
  • It bounds the number of batches.
  • Its counting query runs as the caller, so values from records the caller cannot read should not be counted. That last point comes from the Javadoc. I did not confirm it in the code.

Things to check:

  • Add a test that a user without READ on one bucket never sees values or counts from it. Also cover the all-denied error path.
  • Check that GROUP BY acceleration respects per-bucket security, READ triggers and uncommitted-transaction state. Equivalence tests against the non-accelerated plan, including inside an open transaction, would settle this.
  • Confirm the hierarchy cycle and depth validation fails cleanly and that the page-change invalidation test covers concurrent writers.

Security verdict: no hazard found in the part I read. The author is a maintainer.

@robfrank
robfrank force-pushed the feat/columnar-faceting-6-facets-transports branch from 0fb8f15 to b470ed2 Compare November 6, 2026 12:23
@robfrank
robfrank force-pushed the feat/columnar-faceting-7-facets-advanced branch from 784eeed to 4310944 Compare November 6, 2026 12:23
@claude

claude Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review note: the GitHub API refuses to serve this diff (over 20,000 lines), so I could not do a line-by-line review. The PR comes from a maintainer, is part 7 of a stacked series, and carries its own reviewer map. I found nothing security-relevant from the description and file list. I did not read the code, so this is not an all-clear.

Suggested focus for human reviewers, taken from the PR's own review focus:

  • GROUP BY acceleration: it changes plans for existing queries on types with a COLUMNAR index. Eligibility should stay conservative, and I'd want equivalence tests against the non-accelerated path. That includes NULLs, multi-valued fields, and ordering and limit semantics.
  • Hierarchy definitions: check cycle detection and depth limits, so a malicious or malformed hierarchy cannot cause unbounded expansion or memory use.
  • DISTINCT (HyperLogLog): the result is approximate, so the docs should say so. Check the SQL-visible naming too.
  • facet.searchValues() and the prefix search with AFTER cursor: bound the result size and the cursor input.
  • Tests: follow the CLAUDE.md rules. Use no raw wall-clock assertions (use StallAwareStopwatch), no hardcoded ports, and tag slow tests.

🤖 Generated with Claude Code

@robfrank
robfrank force-pushed the feat/columnar-faceting-6-facets-transports branch from b470ed2 to 7f8ea68 Compare November 6, 2026 13:25
@robfrank
robfrank force-pushed the feat/columnar-faceting-7-facets-advanced branch from 4310944 to dd50e47 Compare November 6, 2026 13:25
@claude

claude Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review summary: this PR is too large for a line-by-line review here (122 files, GitHub's diff limit of 20000 lines exceeded), so this is a high-level pass only.

  • Author is a maintainer and the PR is part 7 of a stacked series. I did not find anything pointing to a deliberate security hazard, but I did not read the full diff.
  • GROUP BY acceleration changes plans for existing queries on types with a COLUMNAR index. Please keep a differential test (accelerated vs. non-accelerated results) covering NULLs, empty groups, type coercion, DISTINCT/aggregates and ORDER/LIMIT.
  • Hierarchy: confirm cycle detection and a depth/size bound on ancestor expansion so a malformed hierarchy can't cause unbounded memory or CPU use.
  • facet.searchValues() / AFTER cursor: confirm the page size is capped and the cursor is validated, so a client can't request an unbounded result set.
  • HLL: documented as approximate, good. Make sure the DISTINCT facet label makes this clear to API consumers.
  • Tests: new tests are about 60% of the change, which is good. Per CLAUDE.md, make sure none assert on raw wall-clock time (use StallAwakeStopwatch-style StallAwareStopwatch) and slow ones carry @Tag("slow").

🤖 Generated with Claude Code

@robfrank
robfrank changed the base branch from feat/columnar-faceting-6-facets-transports to main November 6, 2026 13:53
@robfrank
robfrank marked this pull request as ready for review November 6, 2026 13:53
@mergify

mergify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@robfrank

robfrank commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@claude review

@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Claude finished @robfrank's task in 23s —— View job


Review of #11344 (partial)

The diff is over GitHub's 20k-line limit. I read two files in full: ColumnarGroupByPlanner and AncestorExpander. I did not read the rest of the PR, and I did not build it or run any tests. This is not a full review.

ColumnarGroupByPlanner (the main risk, since it changes existing plans)

The eligibility check is conservative. It bails out on all of these:

  • WHERE, DISTINCT, EXPAND, UNWIND and LET.
  • LIMIT or SKIP without ORDER BY.
  • Projections added after ORDER BY.
  • Multi-key GROUP BY and non-bare properties.
  • Non-schema targets and timeseries types.
  • Aliases that clash with the group key.
  • Types where the index does not cover every bucket, including subtype buckets.
  • Properties that a subtype redeclares with a different type or as a list.

SUM and AVG are limited to INTEGER and LONG, and FLOAT and DOUBLE are excluded because the addition order differs. That is the right call.

Points to confirm in the tests, because I did not read ColumnarGroupByAccelerationTest:

  1. Planner reads schema only. The planner reads the schema only, and the step decides at run time whether the projection can answer. Please confirm there is an equivalence test for each fallback, against a plain scan: stale or lagging index, uncommitted transaction state, and buckets the caller cannot read (READ_RECORD).
  2. NULL keys and values. Check that count(prop), min and max skip NULLs exactly as the scan does. Check that the NULL group appears when the key is NULL.
  3. SUM overflow and AVG on integral columns. This relies on the NumericSum change in this PR (Issue9496NumericSumTest was extended). Please check that LONG overflow and the AVG result type (double vs. integral) match the legacy path.
  4. Row order. Without ORDER BY the accelerated step may return groups in a different order than the scan. That is legal SQL, but existing tests or users may depend on the old order.

AncestorExpander

  • Cycles and shared ancestors terminate because of the visited bitset. Work is bounded by nodeCount, since nodes is the stack and each node is pushed once. So there is no unbounded expansion from malformed data.
  • Range checks on parents and start nodes are assert only (AncestorExpander.java:56, :66, :69). With assertions off in production, a bad index becomes an ArrayIndexOutOfBoundsException or silent corruption. The 1L << node mask also wraps modulo 64, so a bad value in the last word would mark the wrong bit instead of failing. This is acceptable if HierarchyBuilder guarantees the range. A cheap explicit check that throws an exception would make it fail safe. Please confirm the builder, and the read of the persisted definition in HierarchyDefinition and ColumnarManifest, reject cycles, self-parents and over-deep chains.

Process items (carried over from the earlier bot reviews and the PR description)

  • This PR has no Maven CI until it targets main. Please run workflow_dispatch of mvn-test.yml on this branch before merging. For a change that alters existing GROUP BY plans, the engine suite is the real test.
  • Confirm that StallAwareStopwatch is used in the lag-floor tests, and that slow tests carry @Tag("slow").
  • Confirm that the user docs state DISTINCT (HLL) is approximate, with its error bound.

Not reviewed: SQLFunctionFacetSearchValues, DictionaryPrefixSearch, the collectors (HIERARCHY, DISTINCT, STATS), HierarchyManager, ColumnarGroupByStep and ColumnarGroupByAggregator, the grammar changes, the transports, and FacetExecutor (including the lag floor).

I found no security problem in the two files I read.

…hValues and GROUP BY acceleration

Part 7 of 9 of the columnar faceting series, umbrella #10355.
@robfrank
robfrank force-pushed the feat/columnar-faceting-7-facets-advanced branch from dd50e47 to 8117a77 Compare November 6, 2026 14:54
@claude

claude Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review note: this PR is about 17k lines and GitHub can't render its diff (over 20000 lines), so I could not do a line-by-line review. I spot-checked the new SQL function facet.searchValues().

  • It enforces per-bucket READ_RECORD permissions.
  • It caps the limit with arcadedb.columnar.topMax.
  • It bounds the search batches.
  • I found no unsafe constructs (reflection, process execution, deserialization) in the columnar and facet packages.

I did not check these items:

  • GROUP BY acceleration equivalence. This is the riskiest part, because it changes plans for existing queries on types that have a COLUMNAR index. Make sure the test suite compares accelerated results against the non-accelerated path, including nulls, multi-value properties and deleted or updated records.
  • Hierarchy cycle validation and invalidation of hierarchy views on page changes.
  • Nothing in the PR timings was checked, so wall-clock assertions in the new tests should use StallAwareStopwatch, per CLAUDE.md.

Because of the PR's size, splitting it up further would make it easier to review.

@robfrank
robfrank merged commit 58cf0f2 into main Nov 6, 2026
20 of 21 checks passed
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.32789% with 499 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.83%. Comparing base (7f8ea68) to head (8117a77).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
...m/arcadedb/query/facet/DistinctFacetCollector.java 74.87% 51 Missing and 50 partials ⚠️
.../arcadedb/query/facet/HierarchyFacetCollector.java 81.92% 30 Missing and 32 partials ⚠️
.../com/arcadedb/index/columnar/HierarchyManager.java 75.73% 27 Missing and 31 partials ⚠️
.../com/arcadedb/query/facet/StatsFacetCollector.java 79.77% 32 Missing and 22 partials ⚠️
...cadedb/query/sql/executor/ColumnarGroupByStep.java 77.58% 28 Missing and 24 partials ⚠️
...edb/query/sql/executor/ColumnarGroupByPlanner.java 71.12% 13 Missing and 28 partials ⚠️
...nction/sql/facet/SQLFunctionFacetSearchValues.java 83.33% 11 Missing and 19 partials ⚠️
.../query/sql/executor/ColumnarGroupByAggregator.java 90.81% 11 Missing and 15 partials ⚠️
.../arcadedb/index/columnar/ColumnarIndexManager.java 85.36% 3 Missing and 9 partials ⚠️
...ava/com/arcadedb/index/columnar/HierarchyView.java 81.57% 2 Missing and 5 partials ⚠️
... and 20 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11344      +/-   ##
==========================================
+ Coverage   79.74%   79.83%   +0.09%     
==========================================
  Files        2427     2442      +15     
  Lines      275677   278723    +3046     
  Branches    60451    61197     +746     
==========================================
+ Hits       219831   222523    +2692     
- Misses      33670    33794     +124     
- Partials    22176    22406     +230     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant