import { ResolverAdapter } from "./types.mjs"; import { TableName } from "@gscdump/contracts"; type PgTableKey = TableName; 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. */ 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'; } 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'; } declare function createParquetResolverAdapter(options?: ResolverAdapterOptions): ResolverAdapter; /** * Multi-tenant pg-flavored adapter for the Iceberg / R2 SQL read path. * 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. */ declare function createIcebergResolverAdapter(options?: ResolverAdapterOptions): 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. */ declare function createR2SqlResolverAdapter(options?: R2SqlResolverAdapterOptions): ResolverAdapter; export { PgTableKey, R2SqlResolverAdapterOptions, ResolverAdapterOptions, createIcebergResolverAdapter, createParquetResolverAdapter, createR2SqlResolverAdapter, pgResolverAdapter };