T-139: M2.4a — Versioned Feature Library core: declarative DuckDB SQL feature definitions + registerSignal registry + versioned Parquet batch-plan runner over an injected DuckDbExecutor in libs/research/src/feature-library.ts (pure, no new deps)

This commit is contained in:
Studio 2026-12-01 10:42:19 -05:00
parent c4083a8f32
commit 0cdc231579
2 changed files with 17 additions and 17 deletions

View file

@ -1104,6 +1104,11 @@ function validateExpressionSlice(
}
}
// DuckDB folds identifier case for ASCII letters only; mirror that exact rule for CTE scope.
function foldAsciiIdentifier(identifier: string): string {
return identifier.replace(/[A-Z]/g, (ch) => String.fromCharCode(ch.charCodeAt(0) + 32));
}
function parseTableReference(
tokens: readonly SqlToken[],
start: number,
@ -1152,7 +1157,7 @@ function parseTableReference(
`Catalog or schema-qualified relation "${tok.raw}...." is not permitted; use {{input:<dataset>}} placeholders.`
);
}
const cteName = tok.value.toLowerCase();
const cteName = foldAsciiIdentifier(tok.value);
if (!inScopeCtes.has(cteName)) {
throw new FeatureLibraryError(
'EXTERNAL_DATA_ACCESS',
@ -1450,7 +1455,7 @@ function validateQuerySlice(
'Expected CTE name identifier after WITH in feature SQL.'
);
}
const cteName = nameTok.value.toLowerCase();
const cteName = foldAsciiIdentifier(nameTok.value);
pos += 1;
// Optional CTE column list `(col1, col2)`.