fix: frame_number is BIGINT in DB, use i64 not i32

frame_number column in face_detections table is defined as BIGINT (INT8).
Using i32 caused sqlx type mismatch at runtime. Fixed in:
- identity_agent_api.rs: query_as tuples and HashMap key
- qdrant_db.rs: upsert_face_embedding signature and row extraction
This commit is contained in:
Accusys
2026-05-25 04:07:30 +08:00
parent 25ec1625df
commit d7f89a962b
2 changed files with 5 additions and 5 deletions

View File

@@ -274,7 +274,7 @@ async fn match_from_trace(
// 1. Get 3 best face embeddings from this trace at different angles
// Divide trace frame range into 3 segments, pick best face from each
let fd_table = schema::table_name("face_detections");
let all_faces: Vec<(Vec<f32>, i32)> = sqlx::query_as::<_, (Vec<f32>, i32)>(&format!(
let all_faces: Vec<(Vec<f32>, i64)> = sqlx::query_as::<_, (Vec<f32>, i64)>(&format!(
"SELECT embedding, frame_number FROM {} \
WHERE file_uuid = $1 AND trace_id = $2 AND embedding IS NOT NULL \
ORDER BY frame_number ASC",
@@ -311,7 +311,7 @@ async fn match_from_trace(
let mut query_embeddings: Vec<Vec<f32>> = Vec::new();
// Get width*height info if available (not all pipelines store it)
let face_sizes: Vec<(i32, i32)> = sqlx::query_as::<_, (i32, i32)>(&format!(
let face_sizes: Vec<(i64, i32)> = sqlx::query_as::<_, (i64, i32)>(&format!(
"SELECT frame_number, COALESCE(width, 0) * COALESCE(height, 0) AS area \
FROM {} WHERE file_uuid = $1 AND trace_id = $2 AND embedding IS NOT NULL \
ORDER BY frame_number ASC",
@@ -323,7 +323,7 @@ async fn match_from_trace(
.await
.unwrap_or_default();
let face_sizes_map: std::collections::HashMap<i32, i32> = face_sizes.into_iter().collect();
let face_sizes_map: std::collections::HashMap<i64, i32> = face_sizes.into_iter().collect();
for (start, end) in segments {
let seg_start = start.min(total - 1);

View File

@@ -758,7 +758,7 @@ impl QdrantDb {
vector: &[f32],
file_uuid: &str,
trace_id: i32,
frame_number: i32,
frame_number: i64,
) -> Result<()> {
let url = format!(
"{}/collections/{}/points?wait=true",
@@ -889,7 +889,7 @@ pub async fn sync_face_embeddings(file_uuid: &str) -> Result<()> {
for row in &rows {
let id: i32 = row.get(0);
let trace_id: Option<i32> = row.get(1);
let frame_number: i32 = row.get(2);
let frame_number: i64 = row.get(2);
let embedding: Option<Vec<f32>> = row.get(3);
if let (Some(emb), Some(tid)) = (embedding, trace_id) {