The equality filter part was fine, just iterate rows and check every predicate.
Start by clarifying the current schema and SELECT API, then design a filter representation (e.g., a map of column to value) and implement row matching with a simple loop. After that, discuss generalizing to other operators via an expression tree and adding indexing (e.g., hash indexes for equality, B-trees for ranges) with trade-offs.
Pro tip: Mention that you'd first check if the filter can be pushed down to an index to avoid full scans, and that you'd keep the filter representation extensible from the start to avoid rewrites later.
Ask about the data model, expected query patterns, and performance goals to scope the solution appropriately.
Define a filter as a set of column-value equality conditions and implement a function that iterates rows and checks all conditions.
Introduce an expression tree or predicate interface to support operators like >, <, !=, and logical AND/OR without changing the core execution loop.
Propose hash indexes for equality and B-trees for range queries, and explain how the query planner can choose an index based on the filter.
Cover trade-offs like memory overhead, write amplification, and complexity, and suggest incremental improvements like composite indexes or query optimization.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.