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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user