Skip to content

Columnar faceting: expose the facets of a result set in both packages #290

Closed

Description

@robfrank

Part of #289 (columnar faceting in the Python bindings).

Scope

  • Expose the facets of a result set in both packages: an accessor on the result set (for example result_set.facets) returning the engine's FacetResults as Python data: meta (exact, patched, lag_ms) and one entry per facet alias with type, source, optional reason, buckets (value or key, from, to, count, plus the missing and default flags), other_count for terms and missing.
  • Facets that are unavailable (with a reason) are surfaced, not dropped.
  • Non-finite numbers in facet values (NaN, +/-Infinity) decode to the Python floats, as rows do.
  • Native package: check how the ctypes bridge exposes a result set and add what is needed to read the facets (for example one entry point returning the facets as JSON). The JVM package reads getFacets() through JPype.
  • Input parameters in RANGES and INCLUDE work from query(...) and command(...).

Tests

TERMS, RANGES, a calendar HISTOGRAM, a disjunctive FILTER and an unavailable facet, in the JVM and native lanes, comparing against the same query's GROUP BY counts.

Activity

  1. added this to the 26.12.1 milestone on Nov 6, 2026
  2. self-assigned this
    on Nov 6, 2026
  3. added
    enhancementNew feature or request
    pythonPull requests that update python code
    on Nov 6, 2026
  4. tae898 commented on Nov 6, 2026

    @tae898
    Collaborator

    I will start here after the CI change. For the native package, ArcadeNative.batchOf closes the cursor when the last batch is read, so I will add the facets to that last reply as JSON from rs.getFacets(), and make the lazy Prefetched cursors pass getFacets() on (without that every facet would be silently lost). NaN and the infinities will travel in the same tag rows use, through FacetResults.toJSON(ValueEncoder), so they decode to Python floats. For arcadedb-jvm I will read getFacets() through a bridge call.

    The accessor is result_set.facets, with meta (exact, patched, lag_ms) and one entry per alias, unavailable ones included. I follow the engine's rule: rows first, and asking for facets before the rows are read ends the rows. Tell me if you want a different behaviour.

    Two things I will check first: whether getFacets() still works after the engine closes the result set, and whether the native image needs the new parser classes (FacetsClause, FacetItem, FacetRangeItem) in its reflection metadata. Both go into the tests.

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestin progressThe team is actively working on this issuepythonPull requests that update python code

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions