SnowPro Specialty: Gen AI Question 245
Single answerError conditionsA data engineering team built a Snowflake SQL pipeline that classifies customer support tickets using Cortex COMPLETE. During a nightly batch run, some rows succeed, but the job fails when it encounters a few very large ticket bodies and occasionally malformed prompt inputs. The team wants the pipeline to continue processing valid rows while capturing failures for later review. Which approach is the MOST appropriate?
- A
Wrap the Cortex COMPLETE call in a Snowflake Scripting block with exception handling, log the failing row details, and continue processing subsequent rows.
- B
Increase the virtual warehouse size so Snowflake can automatically bypass prompt-related errors and complete the batch.
- C
Replace Cortex COMPLETE with a standard SQL string function so that malformed prompts are silently truncated instead of failing.
- D
Run the entire batch inside a single transaction and retry the full statement whenever any row causes an error.
Show answer and explanation
Correct answer: A
Explanation
When using Snowflake Cortex functions in production pipelines, failures often come from row-level conditions such as invalid argument values, oversized inputs, or malformed prompt construction. Best practice is to design for partial failure: validate inputs before inference where possible, and use procedural error handling to isolate bad rows instead of failing the entire batch. In Snowflake, this commonly means using Snowflake Scripting, stored procedures, or task-driven orchestration patterns that catch exceptions, log context, and continue processing valid records. Increasing warehouse size only helps with resource availability and query performance, not application-level errors. Likewise, retrying an entire failed batch is appropriate for transient failures but not for deterministic input problems. This reflects practical operational guidance for robust AI inference pipelines built on Snowflake.
- A. Correct.
Correct. In a real batch-processing scenario, exception handling is the best fit when some AI function invocations can fail due to row-specific issues such as invalid inputs or oversized prompts. Using Snowflake Scripting or procedural logic allows the team to catch runtime errors, record the problematic row or error message in a logging table, and continue processing remaining records. This is aligned with resilient data pipeline design and is the most practical way to handle partial failures without losing successful work.
- B. Incorrect.
Incorrect. Warehouse size affects compute capacity and performance, but it does not resolve logical or input-validation failures such as malformed prompts or requests that exceed supported limits. Prompt-related errors must be handled through validation, truncation, chunking, or exception handling rather than by scaling compute.
- C. Incorrect.
Incorrect. Standard SQL string functions cannot replace the semantic behavior of Cortex COMPLETE. While preprocessing inputs with string functions may help reduce some input issues, replacing the model call entirely would not perform the required classification task. The misconception is that prompt errors can be solved by downgrading the workload to generic SQL text manipulation.
- D. Incorrect.
Incorrect. Retrying the full statement or full transaction is inefficient and does not solve deterministic row-level input errors. If a specific row consistently violates input requirements, the same batch will fail again on retry. This approach also prevents successful rows from being retained unless the process is redesigned, making it a poor choice for resilient GenAI batch inference pipelines.