Files
milvus/docs/design-docs/design_docs/20220105-query_boolean_expr.md
T
dd6a411e5e doc: add design docs directory (#49829)
issue: #49831

## What changed

Vendor Milvus design documents into this repository under
`docs/design-docs` as regular tracked files.

- Keep only the design document content and assets under
`docs/design-docs/design_docs/` and `docs/design-docs/assets/`.
- Remove standalone repository metadata from the vendored directory,
such as `README.md`, `CONTRIBUTING.md`, `MEP-TEMPLATE.md`, `COMMITTERS`,
`MAINTAINERS`, `OWNERS`, `OWNERS_ALIASES`, and `.gitignore`.
- Document the Milvus design document process in the main
`CONTRIBUTING.md`.
- Update Mergify and `tools/mgit.py` so feature PRs must provide an
in-repo design document path under `docs/design-docs/design_docs/`.

## Why

Milvus feature work should have an associated design document. Keeping
design docs directly in this repository makes them available from a
normal Milvus checkout and lets feature implementations include or link
the related design document in the same repository.

## Verification

- `git diff --check`
- `python3 -m unittest tools/test_mgit_design_doc.py`
- `python3 -m py_compile tools/mgit.py tools/test_mgit_design_doc.py`
- Parsed `.github/mergify.yml` with Python `yaml.safe_load`
- Confirmed `docs/design-docs` only contains `assets/` and
`design_docs/` at the top level

---------

Signed-off-by: xiaofanluan <xiaofan.luan@zilliz.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 18:56:24 +08:00

1.8 KiB
Raw Blame History

Expr :=
    LogicalExpr | NIL

LogicalExpr :=
    LogicalExpr BinaryLogicalOp LogicalExpr
  | UnaryLogicalOp LogicalExpr
  | "(" LogicalExpr ")"
  | SingleExpr

BinaryLogicalOp :=
    "&&" | "and"
  | "||" | "or"

UnaryLogicalOp :=
    "not"

SingleExpr :=
    TermExpr
  | CompareExpr

TermExpr :=
    IDENTIFIER "in" ConstantArray

ConstantArray :=
    "[" ConstantExpr { "," ConstantExpr } "]"

ConstantExpr :=
    Constant
  | ConstantExpr BinaryArithOp ConstantExpr
  | UnaryArithOp ConstantExpr

Constant :=
    INTEGER
  | FLOAT_NUMBER

UnaryArithOp :=
    "+"
  | "-"

BinaryArithOp :=
    "+"
  | "-"
  | "*"
  | "/"
  | "%"
  | "**"

CompareExpr :=
    IDENTIFIER CmpOp IDENTIFIER
  | IDENTIFIER CmpOp ConstantExpr
  | ConstantExpr CmpOp IDENTIFIER
  | ConstantExpr CmpOpRestricted IDENTIFIER CmpOpRestricted ConstantExpr

CmpOpRestricted :=
    "<"
  | "<="

CmpOp :=
    ">"
  | ">="
  | "<"
  | "<="
  | "=="
  | "!="

INTEGER := 整数
FLOAT_NUM := 浮点数
IDENTIFIER := 列名

Tips:

  1. NIL represents an empty string, which means there is no Predicate for Expr.
  2. Gramma is described by EBNF syntax, expressions that may be omitted or repeated are represented through curly braces {...}.

After syntax analysis, the following rules will be applied:

  1. Non-vector column must exist in Schema.
  2. CompareExpr/TermExpr requires operand type matching.
  3. CompareExpr between non-vector columns of different types is available.
  4. The modulo operation requires all operands to be integers.
  5. Integer columns can only match integer operands. While float columns can match both integer and float operands.
  6. In BinaryOp, the and/&& operator has a higher priority than the or/|| operator.

Example

A > 3 && A < 4 && (C > 5 || D < 6)
1 < A <= 2.0 + 3 - 4 * 5 / 6 % 7 ** 8
A == B
FloatCol in [1.0, 2, 3.0]
Int64Col in [1, 2, 3] or C != 6