import type { QueryInfo } from '../dialect'; import type { QueryStruct } from './query_node'; import type { Expr, OrderBy, PipeSegment, TurtleDef, UniqueKeyRequirement } from './malloy_types'; import { AndChain, type GenerateState } from './utils'; import { JoinInstance } from './join_instance'; import { type QueryField } from './query_node'; import type * as Malloy from '@malloydata/malloy-interfaces'; type InstanceFieldUsage = { type: 'result'; resultIndex: number; } | { type: 'where'; } | { type: 'dependant'; }; export declare class FieldInstanceField implements FieldInstance { f: QueryField; fieldUsage: InstanceFieldUsage; parent: FieldInstanceResult; readonly drillExpression: Malloy.Expression | undefined; type: FieldInstanceType; additionalGroupSets: number[]; analyticalSQL: string | undefined; partitionSQL: string | undefined; constructor(f: QueryField, fieldUsage: InstanceFieldUsage, parent: FieldInstanceResult, drillExpression: Malloy.Expression | undefined); root(): FieldInstanceResultRoot; static exprCompiler?: (resultSet: FieldInstanceResult, context: QueryStruct, expr: Expr, state?: GenerateState) => string; static registerExpressionCompiler(compiler: (resultSet: FieldInstanceResult, context: QueryStruct, expr: Expr, state?: GenerateState) => string): void; getSQL(): string; generateExpression(): string; private generateDistinctKeyExpression; getAnalyticalSQL(forPartition: boolean): string; } type RepeatedResultType = 'nested' | 'inline_all_numbers' | 'inline'; export type UngroupSet = { type: 'all' | 'exclude'; fields: string[]; groupSet: number; }; export declare class FieldInstanceResult implements FieldInstance { turtleDef: TurtleDef; parent: FieldInstanceResult | undefined; type: FieldInstanceType; allFields: Map; groupSet: number; depth: number; childGroups: number[]; firstSegment: PipeSegment; hasHaving: boolean; ungroupedSets: Map; resultUsesUngrouped: boolean; constructor(turtleDef: TurtleDef, parent: FieldInstanceResult | undefined); getLimit(): number | undefined; /** * Information about the query containing this result set. Invented * to pass on timezone information, but maybe more things will * eventually go in here. * * For nested queries, this walks up the FieldInstanceResult parent chain * to find the most specific (innermost) query timezone that applies. * @returns QueryInfo */ getQueryInfo(): QueryInfo; addField(as: string, field: QueryField, usage: InstanceFieldUsage, drillExpression: Malloy.Expression | undefined): void; parentGroupSet(): number; add(name: string, f: FieldInstance): void; hasField(name: string): boolean; getField(name: string): FieldInstanceField; getFieldByNumber(index: number): { name: string; fif: FieldInstanceField; }; computeGroups(nextGroupSetNumber: number, depth: number): { nextGroupSetNumber: number; maxDepth: number; children: number[]; isComplex: boolean; }; fields(fn?: undefined | ((field: FieldInstanceField) => boolean)): FieldInstanceField[]; fieldNames(fn: undefined | ((field: FieldInstanceField) => boolean)): string[]; getRepeatedResultType(): RepeatedResultType; structs(): FieldInstanceResult[]; selectStructs(result: FieldInstanceResult[], fn: (result: FieldInstanceResult) => boolean): FieldInstanceResult[]; calculateDefaultOrderBy(): OrderBy[]; addStructToJoin(qs: QueryStruct, uniqueKeyRequirement: UniqueKeyRequirement): void; root(): FieldInstanceResultRoot; getUngroupPartitions(ungroupSet: UngroupSet | undefined): FieldInstanceField[]; assignFieldsToGroups(): void; } type FieldInstanceType = 'field' | 'query'; export interface FieldInstance { type: FieldInstanceType; root(): FieldInstanceResultRoot; } export declare class FieldInstanceResultRoot extends FieldInstanceResult { joins: Map; havings: AndChain; isComplexQuery: boolean; queryUsesPartitioning: boolean; computeOnlyGroups: number[]; elimatedComputeGroups: boolean; constructor(turtleDef: TurtleDef); root(): FieldInstanceResultRoot; eliminateComputeGroupsSQL(): string; calculateSymmetricAggregates(): void; } export declare function sqlFullChildReference(struct: QueryStruct, name: string, expand: { result: FieldInstanceResult; field: QueryField; } | undefined): string; export {};