Skip to content

Commit a77dc5e

Browse files
committed
fix for 8.6
1 parent 1f60697 commit a77dc5e

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

src/profile/profile.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ void printInvIdxIt(RedisModule_Reply *reply, QueryIterator *root, ProfileCounter
3434
InvIndIterator *it = (InvIndIterator *)root;
3535

3636
RedisModule_Reply_Map(reply);
37-
if (IndexReader_Flags(it->reader) == Index_DocIdsOnly) {
37+
if (it->isWildcard) {
38+
printProfileType("WILDCARD");
39+
} else if (it->filterCtx.predicate == FIELD_EXPIRATION_PREDICATE_MISSING) {
40+
printProfileType("MISSING");
41+
size_t fieldLen = 0;
42+
const char *fieldName = HiddenString_GetUnsafe(it->sctx->spec->fields[it->filterCtx.field.index].fieldName, &fieldLen);
43+
RedisModule_ReplyKV_StringBuffer(reply, "Field", fieldName, fieldLen);
44+
} else if (IndexReader_Flags(it->reader) == Index_DocIdsOnly) {
3845
RSQueryTerm *term = IndexResult_QueryTermRef(root->current);
3946
if (term != NULL) {
4047
printProfileType("TAG");

tests/pytests/test_profile.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,24 @@ def testProfileTag(env):
275275
actual_res = conn.execute_command('ft.profile', 'idx', 'search', 'query', '@t:{foo}', 'nocontent')
276276
env.assertEqual(actual_res[1][1][0][3], ['Type', 'TAG', 'Term', 'foo', 'Number of reading operations', 2, 'Estimated number of matches', 2])
277277

278+
@skip(cluster=True)
279+
def testProfileMissingFieldQuery(env):
280+
conn = getConnectionByEnv(env)
281+
env.cmd(config_cmd(), 'SET', '_PRINT_PROFILE_CLOCK', 'false')
282+
283+
env.cmd('ft.create', 'idx', 'SCHEMA', 't', 'text', 'INDEXMISSING')
284+
conn.execute_command('hset', '1', 't', 'hello')
285+
conn.execute_command('hset', '2', 'other', 'value')
286+
287+
actual_res = conn.execute_command('ft.profile', 'idx', 'search', 'query', 'ismissing(@t)', 'nocontent', 'DIALECT', 2)
288+
env.assertEqual(actual_res[0], [1, '2'])
289+
env.assertEqual(actual_res[1][1][0][3], ['Type', 'MISSING', 'Field', 't', 'Number of reading operations', 2, 'Estimated number of matches', 1])
290+
291+
actual_res = conn.execute_command('ft.profile', 'idx', 'search', 'query', '-ismissing(@t)', 'nocontent')
292+
env.assertEqual(actual_res[0], [1, '1'])
293+
env.assertEqual(actual_res[1][1][0][3], ['Type', 'NOT', 'Number of reading operations', 2, 'Child iterator',
294+
['Type', 'MISSING', 'Field', 't', 'Number of reading operations', 2, 'Estimated number of matches', 1]])
295+
278296
@skip(cluster=True)
279297
def testProfileVector(env):
280298
conn = getConnectionByEnv(env)
@@ -1498,4 +1516,3 @@ def testCoordinatorQueueTimeInProfile():
14981516
env.assertGreaterEqual(coord_queue_time, pause_duration_ms * 0.8, # Allow 20% tolerance
14991517
message=f"Coordinator queue time ({coord_queue_time}ms) should capture queue wait. "
15001518
f"Expected >= {pause_duration_ms * 0.8}ms. Full result: {result}")
1501-

0 commit comments

Comments
 (0)