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

Open
#3,093 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
java
Domain
databases

Research direction

Start by tracing the index-planning path affected by PR #2994 and review the related context in #2992. Reproduce the negative-label query examples with indexed and unindexed labels, then add coverage for neq, NOT_IN, multi-label cases, and paging or limits. Done means no eligible label is skipped and incomplete coverage never produces a partial result.

Written by the indexing model from the issue text.

Description

feature improvement
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

Dominant language
Java
Stars
3.2k
Forks
637
Avg merge
3d 18h
Merged PRs (30d)
23

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/hugegraph

All issues in apache/hugegraph

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.