surfacecleaningcorrect
Cleaningscalar · returns varchar

CORRECT

Correct factual/logical errors in a value using context (heavier sibling of FIX)

Per-row — runs once for each row.

cleaningllmtext

Syntax

CORRECT({{ value }}, '{{ context }}')
{{ value }} CORRECTED BY '{{ context }}'

Arguments

nametypedescription
valueVARCHAR
contextVARCHARContext for correction: related fields, constraints, hints

About

Correct factual or logical errors in a value using contextual knowledge and common sense. Where FIX handles format and typo fixes (gmial.com → gmail.com), CORRECT handles substantive errors: a state listed wrong for a given city, a number that doesn't match its written form, an obviously-misidentified entity. Useful on data-entry records with human errors, OCR output, legacy imports, or user-submitted content where the mistakes require domain knowledge to catch. For simple typo and format fixes (faster, cheaper), use FIX. For filling in missing values, use FILL or IMPUTE.

Examples

Zip corrected for city

SELECT
  correct ('02101', 'city is San Francisco')

Nearby rabbit holes

same domain
Climb back to The Looking Glass