Commit 0159b0a
issue: #2924
Support geometry types for pymilvus
This pull request adds support for the `GEOMETRY` data type throughout
the bulk writing and search result handling code in PyMilvus. The main
changes ensure that geometry data is correctly validated, encoded,
decoded, and handled in all relevant utility and helper functions.
Geometry values are stored as bytes (with string values encoded as
UTF-8), and decoding is performed when reading results.
**Support for GEOMETRY data type**
* Added validation logic for `DataType.GEOMETRY` in `constants.py`,
allowing geometry data to be either `str` or `bytes`.
* Implemented encoding of geometry values to bytes in
`pack_field_value_to_field_data` and `entity_to_field_data`, handling
both string (WKT) and bytes input.
[[1]](diffhunk://#diff-0c1494647658a30477e2d780c6bc64f56ef49b14c79027428e3cd70bb491c3c5R449-R469)
[[2]](diffhunk://#diff-0c1494647658a30477e2d780c6bc64f56ef49b14c79027428e3cd70bb491c3c5R560-R573)
**Geometry data decoding and assignment**
* Updated assignment and append logic in `entity_helper.py` to decode
geometry bytes back to strings when possible, both in batch assignment
and single row extraction.
[[1]](diffhunk://#diff-0c1494647658a30477e2d780c6bc64f56ef49b14c79027428e3cd70bb491c3c5R760-R772)
[[2]](diffhunk://#diff-0c1494647658a30477e2d780c6bc64f56ef49b14c79027428e3cd70bb491c3c5R863-R878)
**Search result integration**
* Added `GEOMETRY` to supported types in search result parsing and
implemented decoding logic for geometry fields in search result
extraction and field data retrieval.
[[1]](diffhunk://#diff-76d170285437d4f74831de67c329c80a2e84cfa1b65375229198810a3e65b2e6R58)
[[2]](diffhunk://#diff-76d170285437d4f74831de67c329c80a2e84cfa1b65375229198810a3e65b2e6R352-R368)
[[3]](diffhunk://#diff-76d170285437d4f74831de67c329c80a2e84cfa1b65375229198810a3e65b2e6R474-R475)
**Utility function updates**
* Updated `len_of` utility to support length calculation for geometry
data fields.
---------
Signed-off-by: Yinwei Li <[email protected]>
Signed-off-by: Cai Zhang <[email protected]>
Co-authored-by: ZhuXi <[email protected]>
1 parent 626c573 commit 0159b0a
File tree
7 files changed
+75
-33
lines changed- pymilvus
- bulk_writer
- client
- grpc_gen
7 files changed
+75
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
502 | 515 | | |
503 | 516 | | |
504 | 517 | | |
| |||
589 | 602 | | |
590 | 603 | | |
591 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
592 | 609 | | |
593 | 610 | | |
594 | 611 | | |
| |||
775 | 792 | | |
776 | 793 | | |
777 | 794 | | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
778 | 800 | | |
779 | 801 | | |
780 | 802 | | |
| |||
894 | 916 | | |
895 | 917 | | |
896 | 918 | | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
897 | 931 | | |
898 | 932 | | |
899 | 933 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
405 | 415 | | |
406 | 416 | | |
407 | 417 | | |
| |||
521 | 531 | | |
522 | 532 | | |
523 | 533 | | |
| 534 | + | |
| 535 | + | |
524 | 536 | | |
525 | 537 | | |
526 | 538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments