/** * AST-based SQL transformer for DuckDB compatibility. * * Transforms: * - Array bounds: array_lower(..., 1), array_upper(..., 1) -> DuckDB expressions * - JOIN column qualification: "col" = "col" -> "left"."col" = "right"."col" * - generate_series aliases and per arm WITH clauses in set operations * * Postgres array operators (@>, <@, &&) are native in DuckDB and pass through. * * Re-printing the AST is lossy (node-sql-parser applies backslash escapes to * string literals and misreads IS DISTINCT FROM $1), so the rewritten SQL is * only used when its literals, parameters and quoted identifiers match the * original query. * * Performance optimizations: * - LRU cache for transformed queries (avoids re-parsing identical queries) * - Smart heuristics to skip JOIN qualification when not needed * - Early exit when no transformation is required */ export type TransformResult = { sql: string; transformed: boolean; }; export declare function transformSQL(query: string, options?: { qualifyJoinColumns?: boolean; }): TransformResult; /** * Clear the transformation cache. Useful for testing or memory management. */ export declare function clearTransformCache(): void; /** * Get current cache statistics for monitoring. */ export declare function getTransformCacheStats(options?: { qualifyJoinColumns?: boolean; }): { size: number; maxSize: number; }; export { transformArrayBounds } from './visitors/array-bounds.ts'; export { qualifyJoinColumns } from './visitors/column-qualifier.ts'; export { rewriteGenerateSeriesAliases } from './visitors/generate-series-alias.ts'; export { hoistUnionWith } from './visitors/union-with-hoister.ts';