Parse Dotted Object Names With Quoted Identifier Rules
Last updated: November 29, 2026
Quick Overview
Write a parser that splits a name like analytics."Sales.2024".orders into its database, schema and object parts. Unquoted parts are case-insensitive and stored uppercase; quoted parts keep their case, may contain dots and spaces, and use two double quotes to escape a quote.
Snowflake
November 29, 20260
0
0 solved
Write a parser that splits a name like analytics."Sales.2024".orders into its database, schema and object parts. Unquoted parts are case-insensitive and stored uppercase; quoted parts keep their case, may contain dots and spaces, and use two double quotes to escape a quote.
Snowflake resolves object names this way everywhere in SQL, so a hand-written tokenizer is a natural onsite coding question for engineers on the SQL compiler or metadata teams. The interviewer watches for a clean state machine, precise error reporting, and no split-on-dot shortcuts.
What the Interviewer Expects
- Rejects the naive split('.') approach and explains why quoted dots break it
- Handles the doubled quote escape inside quoted identifiers
- Uppercases unquoted parts and validates their characters
- Reports errors for empty parts, trailing dots, unterminated quotes and too many parts
- Runs in a single linear pass
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you resolve a one-part or two-part name using the session's current database and schema?
- How would you print a parsed name back so that it round-trips through the parser?
- How would you extend this to support identifiers like IDENTIFIER($var)?
- How should error messages point the user at the bad character?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a string. Output: a list of 1 to 3 parts. Unquoted part: letters, digits, _ and $, cannot start with a digit or $, converted to uppercase. Quoted part: anything between double quotes, `""...
High-Level Design
Walk the string with an index. At the start of each part, peek: a quote means read a quoted identifier until a lone closing quote; otherwise read unquoted characters until a dot or end. After each par...