import { ResolverAdapter } from "./types.mjs"; import { TableName } from "@gscdump/contracts"; export type PgTableKey = TableName; export declare const pgResolverAdapter: ResolverAdapter; /** * Parquet-aware variant of {@link pgResolverAdapter}. Identical SQL output * except FROM clauses emit `read_parquet({{FILES}}, union_by_name = true) AS * "${tk}"`. The runSQL pipeline substitutes `{{FILES}}` with R2 object keys * resolved from the manifest. The `AS "${tk}"` alias is mandatory — drizzle * compiles `colRef` to table-qualified `"pages"."url"`, which would not * resolve against an unaliased FROM. * * Single-use: build a fresh adapter per query. Cheap (no I/O) and avoids * accidental adapter caching that would lock in a stale `{{FILES}}` set. */ export interface ResolverAdapterOptions { /** * `queryDim` reads canonical from a joined query dimension. `column` is only * for derived canonical rollup relations whose primary relation already * carries a null-free `query_canonical` output column. */ queryCanonicalSource?: 'queryDim' | 'column'; } export interface R2SqlResolverAdapterOptions extends ResolverAdapterOptions { /** * R2 SQL string partition equality can undercount on identity partitions; * string-encoded catalogs use CONCAT(col, '') in partition predicates. Int * catalogs do not need the workaround and keep bare equality for pruning. */ partitionKeyEncoding?: 'string' | 'int'; } export declare function createParquetResolverAdapter(options?: ResolverAdapterOptions): ResolverAdapter; /** * Multi-tenant pg-flavored adapter for the Iceberg / R2 SQL read path. * Set `dialect: 'r2sql'` to emit R2 SQL regex predicates. The default targets DuckDB. * Identical SQL output to `pgResolverAdapter` except WHERE clauses inject * `site_id = ?` AND `search_type = ?` automatically when those scopes are * passed to `resolveToSQL`. Required for the Iceberg fact tables which are * shared across tenants — querying without these predicates would leak * cross-tenant data. Single-use: the adapter has no `tableRef` override, * so callers must rewrite bare table names to their qualified form (e.g. * `${namespace}.pages`) before sending to R2 SQL. * * The bare `site_id = ?` / `search_type = ?` partition predicates are only * safe on int-partition catalogs. Legacy string-partition catalogs must pass * `partitionKeyEncoding: 'string'` to emit `CONCAT(col, '') = ?` instead — * bare equality undercounts (silently returns fewer rows) on those catalogs. */ export declare function createIcebergResolverAdapter(options?: R2SqlResolverAdapterOptions & { dialect?: 'duckdb' | 'r2sql'; }): ResolverAdapter; /** * R2 SQL adapter for the Iceberg fact tables. * * It shares the multi-tenant Iceberg schema with `createIcebergResolverAdapter` * but models R2 SQL's narrower execution surface: no window-total plans and no * comparison joins. Int-partition catalogs are the default and emit bare * equality predicates for pruning. Legacy string-partition catalogs must pass * `partitionKeyEncoding: 'string'` to emit `CONCAT(partition_col, '') = ?`, * working around R2 SQL's partition-string equality undercount while preserving * bound params. */ export declare function createR2SqlResolverAdapter(options?: R2SqlResolverAdapterOptions): ResolverAdapter;