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
Coding & Algorithms
Software Engineer
Snowflake
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

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
tokenizer
state machine
escape sequences
identifier resolution
error handling
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported