This was a follow-up to an earlier part so I was already mid-flow, which helped.
Clarify the exact semantics of the IN clause in this context (e.g., membership test against a subquery or table), then outline a parser extension that adds IN as a postfix operator or expression node. Discuss trade-offs between recursive descent modifications and grammar changes, and mention how to handle edge cases like NULLs and type compatibility.
Pro tip: Bring up the ambiguity between IN as a set membership operator and IN as a subquery introducer, and propose a lookahead strategy to disambiguate—this shows you understand real-world SQL parsing challenges.
Ask whether IN should support only table names or also subqueries/lists, and confirm the expected behavior for NULLs and type mismatches. This ensures you build the right feature.
Identify where expressions are parsed and how the AST represents binary operations. Determine if the parser is recursive descent, Pratt, or generated from a grammar.
Add a production for IN as a postfix operator with appropriate precedence, or as a primary expression when followed by a subquery. Consider using lookahead to distinguish IN (list) from IN (subquery).
Modify the parser to create an AST node for IN, and update the evaluator to perform membership tests. Handle NULLs (three-valued logic) and ensure type compatibility checks.
Write unit tests for valid and invalid IN clauses, including edge cases like empty lists, NULLs, and nested subqueries. Verify that existing queries still parse correctly.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.