You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Continued improvement of collation fidelity by passing BatchContext through Expression.GetSqlType, allowing proper collation information to reach places that were using Collation.Default.
Copy file name to clipboardExpand all lines: CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ Readonly struct, up to 4 inline slots (SQL Server's grammar limit). API: `Leaf`,
56
56
`SimulatedSqlException` constructor is private; each error case is an `internal static` factory in a topical partial (`TypeErrors`, `SchemaErrors`, `ConstraintErrors`, `ResolutionErrors`, `QueryErrors`, `SyntaxErrors`). The number lands in `Data["HelpLink.EvtID"]`. **Grep for an existing factory before adding a new one.**
57
57
58
58
### Expression evaluation
59
-
`Expression.Run(RuntimeContext runtime)` (runtime) and `Expression.GetSqlType(...)` (static, for projection schema) must agree on result type — drift breaks union/CASE/coalesce schema. `RuntimeContext` bundles `ResolveColumn` (per-row column lookup) and `Batch` (the executing `BatchContext`); expressions that need batch / session / database state read `runtime.Batch.*` directly. `BooleanExpression.Run` returns `bool?` (three-valued); WHERE/MERGE-ON exclude UNKNOWN, CHECK passes UNKNOWN. Aggregates: subclass `Aggregator` (`Add(SqlValue)` / `Result()`), register in `AggregateExpression`'s dispatch.
59
+
`Expression.Run(RuntimeContext runtime)` (runtime) and `Expression.GetSqlType(BatchContext batch, ...)` (static, for projection schema) must agree on result type — drift breaks union/CASE/coalesce schema. Both take a `BatchContext` so result types that depend on the active database (notably the collation of literal / CAST / function-result string types) stay in parity between the parse-time schema and the runtime value. `RuntimeContext` bundles `ResolveColumn` (per-row column lookup) and `Batch` (the executing `BatchContext`); expressions that need batch / session / database state read `runtime.Batch.*` directly. `BooleanExpression.Run` returns `bool?` (three-valued); WHERE/MERGE-ON exclude UNKNOWN, CHECK passes UNKNOWN. Aggregates: subclass `Aggregator` (`Add(SqlValue)` / `Result()`), register in `AggregateExpression`'s dispatch.
60
60
61
61
### Context layering
62
62
Six scopes, one home each. **Add new state to whichever class matches its true scope** — when in doubt, ask who outlives whom. The field roster on each class lives in the source XML docs; this section captures only the identity + load-bearing contracts.
this.resultBound?this.cachedResult:thrownewInvalidOperationException("AggregateExpression.Run was called before its result was bound; this indicates the Selection executor didn't recognize it as an aggregate.");
0 commit comments