Skip to content

implement all point update operation constructors#7424

Merged
generall merged 1 commit intodevfrom
edge-point-update-ops
Oct 20, 2025
Merged

implement all point update operation constructors#7424
generall merged 1 commit intodevfrom
edge-point-update-ops

Conversation

@generall
Copy link
Copy Markdown
Member

No description provided.

@generall generall requested a review from ffuugoo October 19, 2025 22:22
@generall generall force-pushed the edge-point-update-ops branch from 4850009 to c22974f Compare October 19, 2025 22:23
Base automatically changed from edge-filter-conversions to dev October 20, 2025 08:36
@generall generall force-pushed the edge-point-update-ops branch from c22974f to 6a3523e Compare October 20, 2025 08:37
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
lib/edge/python/src/types/point_vectors.rs (1)

9-23: New PyPointVectors wrapper — good; add Python signature for discoverability.

Constructor is clean and infallible. Add an explicit Python signature for help() output.

 #[pymethods]
 impl PyPointVectors {
-    #[new]
+    #[new]
+    #[pyo3(text_signature = "(id, vector)")]
     pub fn new(id: PyPointId, vector: PyVector) -> Self {
         Self(PointVectorsPersisted {
             id: PointIdType::from(id),
             vector: VectorStructPersisted::from(vector),
         })
     }
 }
lib/edge/python/src/update.rs (3)

34-51: Param naming consistency: use “filter” instead of “condition”.

All other constructors use filter. Rename for a consistent Python API.

