/** * Schema index for efficient table/column lookups and dimensional name parsing. * * @internal */ import { DateDimension, JaqlDataSourceForDto } from '@sisense/sdk-data'; import type { NormalizedColumn, NormalizedTable } from '../../../types.js'; /** * Schema index for efficient table/column lookups and greedy matching * @internal */ export interface SchemaIndex { /** Tables sorted by name length (descending) for greedy matching */ sortedTables: NormalizedTable[]; /** Columns sorted by name length (descending) per table for greedy matching */ tableColumnMap: Map; /** O(1) table lookup by exact name */ tableMap: Map; /** O(1) column lookup: table name → (column name → column) */ columnMap: Map>; } /** * Creates a schema index with pre-sorted arrays and Maps for efficient lookups * * @param tables - Array of normalized tables * @returns SchemaIndex with sorted arrays and Maps * @internal */ export declare function createSchemaIndex(tables: NormalizedTable[]): SchemaIndex; /** * Parses a dimensional name using schema-aware greedy matching to handle dots in table/column names. * Table and column segments are matched case-insensitively against the schema; returned table/column * objects keep canonical names and expressions. Date level suffixes are case-sensitive. * If two tables share the same name ignoring case, the first match in {@link SchemaIndex.sortedTables} wins. * * @param dimensionalName - The dimensional name (e.g., "DM.Brand.io.Brand" or "DM.Commerce.Date.Years") * @param schemaIndex - The schema index for efficient matching * @returns Parsed result with matched table, column, and optional level * @internal */ export declare function parseDimensionalName(dimensionalName: string, schemaIndex: SchemaIndex): { table: NormalizedTable; column: NormalizedColumn; level?: string; }; /** Options for {@link createAttributeFromName} when translating custom formula context. */ export interface CreateAttributeFromNameOptions { /** When the dimensional name has no date level, use this level for datetime columns (e.g. from xdiff function). */ inferredDateLevel?: string; } export declare function createAttributeFromName(attributeName: string, dataSource: JaqlDataSourceForDto, schemaIndex: SchemaIndex, options?: CreateAttributeFromNameOptions): import("@sisense/sdk-data").Attribute | import("@sisense/sdk-data").LevelAttribute; export declare function createDateDimensionFromName(dateDimensionName: string, dataSource: JaqlDataSourceForDto, schemaIndex: SchemaIndex): DateDimension;