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:26:16 -05:00
parent 26e305f5e6
commit 7ef16d0bc3
3 changed files with 20 additions and 24 deletions

View file

@ -1432,13 +1432,14 @@ function validateQuerySlice(
const inScopeCtes = new Set<string>(outerCtes);
let pos = start;
// Optional leading WITH clause.
// Optional leading WITH clause (non-recursive CTEs only).
if (tokens[pos]?.kind === 'word' && (tokens[pos] as { upper: string }).upper === 'WITH') {
pos += 1;
let isRecursive = false;
if (pos < end && tokens[pos]?.kind === 'word' && (tokens[pos] as { upper: string }).upper === 'RECURSIVE') {
isRecursive = true;
pos += 1;
throw new FeatureLibraryError(
'INVALID_SQL_STATEMENT',
'WITH RECURSIVE CTEs are not permitted in feature SQL; use non-recursive CTEs.'
);
}
while (pos < end) {
@ -1484,9 +1485,6 @@ function validateQuerySlice(
);
}
const bodyClose = findMatchingParen(tokens, pos, end);
if (isRecursive) {
inScopeCtes.add(cteName);
}
validateQuerySlice(tokens, pos + 1, bodyClose, inScopeCtes, false);
inScopeCtes.add(cteName);
pos = bodyClose + 1;