Skip to content

Add null filters and bounded Boolean filter groups #17

Description

@vara-bonthu

Problem

The semantic query API combines all request filters with AND. It also does not support common null operations.

The API cannot represent questions such as:

  • Which accounts have no assigned customer-success manager?
  • Which contracts have no renewal date?
  • Which accounts are enterprise customers or are located in EMEA?
  • Which tickets are escalated or outside SLA?

Proposed solution

Extend the request filter model with:

  • IS NULL
  • IS NOT NULL
  • NOT LIKE
  • Explicit AND groups
  • Explicit OR groups
  • A bounded nesting depth
  • A bounded total predicate count

Example:

{
  "filter": {
    "or": [
      {
        "field": "account.segment",
        "op": "=",
        "value": "Enterprise"
      },
      {
        "field": "account.region",
        "op": "=",
        "value": "EMEA"
      }
    ]
  }
}

All referenced fields must still resolve through the compiled model and pass governance checks.
The request must never accept raw SQL predicates.

Implementation areas

  • internal/planner/plan.go
  • internal/planner/plan_sql.go
  • internal/serving/limits.go
  • internal/serving/mcp/mcp.go
  • REST and planner tests

Acceptance criteria

  • IS NULL and IS NOT NULL are supported.
  • NOT LIKE is supported.
  • Explicit AND and OR groups are supported.
  • Nesting depth and total predicates are bounded.
  • Every referenced field is authorized.
  • Raw SQL cannot enter the filter tree.
  • Request hashing includes the complete filter structure.
  • StarRocks and Trino emit equivalent Boolean semantics.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions