Skip to content

[Improve]: support negative-label property queries with complete index coverage #3093

Description

@contrueCT

Feature Description (功能描述)

Background

PR #2994 keeps queries that combine a negative label predicate with user-property
filters on the conservative no-index path. This prevents an index plan from
returning only the subset of labels that happen to have a compatible index.

Problem

Consider:

g.V().has(T.label, P.neq("author")).has("city", "Beijing")

The labels that can satisfy this query may include person, fan, and
follower. If only person has a city index, selecting that index returns
matching person vertices while silently omitting matching fan and
follower vertices.
An available partial index must never be used when it cannot produce a complete
candidate set.

Goal

Safely support negative-label predicates combined with property filters while
preserving complete query results.

Requirements

  • Determine all schema labels that can satisfy the negative-label predicate and
  • expose the queried property.
  • Select an index plan only when every eligible label has compatible index
  • coverage.
  • When coverage is incomplete, either reject with NoIndexException or use an
  • explicitly bounded complete-scan plan.
  • Never return a partial indexed subset as the query result.
  • Preserve the current behavior of pure label predicates, for example:
  • g.V().has(T.label, P.neq("author")).
  • Cover neq, NOT_IN / equivalent flattened predicates, and multi-label
  • cases where only some labels are indexed.
  • Add tests that verify no eligible label is skipped and that paging/limit are
  • applied only after a complete candidate set is established.

Related

#2992
PR #2994

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions