Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

perf(personhog-replica): skip serde_json parse for opaque JSON fields (#60015)

José Sequeira526f5aca6882
diff --git a/rust/personhog-replica/.sqlx/query-105e10ee3129431a37262e780eae887714ad18386489ab622dd4dd63d7b269c6.json b/rust/personhog-replica/.sqlx/query-0f3385bfea22438ccc365da5ecca78530e1f61f334661fc69bc0d4cdb8848f06.json
similarity index 55%
rename from rust/personhog-replica/.sqlx/query-105e10ee3129431a37262e780eae887714ad18386489ab622dd4dd63d7b269c6.json
rename to rust/personhog-replica/.sqlx/query-0f3385bfea22438ccc365da5ecca78530e1f61f334661fc69bc0d4cdb8848f06.json
index a9c713e3f1f2..08051d2f3972 100644
--- a/rust/personhog-replica/.sqlx/query-105e10ee3129431a37262e780eae887714ad18386489ab622dd4dd63d7b269c6.json
+++ b/rust/personhog-replica/.sqlx/query-0f3385bfea22438ccc365da5ecca78530e1f61f334661fc69bc0d4cdb8848f06.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT p.id, p.uuid, p.team_id::bigint as \"team_id!\", p.properties,\n p.properties_last_updated_at, p.properties_last_operation,\n p.created_at, p.version, p.is_identified,\n CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,\n p.last_seen_at\n FROM posthog_person p\n INNER JOIN posthog_persondistinctid d ON p.id = d.person_id AND p.team_id = d.team_id\n WHERE p.team_id = $1 AND d.distinct_id = $2\n LIMIT 1\n ",
+ "query": "\n SELECT p.id, p.uuid, p.team_id::bigint as \"team_id!\", p.properties::text as \"properties!\",\n p.properties_last_updated_at::text as \"properties_last_updated_at?\",\n p.properties_last_operation::text as \"properties_last_operation?\",\n p.created_at, p.version, p.is_identified,\n CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,\n p.last_seen_at\n FROM posthog_person p\n INNER JOIN posthog_persondistinctid d ON p.id = d.person_id AND p.team_id = d.team_id\n WHERE p.team_id = $1 AND d.distinct_id = $2\n LIMIT 1\n ",
"describe": {
"columns": [
{
@@ -20,18 +20,18 @@
},
{
"ordinal": 3,
- "name": "properties",
- "type_info": "Jsonb"
+ "name": "properties!",
+ "type_info": "Text"
},
{
"ordinal": 4,
- "name": "properties_last_updated_at",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 5,
- "name": "properties_last_operation",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 6,
@@ -69,9 +69,9 @@
false,
false,
null,
- false,
- true,
- true,
+ null,
+ null,
+ null,
false,
true,
false,
@@ -79,5 +79,5 @@
true
]
},
- "hash": "105e10ee3129431a37262e780eae887714ad18386489ab622dd4dd63d7b269c6"
+ "hash": "0f3385bfea22438ccc365da5ecca78530e1f61f334661fc69bc0d4cdb8848f06"
}
diff --git a/rust/personhog-replica/.sqlx/query-4bfdba594761909a371917ed0cd3baa16ac8749c7dc378183a049ced998fc94e.json b/rust/personhog-replica/.sqlx/query-1398eece8dfe37bbd9fce78a47cf1e59ebc2ffefe7d40098e58563b70dc53a03.json
similarity index 59%
rename from rust/personhog-replica/.sqlx/query-4bfdba594761909a371917ed0cd3baa16ac8749c7dc378183a049ced998fc94e.json
rename to rust/personhog-replica/.sqlx/query-1398eece8dfe37bbd9fce78a47cf1e59ebc2ffefe7d40098e58563b70dc53a03.json
index aa2d0e1725dd..adab4953d6f0 100644
--- a/rust/personhog-replica/.sqlx/query-4bfdba594761909a371917ed0cd3baa16ac8749c7dc378183a049ced998fc94e.json
+++ b/rust/personhog-replica/.sqlx/query-1398eece8dfe37bbd9fce78a47cf1e59ebc2ffefe7d40098e58563b70dc53a03.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id, uuid, team_id::bigint as \"team_id!\", properties,\n properties_last_updated_at, properties_last_operation,\n created_at, version, is_identified,\n CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,\n last_seen_at\n FROM posthog_person\n WHERE team_id = $1 AND id = ANY($2)\n ",
+ "query": "\n SELECT id, uuid, team_id::bigint as \"team_id!\", properties::text as \"properties!\",\n properties_last_updated_at::text as \"properties_last_updated_at?\",\n properties_last_operation::text as \"properties_last_operation?\",\n created_at, version, is_identified,\n CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,\n last_seen_at\n FROM posthog_person\n WHERE team_id = $1 AND id = ANY($2)\n ",
"describe": {
"columns": [
{
@@ -20,18 +20,18 @@
},
{
"ordinal": 3,
- "name": "properties",
- "type_info": "Jsonb"
+ "name": "properties!",
+ "type_info": "Text"
},
{
"ordinal": 4,
- "name": "properties_last_updated_at",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 5,
- "name": "properties_last_operation",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 6,
@@ -69,9 +69,9 @@
false,
false,
null,
- false,
- true,
- true,
+ null,
+ null,
+ null,
false,
true,
false,
@@ -79,5 +79,5 @@
true
]
},
- "hash": "4bfdba594761909a371917ed0cd3baa16ac8749c7dc378183a049ced998fc94e"
+ "hash": "1398eece8dfe37bbd9fce78a47cf1e59ebc2ffefe7d40098e58563b70dc53a03"
}
diff --git a/rust/personhog-replica/.sqlx/query-7153c106cc8be59b7efb7aec0ee7a368979effba33117ebb08cf5cf633dc0290.json b/rust/personhog-replica/.sqlx/query-43acf336bedec8a3529ce380bb6525315ca329b5d8f558ca7a6f8acaffe9d194.json
similarity index 58%
rename from rust/personhog-replica/.sqlx/query-7153c106cc8be59b7efb7aec0ee7a368979effba33117ebb08cf5cf633dc0290.json
rename to rust/personhog-replica/.sqlx/query-43acf336bedec8a3529ce380bb6525315ca329b5d8f558ca7a6f8acaffe9d194.json
index 20eb53d06bf9..dc55aa173b62 100644
--- a/rust/personhog-replica/.sqlx/query-7153c106cc8be59b7efb7aec0ee7a368979effba33117ebb08cf5cf633dc0290.json
+++ b/rust/personhog-replica/.sqlx/query-43acf336bedec8a3529ce380bb6525315ca329b5d8f558ca7a6f8acaffe9d194.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id::bigint as \"id!\", team_id::bigint as \"team_id!\",\n group_type_index, group_key, group_properties,\n created_at,\n properties_last_updated_at as \"properties_last_updated_at?: serde_json::Value\",\n properties_last_operation as \"properties_last_operation?: serde_json::Value\",\n version\n FROM posthog_group\n WHERE team_id = $1 AND group_type_index = $2 AND group_key = $3\n ",
+ "query": "\n SELECT id::bigint as \"id!\", team_id::bigint as \"team_id!\",\n group_type_index, group_key, group_properties::text as \"group_properties!\",\n created_at,\n properties_last_updated_at::text as \"properties_last_updated_at?\",\n properties_last_operation::text as \"properties_last_operation?\",\n version\n FROM posthog_group\n WHERE team_id = $1 AND group_type_index = $2 AND group_key = $3\n ",
"describe": {
"columns": [
{
@@ -25,8 +25,8 @@
},
{
"ordinal": 4,
- "name": "group_properties",
- "type_info": "Jsonb"
+ "name": "group_properties!",
+ "type_info": "Text"
},
{
"ordinal": 5,
@@ -35,13 +35,13 @@
},
{
"ordinal": 6,
- "name": "properties_last_updated_at?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 7,
- "name": "properties_last_operation?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 8,
@@ -61,12 +61,12 @@
null,
false,
false,
+ null,
false,
- false,
- false,
- false,
+ null,
+ null,
false
]
},
- "hash": "7153c106cc8be59b7efb7aec0ee7a368979effba33117ebb08cf5cf633dc0290"
+ "hash": "43acf336bedec8a3529ce380bb6525315ca329b5d8f558ca7a6f8acaffe9d194"
}
diff --git a/rust/personhog-replica/.sqlx/query-be936636d2f2db01295a331b3e4a0137b0b74ded1c3847e4f1af8855577533b7.json b/rust/personhog-replica/.sqlx/query-615f7144531be919f6d8e47fefc1ae6603bb521280162b13751bb864581e8bb1.json
similarity index 59%
rename from rust/personhog-replica/.sqlx/query-be936636d2f2db01295a331b3e4a0137b0b74ded1c3847e4f1af8855577533b7.json
rename to rust/personhog-replica/.sqlx/query-615f7144531be919f6d8e47fefc1ae6603bb521280162b13751bb864581e8bb1.json
index 8a4879a82932..83cfd2d9d780 100644
--- a/rust/personhog-replica/.sqlx/query-be936636d2f2db01295a331b3e4a0137b0b74ded1c3847e4f1af8855577533b7.json
+++ b/rust/personhog-replica/.sqlx/query-615f7144531be919f6d8e47fefc1ae6603bb521280162b13751bb864581e8bb1.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id, uuid, team_id::bigint as \"team_id!\", properties,\n properties_last_updated_at, properties_last_operation,\n created_at, version, is_identified,\n CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,\n last_seen_at\n FROM posthog_person\n WHERE team_id = $1 AND id = $2\n ",
+ "query": "\n SELECT id, uuid, team_id::bigint as \"team_id!\", properties::text as \"properties!\",\n properties_last_updated_at::text as \"properties_last_updated_at?\",\n properties_last_operation::text as \"properties_last_operation?\",\n created_at, version, is_identified,\n CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,\n last_seen_at\n FROM posthog_person\n WHERE team_id = $1 AND id = $2\n ",
"describe": {
"columns": [
{
@@ -20,18 +20,18 @@
},
{
"ordinal": 3,
- "name": "properties",
- "type_info": "Jsonb"
+ "name": "properties!",
+ "type_info": "Text"
},
{
"ordinal": 4,
- "name": "properties_last_updated_at",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 5,
- "name": "properties_last_operation",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 6,
@@ -69,9 +69,9 @@
false,
false,
null,
- false,
- true,
- true,
+ null,
+ null,
+ null,
false,
true,
false,
@@ -79,5 +79,5 @@
true
]
},
- "hash": "be936636d2f2db01295a331b3e4a0137b0b74ded1c3847e4f1af8855577533b7"
+ "hash": "615f7144531be919f6d8e47fefc1ae6603bb521280162b13751bb864581e8bb1"
}
diff --git a/rust/personhog-replica/.sqlx/query-a8951cf2dd0ace53aaea85c8e1696b77a90915676d818577dbeb91c84297560e.json b/rust/personhog-replica/.sqlx/query-71edb79c6808f467307e051bf29514c2e31473d02255ef7650e5b6f28eb55d81.json
similarity index 67%
rename from rust/personhog-replica/.sqlx/query-a8951cf2dd0ace53aaea85c8e1696b77a90915676d818577dbeb91c84297560e.json
rename to rust/personhog-replica/.sqlx/query-71edb79c6808f467307e051bf29514c2e31473d02255ef7650e5b6f28eb55d81.json
index 78ccce2feb82..a2a60d7d3d0e 100644
--- a/rust/personhog-replica/.sqlx/query-a8951cf2dd0ace53aaea85c8e1696b77a90915676d818577dbeb91c84297560e.json
+++ b/rust/personhog-replica/.sqlx/query-71edb79c6808f467307e051bf29514c2e31473d02255ef7650e5b6f28eb55d81.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n INSERT INTO posthog_group (team_id, group_type_index, group_key, group_properties, created_at, properties_last_updated_at, properties_last_operation, version)\n VALUES ($1, $2, $3, $4, $5, '{}'::jsonb, '{}'::jsonb, 0)\n RETURNING id::bigint as \"id!\", team_id::bigint as \"team_id!\",\n group_type_index, group_key, group_properties,\n created_at,\n properties_last_updated_at as \"properties_last_updated_at?: serde_json::Value\",\n properties_last_operation as \"properties_last_operation?: serde_json::Value\",\n version\n ",
+ "query": "\n INSERT INTO posthog_group (team_id, group_type_index, group_key, group_properties, created_at, properties_last_updated_at, properties_last_operation, version)\n VALUES ($1, $2, $3, $4, $5, '{}'::jsonb, '{}'::jsonb, 0)\n RETURNING id::bigint as \"id!\", team_id::bigint as \"team_id!\",\n group_type_index, group_key, group_properties::text as \"group_properties!\",\n created_at,\n properties_last_updated_at::text as \"properties_last_updated_at?\",\n properties_last_operation::text as \"properties_last_operation?\",\n version\n ",
"describe": {
"columns": [
{
@@ -25,8 +25,8 @@
},
{
"ordinal": 4,
- "name": "group_properties",
- "type_info": "Jsonb"
+ "name": "group_properties!",
+ "type_info": "Text"
},
{
"ordinal": 5,
@@ -35,13 +35,13 @@
},
{
"ordinal": 6,
- "name": "properties_last_updated_at?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 7,
- "name": "properties_last_operation?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 8,
@@ -63,12 +63,12 @@
null,
false,
false,
+ null,
false,
- false,
- false,
- false,
+ null,
+ null,
false
]
},
- "hash": "a8951cf2dd0ace53aaea85c8e1696b77a90915676d818577dbeb91c84297560e"
+ "hash": "71edb79c6808f467307e051bf29514c2e31473d02255ef7650e5b6f28eb55d81"
}
diff --git a/rust/personhog-replica/.sqlx/query-c8b20cb866d4f01c146a8917654801350da98eee49003dddbb883b5e739b0b98.json b/rust/personhog-replica/.sqlx/query-73a0e91e0d6f971bf07ad975a662e903a898f8d4b6807304b2f57c93b9b045a6.json
similarity index 71%
rename from rust/personhog-replica/.sqlx/query-c8b20cb866d4f01c146a8917654801350da98eee49003dddbb883b5e739b0b98.json
rename to rust/personhog-replica/.sqlx/query-73a0e91e0d6f971bf07ad975a662e903a898f8d4b6807304b2f57c93b9b045a6.json
index 6d017c362f49..9cf0cd25f7f1 100644
--- a/rust/personhog-replica/.sqlx/query-c8b20cb866d4f01c146a8917654801350da98eee49003dddbb883b5e739b0b98.json
+++ b/rust/personhog-replica/.sqlx/query-73a0e91e0d6f971bf07ad975a662e903a898f8d4b6807304b2f57c93b9b045a6.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n UPDATE posthog_group\n SET group_properties = CASE WHEN $4 THEN $5 ELSE group_properties END,\n properties_last_updated_at = CASE WHEN $6 THEN $7 ELSE properties_last_updated_at END,\n properties_last_operation = CASE WHEN $8 THEN $9 ELSE properties_last_operation END,\n created_at = CASE WHEN $10 THEN $11 ELSE created_at END,\n version = version + 1\n WHERE team_id = $1 AND group_type_index = $2 AND group_key = $3\n RETURNING id::bigint as \"id!\", team_id::bigint as \"team_id!\",\n group_type_index, group_key, group_properties,\n created_at,\n properties_last_updated_at as \"properties_last_updated_at?: serde_json::Value\",\n properties_last_operation as \"properties_last_operation?: serde_json::Value\",\n version\n ",
+ "query": "\n UPDATE posthog_group\n SET group_properties = CASE WHEN $4 THEN $5 ELSE group_properties END,\n properties_last_updated_at = CASE WHEN $6 THEN $7 ELSE properties_last_updated_at END,\n properties_last_operation = CASE WHEN $8 THEN $9 ELSE properties_last_operation END,\n created_at = CASE WHEN $10 THEN $11 ELSE created_at END,\n version = version + 1\n WHERE team_id = $1 AND group_type_index = $2 AND group_key = $3\n RETURNING id::bigint as \"id!\", team_id::bigint as \"team_id!\",\n group_type_index, group_key, group_properties::text as \"group_properties!\",\n created_at,\n properties_last_updated_at::text as \"properties_last_updated_at?\",\n properties_last_operation::text as \"properties_last_operation?\",\n version\n ",
"describe": {
"columns": [
{
@@ -25,8 +25,8 @@
},
{
"ordinal": 4,
- "name": "group_properties",
- "type_info": "Jsonb"
+ "name": "group_properties!",
+ "type_info": "Text"
},
{
"ordinal": 5,
@@ -35,13 +35,13 @@
},
{
"ordinal": 6,
- "name": "properties_last_updated_at?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 7,
- "name": "properties_last_operation?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 8,
@@ -69,12 +69,12 @@
null,
false,
false,
+ null,
false,
- false,
- false,
- false,
+ null,
+ null,
false
]
},
- "hash": "c8b20cb866d4f01c146a8917654801350da98eee49003dddbb883b5e739b0b98"
+ "hash": "73a0e91e0d6f971bf07ad975a662e903a898f8d4b6807304b2f57c93b9b045a6"
}
diff --git a/rust/personhog-replica/.sqlx/query-3879fea5ebb2605a9ddd0c6313ec6788c753be404d9dfb89c421e18e24877b2f.json b/rust/personhog-replica/.sqlx/query-87fc14840c8c78a6d88a93868e31b432ab98ad71f0ec4d348598082ef5ba4787.json
similarity index 59%
rename from rust/personhog-replica/.sqlx/query-3879fea5ebb2605a9ddd0c6313ec6788c753be404d9dfb89c421e18e24877b2f.json
rename to rust/personhog-replica/.sqlx/query-87fc14840c8c78a6d88a93868e31b432ab98ad71f0ec4d348598082ef5ba4787.json
index 577b970dbd5e..069055b76edc 100644
--- a/rust/personhog-replica/.sqlx/query-3879fea5ebb2605a9ddd0c6313ec6788c753be404d9dfb89c421e18e24877b2f.json
+++ b/rust/personhog-replica/.sqlx/query-87fc14840c8c78a6d88a93868e31b432ab98ad71f0ec4d348598082ef5ba4787.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id, uuid, team_id::bigint as \"team_id!\", properties,\n properties_last_updated_at, properties_last_operation,\n created_at, version, is_identified,\n CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,\n last_seen_at\n FROM posthog_person\n WHERE team_id = $1 AND uuid = $2\n ",
+ "query": "\n SELECT id, uuid, team_id::bigint as \"team_id!\", properties::text as \"properties!\",\n properties_last_updated_at::text as \"properties_last_updated_at?\",\n properties_last_operation::text as \"properties_last_operation?\",\n created_at, version, is_identified,\n CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,\n last_seen_at\n FROM posthog_person\n WHERE team_id = $1 AND uuid = $2\n ",
"describe": {
"columns": [
{
@@ -20,18 +20,18 @@
},
{
"ordinal": 3,
- "name": "properties",
- "type_info": "Jsonb"
+ "name": "properties!",
+ "type_info": "Text"
},
{
"ordinal": 4,
- "name": "properties_last_updated_at",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 5,
- "name": "properties_last_operation",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 6,
@@ -69,9 +69,9 @@
false,
false,
null,
- false,
- true,
- true,
+ null,
+ null,
+ null,
false,
true,
false,
@@ -79,5 +79,5 @@
true
]
},
- "hash": "3879fea5ebb2605a9ddd0c6313ec6788c753be404d9dfb89c421e18e24877b2f"
+ "hash": "87fc14840c8c78a6d88a93868e31b432ab98ad71f0ec4d348598082ef5ba4787"
}
diff --git a/rust/personhog-replica/.sqlx/query-cc18cbefba3363e19dc994107d89f073ae04d957ce7bd6e42412b1411cb4a3db.json b/rust/personhog-replica/.sqlx/query-a59e592438b345b7f56a76b230871ceca7d98b20b03caa8f467aa08768ca82cf.json
similarity index 54%
rename from rust/personhog-replica/.sqlx/query-cc18cbefba3363e19dc994107d89f073ae04d957ce7bd6e42412b1411cb4a3db.json
rename to rust/personhog-replica/.sqlx/query-a59e592438b345b7f56a76b230871ceca7d98b20b03caa8f467aa08768ca82cf.json
index 7cde3b91173f..d0a6444ac301 100644
--- a/rust/personhog-replica/.sqlx/query-cc18cbefba3363e19dc994107d89f073ae04d957ce7bd6e42412b1411cb4a3db.json
+++ b/rust/personhog-replica/.sqlx/query-a59e592438b345b7f56a76b230871ceca7d98b20b03caa8f467aa08768ca82cf.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT g.id::bigint as \"id!\", g.team_id::bigint as \"team_id!\",\n g.group_type_index, g.group_key, g.group_properties,\n g.created_at,\n g.properties_last_updated_at as \"properties_last_updated_at?: serde_json::Value\",\n g.properties_last_operation as \"properties_last_operation?: serde_json::Value\",\n g.version\n FROM posthog_group g\n INNER JOIN UNNEST($2::integer[], $3::text[]) AS t(group_type_index, group_key)\n ON g.group_type_index = t.group_type_index AND g.group_key = t.group_key\n WHERE g.team_id = $1\n ",
+ "query": "\n SELECT g.id::bigint as \"id!\", g.team_id::bigint as \"team_id!\",\n g.group_type_index, g.group_key, g.group_properties::text as \"group_properties!\",\n g.created_at,\n g.properties_last_updated_at::text as \"properties_last_updated_at?\",\n g.properties_last_operation::text as \"properties_last_operation?\",\n g.version\n FROM posthog_group g\n INNER JOIN UNNEST($2::integer[], $3::text[]) AS t(group_type_index, group_key)\n ON g.group_type_index = t.group_type_index AND g.group_key = t.group_key\n WHERE g.team_id = $1\n ",
"describe": {
"columns": [
{
@@ -25,8 +25,8 @@
},
{
"ordinal": 4,
- "name": "group_properties",
- "type_info": "Jsonb"
+ "name": "group_properties!",
+ "type_info": "Text"
},
{
"ordinal": 5,
@@ -35,13 +35,13 @@
},
{
"ordinal": 6,
- "name": "properties_last_updated_at?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 7,
- "name": "properties_last_operation?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 8,
@@ -61,12 +61,12 @@
null,
false,
false,
+ null,
false,
- false,
- false,
- false,
+ null,
+ null,
false
]
},
- "hash": "cc18cbefba3363e19dc994107d89f073ae04d957ce7bd6e42412b1411cb4a3db"
+ "hash": "a59e592438b345b7f56a76b230871ceca7d98b20b03caa8f467aa08768ca82cf"
}
diff --git a/rust/personhog-replica/.sqlx/query-645a09a81f0bee1098bce84da1d434ea44e5366eab65ca9e3690263cbf9f7bc8.json b/rust/personhog-replica/.sqlx/query-b9eb46c8f06bff3ad4ecdaee45f9d3e6c51ebf37b448a0652798b6c155972c6d.json
similarity index 54%
rename from rust/personhog-replica/.sqlx/query-645a09a81f0bee1098bce84da1d434ea44e5366eab65ca9e3690263cbf9f7bc8.json
rename to rust/personhog-replica/.sqlx/query-b9eb46c8f06bff3ad4ecdaee45f9d3e6c51ebf37b448a0652798b6c155972c6d.json
index 232bb048ea3e..53b6f8ae3571 100644
--- a/rust/personhog-replica/.sqlx/query-645a09a81f0bee1098bce84da1d434ea44e5366eab65ca9e3690263cbf9f7bc8.json
+++ b/rust/personhog-replica/.sqlx/query-b9eb46c8f06bff3ad4ecdaee45f9d3e6c51ebf37b448a0652798b6c155972c6d.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT p.id, p.uuid as \"uuid!\", p.team_id::bigint as \"team_id!\",\n p.properties as \"properties!\",\n p.properties_last_updated_at, p.properties_last_operation,\n p.created_at as \"created_at!\", p.version, p.is_identified as \"is_identified!\",\n CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,\n p.last_seen_at,\n d.distinct_id as \"distinct_id!\"\n FROM posthog_person p\n INNER JOIN posthog_persondistinctid d ON d.person_id = p.id AND d.team_id = p.team_id\n INNER JOIN UNNEST($1::integer[], $2::text[]) AS batch(team_id, distinct_id)\n ON d.team_id = batch.team_id AND d.distinct_id = batch.distinct_id\n ",
+ "query": "\n SELECT p.id, p.uuid as \"uuid!\", p.team_id::bigint as \"team_id!\",\n p.properties::text as \"properties!\",\n p.properties_last_updated_at::text as \"properties_last_updated_at?\",\n p.properties_last_operation::text as \"properties_last_operation?\",\n p.created_at as \"created_at!\", p.version, p.is_identified as \"is_identified!\",\n CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,\n p.last_seen_at,\n d.distinct_id as \"distinct_id!\"\n FROM posthog_person p\n INNER JOIN posthog_persondistinctid d ON d.person_id = p.id AND d.team_id = p.team_id\n INNER JOIN UNNEST($1::integer[], $2::text[]) AS batch(team_id, distinct_id)\n ON d.team_id = batch.team_id AND d.distinct_id = batch.distinct_id\n ",
"describe": {
"columns": [
{
@@ -21,17 +21,17 @@
{
"ordinal": 3,
"name": "properties!",
- "type_info": "Jsonb"
+ "type_info": "Text"
},
{
"ordinal": 4,
- "name": "properties_last_updated_at",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 5,
- "name": "properties_last_operation",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 6,
@@ -74,9 +74,9 @@
false,
false,
null,
- false,
- true,
- true,
+ null,
+ null,
+ null,
false,
true,
false,
@@ -85,5 +85,5 @@
false
]
},
- "hash": "645a09a81f0bee1098bce84da1d434ea44e5366eab65ca9e3690263cbf9f7bc8"
+ "hash": "b9eb46c8f06bff3ad4ecdaee45f9d3e6c51ebf37b448a0652798b6c155972c6d"
}
diff --git a/rust/personhog-replica/.sqlx/query-bbc39a15c461e8af13f6974d23ebab51d1137cee17376bb9d47d010283ecd138.json b/rust/personhog-replica/.sqlx/query-d4c0aa5ea2b985d679a67e7e748302f588d68c7351158c67b51daa0b110bddc3.json
similarity index 54%
rename from rust/personhog-replica/.sqlx/query-bbc39a15c461e8af13f6974d23ebab51d1137cee17376bb9d47d010283ecd138.json
rename to rust/personhog-replica/.sqlx/query-d4c0aa5ea2b985d679a67e7e748302f588d68c7351158c67b51daa0b110bddc3.json
index 283921af546e..957f85d135b4 100644
--- a/rust/personhog-replica/.sqlx/query-bbc39a15c461e8af13f6974d23ebab51d1137cee17376bb9d47d010283ecd138.json
+++ b/rust/personhog-replica/.sqlx/query-d4c0aa5ea2b985d679a67e7e748302f588d68c7351158c67b51daa0b110bddc3.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id::bigint as \"id!\", team_id::bigint as \"team_id!\",\n group_type_index, group_key, group_properties,\n created_at,\n properties_last_updated_at as \"properties_last_updated_at?: serde_json::Value\",\n properties_last_operation as \"properties_last_operation?: serde_json::Value\",\n version\n FROM posthog_group\n WHERE team_id = $1\n AND group_type_index = $2\n AND (NOT $3 OR group_key ILIKE $4)\n AND (NOT $5 OR (group_properties::text ILIKE $6 OR group_key = $7))\n AND (NOT $8 OR (created_at, id) < ($9, $10::bigint))\n ORDER BY created_at DESC, id DESC\n LIMIT $11\n ",
+ "query": "\n SELECT id::bigint as \"id!\", team_id::bigint as \"team_id!\",\n group_type_index, group_key, group_properties::text as \"group_properties!\",\n created_at,\n properties_last_updated_at::text as \"properties_last_updated_at?\",\n properties_last_operation::text as \"properties_last_operation?\",\n version\n FROM posthog_group\n WHERE team_id = $1\n AND group_type_index = $2\n AND (NOT $3 OR group_key ILIKE $4)\n AND (NOT $5 OR (group_properties::text ILIKE $6 OR group_key = $7))\n AND (NOT $8 OR (created_at, id) < ($9, $10::bigint))\n ORDER BY created_at DESC, id DESC\n LIMIT $11\n ",
"describe": {
"columns": [
{
@@ -25,8 +25,8 @@
},
{
"ordinal": 4,
- "name": "group_properties",
- "type_info": "Jsonb"
+ "name": "group_properties!",
+ "type_info": "Text"
},
{
"ordinal": 5,
@@ -35,13 +35,13 @@
},
{
"ordinal": 6,
- "name": "properties_last_updated_at?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 7,
- "name": "properties_last_operation?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 8,
@@ -69,12 +69,12 @@
null,
false,
false,
+ null,
false,
- false,
- false,
- false,
+ null,
+ null,
false
]
},
- "hash": "bbc39a15c461e8af13f6974d23ebab51d1137cee17376bb9d47d010283ecd138"
+ "hash": "d4c0aa5ea2b985d679a67e7e748302f588d68c7351158c67b51daa0b110bddc3"
}
diff --git a/rust/personhog-replica/.sqlx/query-c97b0d70bce706c87aca8107f7fd04308742ff6027ef5dba69fa292301621575.json b/rust/personhog-replica/.sqlx/query-ed7276c7653c4c310c6b0f32be4640084b43fbae9da19f879d6d1ded171d85f6.json
similarity index 59%
rename from rust/personhog-replica/.sqlx/query-c97b0d70bce706c87aca8107f7fd04308742ff6027ef5dba69fa292301621575.json
rename to rust/personhog-replica/.sqlx/query-ed7276c7653c4c310c6b0f32be4640084b43fbae9da19f879d6d1ded171d85f6.json
index b74a7a8e0cd8..4ec922dda5f4 100644
--- a/rust/personhog-replica/.sqlx/query-c97b0d70bce706c87aca8107f7fd04308742ff6027ef5dba69fa292301621575.json
+++ b/rust/personhog-replica/.sqlx/query-ed7276c7653c4c310c6b0f32be4640084b43fbae9da19f879d6d1ded171d85f6.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT id, uuid, team_id::bigint as \"team_id!\", properties,\n properties_last_updated_at, properties_last_operation,\n created_at, version, is_identified,\n CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,\n last_seen_at\n FROM posthog_person\n WHERE team_id = $1 AND uuid = ANY($2)\n ",
+ "query": "\n SELECT id, uuid, team_id::bigint as \"team_id!\", properties::text as \"properties!\",\n properties_last_updated_at::text as \"properties_last_updated_at?\",\n properties_last_operation::text as \"properties_last_operation?\",\n created_at, version, is_identified,\n CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,\n last_seen_at\n FROM posthog_person\n WHERE team_id = $1 AND uuid = ANY($2)\n ",
"describe": {
"columns": [
{
@@ -20,18 +20,18 @@
},
{
"ordinal": 3,
- "name": "properties",
- "type_info": "Jsonb"
+ "name": "properties!",
+ "type_info": "Text"
},
{
"ordinal": 4,
- "name": "properties_last_updated_at",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 5,
- "name": "properties_last_operation",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 6,
@@ -69,9 +69,9 @@
false,
false,
null,
- false,
- true,
- true,
+ null,
+ null,
+ null,
false,
true,
false,
@@ -79,5 +79,5 @@
true
]
},
- "hash": "c97b0d70bce706c87aca8107f7fd04308742ff6027ef5dba69fa292301621575"
+ "hash": "ed7276c7653c4c310c6b0f32be4640084b43fbae9da19f879d6d1ded171d85f6"
}
diff --git a/rust/personhog-replica/.sqlx/query-5a8aa62b35c90ec6f8f1d946081f77c7675569c766e1195dd52d80c517eb7a74.json b/rust/personhog-replica/.sqlx/query-ee50f29646d5a831699fd5250d61c42d0a21adb5dc92a89c88cc0b949beb8321.json
similarity index 53%
rename from rust/personhog-replica/.sqlx/query-5a8aa62b35c90ec6f8f1d946081f77c7675569c766e1195dd52d80c517eb7a74.json
rename to rust/personhog-replica/.sqlx/query-ee50f29646d5a831699fd5250d61c42d0a21adb5dc92a89c88cc0b949beb8321.json
index 868f22847833..8e793d99411e 100644
--- a/rust/personhog-replica/.sqlx/query-5a8aa62b35c90ec6f8f1d946081f77c7675569c766e1195dd52d80c517eb7a74.json
+++ b/rust/personhog-replica/.sqlx/query-ee50f29646d5a831699fd5250d61c42d0a21adb5dc92a89c88cc0b949beb8321.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT g.id::bigint as \"id!\", g.team_id::bigint as \"team_id!\",\n g.group_type_index, g.group_key, g.group_properties,\n g.created_at,\n g.properties_last_updated_at as \"properties_last_updated_at?: serde_json::Value\",\n g.properties_last_operation as \"properties_last_operation?: serde_json::Value\",\n g.version\n FROM posthog_group g\n INNER JOIN UNNEST($1::integer[], $2::integer[], $3::text[]) AS t(team_id, group_type_index, group_key)\n ON g.team_id = t.team_id AND g.group_type_index = t.group_type_index AND g.group_key = t.group_key\n ",
+ "query": "\n SELECT g.id::bigint as \"id!\", g.team_id::bigint as \"team_id!\",\n g.group_type_index, g.group_key, g.group_properties::text as \"group_properties!\",\n g.created_at,\n g.properties_last_updated_at::text as \"properties_last_updated_at?\",\n g.properties_last_operation::text as \"properties_last_operation?\",\n g.version\n FROM posthog_group g\n INNER JOIN UNNEST($1::integer[], $2::integer[], $3::text[]) AS t(team_id, group_type_index, group_key)\n ON g.team_id = t.team_id AND g.group_type_index = t.group_type_index AND g.group_key = t.group_key\n ",
"describe": {
"columns": [
{
@@ -25,8 +25,8 @@
},
{
"ordinal": 4,
- "name": "group_properties",
- "type_info": "Jsonb"
+ "name": "group_properties!",
+ "type_info": "Text"
},
{
"ordinal": 5,
@@ -35,13 +35,13 @@
},
{
"ordinal": 6,
- "name": "properties_last_updated_at?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 7,
- "name": "properties_last_operation?: serde_json::Value",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 8,
@@ -61,12 +61,12 @@
null,
false,
false,
+ null,
false,
- false,
- false,
- false,
+ null,
+ null,
false
]
},
- "hash": "5a8aa62b35c90ec6f8f1d946081f77c7675569c766e1195dd52d80c517eb7a74"
+ "hash": "ee50f29646d5a831699fd5250d61c42d0a21adb5dc92a89c88cc0b949beb8321"
}
diff --git a/rust/personhog-replica/.sqlx/query-acee6e2d265a6e5a5a62d2ff49070c596e3d4a7c70e1a348984dde03379c0b72.json b/rust/personhog-replica/.sqlx/query-f29dcd17ee2e9bb5fe3beb58b8fb294b0c80bc9c617733dafc91cd8b1c2e16c5.json
similarity index 56%
rename from rust/personhog-replica/.sqlx/query-acee6e2d265a6e5a5a62d2ff49070c596e3d4a7c70e1a348984dde03379c0b72.json
rename to rust/personhog-replica/.sqlx/query-f29dcd17ee2e9bb5fe3beb58b8fb294b0c80bc9c617733dafc91cd8b1c2e16c5.json
index c7235ae38019..073ccac41e0b 100644
--- a/rust/personhog-replica/.sqlx/query-acee6e2d265a6e5a5a62d2ff49070c596e3d4a7c70e1a348984dde03379c0b72.json
+++ b/rust/personhog-replica/.sqlx/query-f29dcd17ee2e9bb5fe3beb58b8fb294b0c80bc9c617733dafc91cd8b1c2e16c5.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT p.id, p.uuid as \"uuid!\", p.team_id::bigint as \"team_id!\",\n p.properties as \"properties!\",\n p.properties_last_updated_at, p.properties_last_operation,\n p.created_at as \"created_at!\", p.version, p.is_identified as \"is_identified!\",\n CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,\n p.last_seen_at,\n d.distinct_id as \"distinct_id!\"\n FROM posthog_person p\n INNER JOIN posthog_persondistinctid d ON p.id = d.person_id AND p.team_id = d.team_id\n WHERE p.team_id = $1 AND d.distinct_id = ANY($2)\n ",
+ "query": "\n SELECT p.id, p.uuid as \"uuid!\", p.team_id::bigint as \"team_id!\",\n p.properties::text as \"properties!\",\n p.properties_last_updated_at::text as \"properties_last_updated_at?\",\n p.properties_last_operation::text as \"properties_last_operation?\",\n p.created_at as \"created_at!\", p.version, p.is_identified as \"is_identified!\",\n CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,\n p.last_seen_at,\n d.distinct_id as \"distinct_id!\"\n FROM posthog_person p\n INNER JOIN posthog_persondistinctid d ON p.id = d.person_id AND p.team_id = d.team_id\n WHERE p.team_id = $1 AND d.distinct_id = ANY($2)\n ",
"describe": {
"columns": [
{
@@ -21,17 +21,17 @@
{
"ordinal": 3,
"name": "properties!",
- "type_info": "Jsonb"
+ "type_info": "Text"
},
{
"ordinal": 4,
- "name": "properties_last_updated_at",
- "type_info": "Jsonb"
+ "name": "properties_last_updated_at?",
+ "type_info": "Text"
},
{
"ordinal": 5,
- "name": "properties_last_operation",
- "type_info": "Jsonb"
+ "name": "properties_last_operation?",
+ "type_info": "Text"
},
{
"ordinal": 6,
@@ -74,9 +74,9 @@
false,
false,
null,
- false,
- true,
- true,
+ null,
+ null,
+ null,
false,
true,
false,
@@ -85,5 +85,5 @@
false
]
},
- "hash": "acee6e2d265a6e5a5a62d2ff49070c596e3d4a7c70e1a348984dde03379c0b72"
+ "hash": "f29dcd17ee2e9bb5fe3beb58b8fb294b0c80bc9c617733dafc91cd8b1c2e16c5"
}
diff --git a/rust/personhog-replica/src/service/mod.rs b/rust/personhog-replica/src/service/mod.rs
index d490f717ef79..be776d2dbfd3 100644
--- a/rust/personhog-replica/src/service/mod.rs
+++ b/rust/personhog-replica/src/service/mod.rs
@@ -698,7 +698,7 @@ impl PersonHogReplica for PersonHogReplicaService {
.map_err(|e| log_and_convert_error(e, "get_groups_batch"))?;
// Build a map of found groups
- let found: HashMap<(i64, i32, String), storage::Group> = results
+ let mut found: HashMap<(i64, i32, String), storage::Group> = results
.into_iter()
.map(|(k, g)| ((k.team_id, k.group_type_index, k.group_key), g))
.collect();
@@ -715,7 +715,7 @@ impl PersonHogReplica for PersonHogReplicaService {
group_type_index: k.group_type_index,
group_key: k.group_key,
}),
- group: found.get(&key).cloned().map(Into::into),
+ group: found.remove(&key).map(Into::into),
}
})
.collect();
diff --git a/rust/personhog-replica/src/service/tests/mocks.rs b/rust/personhog-replica/src/service/tests/mocks.rs
index 7bf3e799e9a6..cc6620cf8602 100644
--- a/rust/personhog-replica/src/service/tests/mocks.rs
+++ b/rust/personhog-replica/src/service/tests/mocks.rs
@@ -633,7 +633,7 @@ impl storage::GroupStorage for SuccessStorage {
team_id,
group_type_index,
group_key: group_key.to_string(),
- group_properties: group_properties.clone(),
+ group_properties: group_properties.to_string(),
created_at,
properties_last_updated_at: None,
properties_last_operation: None,
@@ -1013,7 +1013,7 @@ impl storage::GroupStorage for ConsistencyTrackingStorage {
team_id,
group_type_index,
group_key: group_key.to_string(),
- group_properties: group_properties.clone(),
+ group_properties: group_properties.to_string(),
created_at,
properties_last_updated_at: None,
properties_last_operation: None,
diff --git a/rust/personhog-replica/src/service/types/group.rs b/rust/personhog-replica/src/service/types/group.rs
index f7ed0bb5bd9e..b40b0849ff2b 100644
--- a/rust/personhog-replica/src/service/types/group.rs
+++ b/rust/personhog-replica/src/service/types/group.rs
@@ -9,15 +9,15 @@ impl From<storage::Group> for Group {
team_id: group.team_id,
group_type_index: group.group_type_index,
group_key: group.group_key,
- group_properties: serde_json::to_vec(&group.group_properties).unwrap_or_default(),
+ group_properties: group.group_properties.into_bytes(),
created_at: group.created_at.timestamp_millis(),
properties_last_updated_at: group
.properties_last_updated_at
- .map(|v| serde_json::to_vec(&v).unwrap_or_default())
+ .map(|v| v.into_bytes())
.unwrap_or_default(),
properties_last_operation: group
.properties_last_operation
- .map(|v| serde_json::to_vec(&v).unwrap_or_default())
+ .map(|v| v.into_bytes())
.unwrap_or_default(),
version: group.version,
}
diff --git a/rust/personhog-replica/src/service/types/person.rs b/rust/personhog-replica/src/service/types/person.rs
index 1ed3247054d1..6a7575cb2b54 100644
--- a/rust/personhog-replica/src/service/types/person.rs
+++ b/rust/personhog-replica/src/service/types/person.rs
@@ -8,14 +8,14 @@ impl From<storage::Person> for Person {
id: person.id,
uuid: person.uuid.to_string(),
team_id: person.team_id,
- properties: serde_json::to_vec(&person.properties).unwrap_or_default(),
+ properties: person.properties.into_bytes(),
properties_last_updated_at: person
.properties_last_updated_at
- .map(|v| serde_json::to_vec(&v).unwrap_or_default())
+ .map(|v| v.into_bytes())
.unwrap_or_default(),
properties_last_operation: person
.properties_last_operation
- .map(|v| serde_json::to_vec(&v).unwrap_or_default())
+ .map(|v| v.into_bytes())
.unwrap_or_default(),
created_at: person.created_at.timestamp_millis(),
version: person.version.unwrap_or(0),
diff --git a/rust/personhog-replica/src/storage/postgres/group.rs b/rust/personhog-replica/src/storage/postgres/group.rs
index d3dcd15c356f..23ee78a957e3 100644
--- a/rust/personhog-replica/src/storage/postgres/group.rs
+++ b/rust/personhog-replica/src/storage/postgres/group.rs
@@ -33,10 +33,10 @@ impl GroupStorage for PostgresStorage {
Group,
r#"
SELECT id::bigint as "id!", team_id::bigint as "team_id!",
- group_type_index, group_key, group_properties,
+ group_type_index, group_key, group_properties::text as "group_properties!",
created_at,
- properties_last_updated_at as "properties_last_updated_at?: serde_json::Value",
- properties_last_operation as "properties_last_operation?: serde_json::Value",
+ properties_last_updated_at::text as "properties_last_updated_at?",
+ properties_last_operation::text as "properties_last_operation?",
version
FROM posthog_group
WHERE team_id = $1 AND group_type_index = $2 AND group_key = $3
@@ -80,10 +80,10 @@ impl GroupStorage for PostgresStorage {
Group,
r#"
SELECT g.id::bigint as "id!", g.team_id::bigint as "team_id!",
- g.group_type_index, g.group_key, g.group_properties,
+ g.group_type_index, g.group_key, g.group_properties::text as "group_properties!",
g.created_at,
- g.properties_last_updated_at as "properties_last_updated_at?: serde_json::Value",
- g.properties_last_operation as "properties_last_operation?: serde_json::Value",
+ g.properties_last_updated_at::text as "properties_last_updated_at?",
+ g.properties_last_operation::text as "properties_last_operation?",
g.version
FROM posthog_group g
INNER JOIN UNNEST($2::integer[], $3::text[]) AS t(group_type_index, group_key)
@@ -138,10 +138,10 @@ impl GroupStorage for PostgresStorage {
Group,
r#"
SELECT g.id::bigint as "id!", g.team_id::bigint as "team_id!",
- g.group_type_index, g.group_key, g.group_properties,
+ g.group_type_index, g.group_key, g.group_properties::text as "group_properties!",
g.created_at,
- g.properties_last_updated_at as "properties_last_updated_at?: serde_json::Value",
- g.properties_last_operation as "properties_last_operation?: serde_json::Value",
+ g.properties_last_updated_at::text as "properties_last_updated_at?",
+ g.properties_last_operation::text as "properties_last_operation?",
g.version
FROM posthog_group g
INNER JOIN UNNEST($1::integer[], $2::integer[], $3::text[]) AS t(team_id, group_type_index, group_key)
@@ -475,10 +475,10 @@ impl GroupStorage for PostgresStorage {
Group,
r#"
SELECT id::bigint as "id!", team_id::bigint as "team_id!",
- group_type_index, group_key, group_properties,
+ group_type_index, group_key, group_properties::text as "group_properties!",
created_at,
- properties_last_updated_at as "properties_last_updated_at?: serde_json::Value",
- properties_last_operation as "properties_last_operation?: serde_json::Value",
+ properties_last_updated_at::text as "properties_last_updated_at?",
+ properties_last_operation::text as "properties_last_operation?",
version
FROM posthog_group
WHERE team_id = $1
@@ -551,10 +551,10 @@ impl GroupStorage for PostgresStorage {
INSERT INTO posthog_group (team_id, group_type_index, group_key, group_properties, created_at, properties_last_updated_at, properties_last_operation, version)
VALUES ($1, $2, $3, $4, $5, '{}'::jsonb, '{}'::jsonb, 0)
RETURNING id::bigint as "id!", team_id::bigint as "team_id!",
- group_type_index, group_key, group_properties,
+ group_type_index, group_key, group_properties::text as "group_properties!",
created_at,
- properties_last_updated_at as "properties_last_updated_at?: serde_json::Value",
- properties_last_operation as "properties_last_operation?: serde_json::Value",
+ properties_last_updated_at::text as "properties_last_updated_at?",
+ properties_last_operation::text as "properties_last_operation?",
version
"#,
team_id as i32,
@@ -604,10 +604,10 @@ impl GroupStorage for PostgresStorage {
version = version + 1
WHERE team_id = $1 AND group_type_index = $2 AND group_key = $3
RETURNING id::bigint as "id!", team_id::bigint as "team_id!",
- group_type_index, group_key, group_properties,
+ group_type_index, group_key, group_properties::text as "group_properties!",
created_at,
- properties_last_updated_at as "properties_last_updated_at?: serde_json::Value",
- properties_last_operation as "properties_last_operation?: serde_json::Value",
+ properties_last_updated_at::text as "properties_last_updated_at?",
+ properties_last_operation::text as "properties_last_operation?",
version
"#,
team_id as i32,
diff --git a/rust/personhog-replica/src/storage/postgres/person.rs b/rust/personhog-replica/src/storage/postgres/person.rs
index 4b63cdaecced..8c0023f0660d 100644
--- a/rust/personhog-replica/src/storage/postgres/person.rs
+++ b/rust/personhog-replica/src/storage/postgres/person.rs
@@ -33,8 +33,9 @@ impl PersonLookup for PostgresStorage {
let row = sqlx::query_as!(
Person,
r#"
- SELECT id, uuid, team_id::bigint as "team_id!", properties,
- properties_last_updated_at, properties_last_operation,
+ SELECT id, uuid, team_id::bigint as "team_id!", properties::text as "properties!",
+ properties_last_updated_at::text as "properties_last_updated_at?",
+ properties_last_operation::text as "properties_last_operation?",
created_at, version, is_identified,
CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,
last_seen_at
@@ -64,8 +65,9 @@ impl PersonLookup for PostgresStorage {
let row = sqlx::query_as!(
Person,
r#"
- SELECT id, uuid, team_id::bigint as "team_id!", properties,
- properties_last_updated_at, properties_last_operation,
+ SELECT id, uuid, team_id::bigint as "team_id!", properties::text as "properties!",
+ properties_last_updated_at::text as "properties_last_updated_at?",
+ properties_last_operation::text as "properties_last_operation?",
created_at, version, is_identified,
CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,
last_seen_at
@@ -104,8 +106,9 @@ impl PersonLookup for PostgresStorage {
let rows = sqlx::query_as!(
Person,
r#"
- SELECT id, uuid, team_id::bigint as "team_id!", properties,
- properties_last_updated_at, properties_last_operation,
+ SELECT id, uuid, team_id::bigint as "team_id!", properties::text as "properties!",
+ properties_last_updated_at::text as "properties_last_updated_at?",
+ properties_last_operation::text as "properties_last_operation?",
created_at, version, is_identified,
CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,
last_seen_at
@@ -153,8 +156,9 @@ impl PersonLookup for PostgresStorage {
let rows = sqlx::query_as!(
Person,
r#"
- SELECT id, uuid, team_id::bigint as "team_id!", properties,
- properties_last_updated_at, properties_last_operation,
+ SELECT id, uuid, team_id::bigint as "team_id!", properties::text as "properties!",
+ properties_last_updated_at::text as "properties_last_updated_at?",
+ properties_last_operation::text as "properties_last_operation?",
created_at, version, is_identified,
CASE WHEN is_user_id IS NULL THEN NULL ELSE (is_user_id != 0) END as is_user_id,
last_seen_at
@@ -200,8 +204,9 @@ impl PersonLookup for PostgresStorage {
let row = sqlx::query_as!(
Person,
r#"
- SELECT p.id, p.uuid, p.team_id::bigint as "team_id!", p.properties,
- p.properties_last_updated_at, p.properties_last_operation,
+ SELECT p.id, p.uuid, p.team_id::bigint as "team_id!", p.properties::text as "properties!",
+ p.properties_last_updated_at::text as "properties_last_updated_at?",
+ p.properties_last_operation::text as "properties_last_operation?",
p.created_at, p.version, p.is_identified,
CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,
p.last_seen_at
@@ -244,8 +249,9 @@ impl PersonLookup for PostgresStorage {
let rows = sqlx::query!(
r#"
SELECT p.id, p.uuid as "uuid!", p.team_id::bigint as "team_id!",
- p.properties as "properties!",
- p.properties_last_updated_at, p.properties_last_operation,
+ p.properties::text as "properties!",
+ p.properties_last_updated_at::text as "properties_last_updated_at?",
+ p.properties_last_operation::text as "properties_last_operation?",
p.created_at as "created_at!", p.version, p.is_identified as "is_identified!",
CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,
p.last_seen_at,
@@ -272,7 +278,7 @@ impl PersonLookup for PostgresStorage {
rows.len() as f64,
);
- let found: HashMap<String, Person> = rows
+ let mut found: HashMap<String, Person> = rows
.into_iter()
.map(|row| {
let person = Person {
@@ -294,7 +300,7 @@ impl PersonLookup for PostgresStorage {
Ok(distinct_ids
.iter()
- .map(|did| (did.clone(), found.get(did).cloned()))
+ .map(|did| (did.clone(), found.remove(did)))
.collect())
}
@@ -493,8 +499,9 @@ impl PersonLookup for PostgresStorage {
let rows = sqlx::query!(
r#"
SELECT p.id, p.uuid as "uuid!", p.team_id::bigint as "team_id!",
- p.properties as "properties!",
- p.properties_last_updated_at, p.properties_last_operation,
+ p.properties::text as "properties!",
+ p.properties_last_updated_at::text as "properties_last_updated_at?",
+ p.properties_last_operation::text as "properties_last_operation?",
p.created_at as "created_at!", p.version, p.is_identified as "is_identified!",
CASE WHEN p.is_user_id IS NULL THEN NULL ELSE (p.is_user_id != 0) END as is_user_id,
p.last_seen_at,
@@ -522,7 +529,7 @@ impl PersonLookup for PostgresStorage {
rows.len() as f64,
);
- let found: HashMap<(i64, String), Person> = rows
+ let mut found: HashMap<(i64, String), Person> = rows
.into_iter()
.map(|row| {
let key = (row.team_id, row.distinct_id.clone());
@@ -547,7 +554,7 @@ impl PersonLookup for PostgresStorage {
.iter()
.map(|(team_id, did)| {
let key = (*team_id, did.clone());
- (key.clone(), found.get(&key).cloned())
+ (key.clone(), found.remove(&key))
})
.collect())
}
diff --git a/rust/personhog-replica/src/storage/types/group.rs b/rust/personhog-replica/src/storage/types/group.rs
index 8f0add581abf..c894980f50e3 100644
--- a/rust/personhog-replica/src/storage/types/group.rs
+++ b/rust/personhog-replica/src/storage/types/group.rs
@@ -4,10 +4,10 @@ pub struct Group {
pub team_id: i64,
pub group_type_index: i32,
pub group_key: String,
- pub group_properties: serde_json::Value,
+ pub group_properties: String,
pub created_at: chrono::DateTime<chrono::Utc>,
- pub properties_last_updated_at: Option<serde_json::Value>,
- pub properties_last_operation: Option<serde_json::Value>,
+ pub properties_last_updated_at: Option<String>,
+ pub properties_last_operation: Option<String>,
pub version: i64,
}
diff --git a/rust/personhog-replica/src/storage/types/person.rs b/rust/personhog-replica/src/storage/types/person.rs
index c6b9e14b4278..b60a43df5bc1 100644
--- a/rust/personhog-replica/src/storage/types/person.rs
+++ b/rust/personhog-replica/src/storage/types/person.rs
@@ -5,9 +5,9 @@ pub struct Person {
pub id: i64,
pub uuid: Uuid,
pub team_id: i64,
- pub properties: serde_json::Value,
- pub properties_last_updated_at: Option<serde_json::Value>,
- pub properties_last_operation: Option<serde_json::Value>,
+ pub properties: String,
+ pub properties_last_updated_at: Option<String>,
+ pub properties_last_operation: Option<String>,
pub created_at: chrono::DateTime<chrono::Utc>,
pub version: Option<i64>,
pub is_identified: bool,
diff --git a/rust/personhog-replica/tests/storage_tests.rs b/rust/personhog-replica/tests/storage_tests.rs
index a86a744fb915..102c51733df1 100644
--- a/rust/personhog-replica/tests/storage_tests.rs
+++ b/rust/personhog-replica/tests/storage_tests.rs
@@ -159,7 +159,8 @@ async fn test_get_group() {
let fetched = result.unwrap();
assert_eq!(fetched.group_key, "company_123");
assert_eq!(fetched.group_type_index, 0);
- assert_eq!(fetched.group_properties, properties);
+ let fetched_props: serde_json::Value = serde_json::from_str(&fetched.group_properties).unwrap();
+ assert_eq!(fetched_props, properties);
ctx.cleanup().await.ok();
}
@@ -244,8 +245,9 @@ async fn test_person_properties() {
assert!(result.is_some());
let fetched = result.unwrap();
- assert_eq!(fetched.properties["email"], "[email protected]");
- assert_eq!(fetched.properties["plan"], "enterprise");
+ let props: serde_json::Value = serde_json::from_str(&fetched.properties).unwrap();
+ assert_eq!(props["email"], "[email protected]");
+ assert_eq!(props["plan"], "enterprise");
ctx.cleanup().await.ok();
}