-    pub fn upsert_points_conditional(points: Vec<PyPoint>, condition: PyFilter) -> Self {
+    pub fn upsert_points_conditional(points: Vec<PyPoint>, filter: PyFilter) -> Self {
         let points = points.into_iter().map(PointStructPersisted::from).collect();
         let points_op = PointInsertOperationsInternal::PointsList(points);

-        let condition = Filter::from(condition);
+        let condition = Filter::from(filter);

133-157: Add text_signature for Python help() across constructors.

Many methods expose non-obvious arg orders. Add #[pyo3(text_signature = "...")] for parity with existing payload methods.

Examples:

 #[staticmethod]
+#[pyo3(text_signature = "(points)")]
 pub fn upsert_points(points: Vec<PyPoint>) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(points, filter)")]
 pub fn upsert_points_conditional(points: Vec<PyPoint>, filter: PyFilter) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(ids)")]
 pub fn delete_points(ids: Vec<PyPointId>) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(filter)")]
 pub fn delete_points_by_filter(filter: PyFilter) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(point_vectors)")]
 pub fn update_vectors(point_vectors: Vec<PyPointVectors>) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(point_vectors, filter)")]
 pub fn update_vectors_conditional(point_vectors: Vec<PyPointVectors>, filter: PyFilter) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(ids, vector_names)")]
 pub fn delete_vectors(ids: Vec<PyPointId>, vector_names: Vec<String>) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(filter, vector_names)")]
 pub fn delete_vectors_by_filter(filter: PyFilter, vector_names: Vec<String>) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(ids)")]
 pub fn clear_payload(ids: Vec<PyPointId>) -> Self { ... }

 #[staticmethod]
+#[pyo3(text_signature = "(filter)")]
 pub fn clear_payload_by_filter(filter: PyFilter) -> Self { ... }

Also applies to: 159-182, 184-202, 204-221, 242-266, 268-291


143-147: Error message can include parse failure detail for JsonPath.

Currently raises the key string only. Prefer the parser’s error to aid debugging.

-    .map(|k| JsonPath::from_str(&k).map_err(|_| PyErr::new::<PyValueError, _>(k)))
+    .map(|k| JsonPath::from_str(&k)
+        .map_err(|e| PyErr::new::<PyValueError, _>(format!("invalid json path '{}': {}", k, e))))

Also applies to: 169-172, 189-193, 209-212, 252-255, 279-281

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56a9610 and 6a3523e.

📒 Files selected for processing (5)
  • lib/edge/python/src/lib.rs (1 hunks)
  • lib/edge/python/src/types/mod.rs (1 hunks)
  • lib/edge/python/src/types/point_vectors.rs (1 hunks)
  • lib/edge/python/src/update.rs (1 hunks)
  • lib/edge/python/src/update/upsert.rs (0 hunks)
💤 Files with no reviewable changes (1)
  • lib/edge/python/src/update/upsert.rs
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (.github/review-rules.md)

**/*.rs: Prefer explicit SomeType::from(x) over implicit x.into() in Rust code
Do not use transmute_from_u8, transmute_to_u8, transmute_from_u8_to_slice, transmute_from_u8_to_mut_slice, transmute_to_u8_slice in new code; use bytemuck or zerocopy instead

Files:

  • lib/edge/python/src/types/mod.rs
  • lib/edge/python/src/types/point_vectors.rs
  • lib/edge/python/src/lib.rs
  • lib/edge/python/src/update.rs
**/src/**/*.rs

📄 CodeRabbit inference engine (.github/review-rules.md)

**/src/**/*.rs: Prefer exhaustive match arms over a catch-all _ arm to avoid missing new enum variants (except in tests/benchmarks or when provably safe)
Prefer explicit field ignoring with : _ over .. in struct patterns (except in tests/benchmarks or when provably safe)

Files:

  • lib/edge/python/src/types/mod.rs
  • lib/edge/python/src/types/point_vectors.rs
  • lib/edge/python/src/lib.rs
  • lib/edge/python/src/update.rs
🧬 Code graph analysis (1)
lib/edge/python/src/update.rs (6)
lib/segment/src/json_path/parse.rs (1)
  • json_path (28-40)
lib/edge/python/src/types/filter/condition.rs (8)
  • from (29-51)
  • from (55-80)
  • PyErr (92-92)
  • PyErr (109-109)
  • new (90-97)
  • new (107-113)
  • new (123-126)
  • new (136-138)
lib/edge/python/src/types/point_id.rs (1)
  • into_rust_vec (15-18)
lib/edge/python/src/types/point.rs (2)
  • payload (36-38)
  • new (15-23)
lib/edge/python/src/types/point_vectors.rs (1)
  • new (17-22)
lib/edge/python/src/types/filter.rs (1)
  • new (26-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: rust-tests (macos-latest)
  • GitHub Check: rust-tests (ubuntu-latest)
  • GitHub Check: rust-tests-no-rocksdb (ubuntu-latest)
  • GitHub Check: lint
  • GitHub Check: rust-tests (windows-latest)
  • GitHub Check: integration-tests
  • GitHub Check: integration-tests-consensus
🔇 Additional comments (3)
lib/edge/python/src/types/mod.rs (1)

5-5: Module re-export looks good.

New point_vectors module and re-export are correct and consistent with the types surface.

Also applies to: 13-13

lib/edge/python/src/lib.rs (1)

51-51: Exporting PyPointVectors — LGTM.

PyPointVectors is now reachable under qdrant_edge. No issues.

lib/edge/python/src/update.rs (1)

112-122: Review comment is incorrect. VectorNameBuf is a type alias for String, not a custom struct.

VectorNameBuf is defined as pub type VectorNameBuf = String, making Vec<VectorNameBuf> equivalent to Vec<String>. PyO3 provides full FromPyObject support for Vec<String>, so the current method signatures are already compatible with Python interop. The suggested fix is unnecessary as it would only convert String to VectorNameBuf (String), which is redundant. No changes are required.

Likely an incorrect or invalid review comment.

Comment on lines +77 to +91
pub fn update_vectors(point_vectors: Vec<PyPointVectors>) -> Self {
let points = point_vectors
.into_iter()
.map(PointVectorsPersisted::from)
.collect();

let operation = CollectionUpdateOperations::VectorOperation(
vector_ops::VectorOperations::UpdateVectors(vector_ops::UpdateVectorsOp {
points,
update_filter: None,
}),
);

Self(operation)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Compile error: From for PointVectorsPersisted is not implementable (orphan rule). Use Into instead.

map(PointVectorsPersisted::from) won’t compile; From can’t be implemented for a foreign target type. Convert via the local wrapper’s Into.

     pub fn update_vectors(point_vectors: Vec<PyPointVectors>) -> Self {
-        let points = point_vectors
-            .into_iter()
-            .map(PointVectorsPersisted::from)
-            .collect();
+        let points = point_vectors
+            .into_iter()
+            .map(std::convert::Into::into)
+            .collect();

     pub fn update_vectors_conditional(
         point_vectors: Vec<PyPointVectors>,
         filter: PyFilter,
     ) -> Self {
-        let points = point_vectors
-            .into_iter()
-            .map(PointVectorsPersisted::from)
-            .collect();
+        let points = point_vectors
+            .into_iter()
+            .map(std::convert::Into::into)
+            .collect();

Also applies to: 95-110

🤖 Prompt for AI Agents
In lib/edge/python/src/update.rs around lines 77 to 91 (and similarly at 95 to
110), the code uses PointVectorsPersisted::from in map(...) which fails the
orphan rule because From<PyPointVectors> for PointVectorsPersisted cannot be
implemented; change those conversions to use Into by replacing
map(PointVectorsPersisted::from) with map(Into::into) or map(|pv:
PyPointVectors| pv.into()) so the local wrapper's Into impl is used; apply the
same change to the other block at 95-110.

@ffuugoo ffuugoo added this to the Qdrant on Edge milestone Oct 20, 2025
@generall generall merged commit 75434ca into dev Oct 20, 2025
20 of 27 checks passed
@generall generall deleted the edge-point-update-ops branch October 20, 2025 10:39
@qdrant qdrant deleted a comment from coderabbitai Bot Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants