A data engineering team has a Delta table with 2 million customer support ticket texts in a 'ticket_text' column. They need to classify each ticket as 'billing', 'technical', or 'shipping' using an LLM deployed on a Model Serving endpoint named 'ticket-classifier'. Which Databricks SQL query correctly applies batch inference using ai_query()?
Show answer & explanation
Correct answer: D
WHY D is correct: ai_query() for traditional ML models (deployed as custom model serving endpoints) uses the named parameter syntax: endpoint => 'endpoint-name', request => <input> (or input =>), and returnType => 'type'. The named parameter form is required when calling custom models to specify the return type. The Databricks documentation shows exactly this pattern for calling custom classification models. WHY NOT A: PREDICT() is not a Databricks SQL function. This would produce a SQL syntax error. WHY NOT B: While ai_query('model-name', text) is valid for foundation models with positional arguments, custom model serving endpoints require the named parameter form (endpoint =>, request =>, returnType =>) to correctly specify return typing for structured classification outputs. WHY NOT C: ai_classify() is a task-specific AI function that uses Databricks-hosted models and a provided label list. If the endpoint 'ticket-classifier' is the team's own fine-tuned model deployed on Model Serving, ai_classify() cannot target it — it uses internally governed Databricks-managed models only.