Refactor: Simplify query evaluation and iterator handling #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Query Engine Cleanup and Simplification
This pull request focuses on extensive code cleanup and simplification within the query evaluation engine. It removes redundant checks, consolidates iterator creation logic, and refines memory management across several core files. The changes aim to streamline the codebase, improve readability, and potentially offer minor performance gains by reducing unnecessary overhead.
Key Changes
• Consolidated iterator creation logic in
NewUnionIteratorand other factory functions, removing redundant checks for zero or single child iterators.• Removed unused functions and dead code, including
RangeNumber_Free,geoRangeLoad,checkResult, andpopulateRange.• Renamed
ContainsCtxtoTrieCallbackCtxfor improved clarity and consistency in callback contexts.• Enhanced memory management in
Redis_OpenReaderby ensuringRSQueryTermis freed regardless of iterator creation success.• Refined the
quickExitlogic inUnionIteratorto also apply when a query node's weight is zero, optimizing result collection for non-scoring sub-trees.• Simplified error handling and control flow in various query evaluation functions, replacing
gotostatements with direct returns orRS_ASSERTwhere appropriate.Affected Areas
• src/query.c (Query evaluation logic)
• src/
geo_index.c (Geospatial indexing and filtering)• src/
redisearch_api.c (CAPIforRediSearch)• src/profile.c (Query profiling output)
• src/iterators/
union_iterator.c (Union iterator implementation)• src/
redis_index.c (Redis-backed index operations)• src/
query_internal.h (Internal query declarations)This summary was automatically generated by @propel-code-bot