import { DerivedRelation, DbIdType, RelationNameType, LogicalTimestep, DielAst, Relation } from "../parser/dielAstTypes"; import { NodeDependencyAugmented, NodeDependency, TableMetaData } from "../runtime/runtimeTypes"; import { PhysicalMetaData } from "../runtime/DielRuntime"; import { SingleDistribution } from "./passes/distributeQueries"; import { SqlAst, SqlRelation } from "../parser/sqlAstTypes"; export declare const LocalDbId = 1; export declare class DielPhysicalExecution { ast: DielAst; addRelationToDiel: (r: Relation) => void; augmentedDep: Map; metaData: PhysicalMetaData; sqlAstSpecPerDb: Map; distributions: SingleDistribution[]; cachedEventViews: Set; getEventByTimestep: (step: LogicalTimestep) => RelationNameType; constructor(ast: DielAst, metaData: PhysicalMetaData, getEventByTimestep: (step: LogicalTimestep) => RelationNameType, addRelationToDiel: (r: Relation) => void); RemoveDerivedAst(view: DerivedRelation): void; AddDerivedAst(view: DerivedRelation): void; private setAstSpecPerDbIfNotExist; GetInstructionsToAddOutput(view: DerivedRelation): { dbId: number; relationDef: SqlRelation; }[]; GetInstructionsToRemoveQuery(): void; /** * Distributed execution core * the logic is as follows: * if the from is a different location from the to, * then make the destination a table, and the original location * else * if the relation is static and immutable, do nothing * else, define it * YIFAN TODO: this needs testing! */ private getExecutionSpecForSingleDistribution; private addNewRelationsToExistingSpec; private getSqlAstSpecsFromDistribution; /** * This is where we apply the default async policies * so if any of the relations are remote, we will have the relation * @param output */ distributedEvalForOutput(output: DerivedRelation): SingleDistribution[]; /** * recursive function to evaluate what view needs to be where */ distributedEval(): void; /** * we want to figure out what relations to ship from the individual remotes * @param dbId * @param staticRelation * @param outputRelation */ getBubbledUpRelationToShipForStatic(dbId: DbIdType, staticRelation: RelationNameType, outputRelation: RelationNameType): { destination: DbIdType; relation: RelationNameType; }[]; /** * this functions figures out what views are dependent on the new relation at the db location. * @param dbId * @param eventRelation */ getBubbledUpRelationToShipForEvent(dbId: DbIdType, eventRelation: RelationNameType, includedForRelation?: RelationNameType[]): { destination: DbIdType; relation: RelationNameType; }[]; getStaticAsyncViewTrigger(outputName: string): { dbId: DbIdType; relation: RelationNameType; }[] | null; getRelationEventTableDependencies(): void; /** * The goal of this function is to figure out for a specific engine, for a specific interaction what we need to ship. * Note that views might change too, if they are shipped, so the shipping logic is not limited the original tables * PERF FIXME: this can be materialized * @param dbId * @param requestTimestep */ getRelationsToShipForDb(dbId: DbIdType, requestTimestep: LogicalTimestep): { deps: Set; relationsToShip: Map>; } | null; getShippingInfoForDbByEvent(eventTable: RelationNameType, engineId: DbIdType): { destinationDbIds: number[]; relationsNeeded: SingleDistribution[]; }; getLocalDbAst(): SqlAst; getAstFromDbId(dbId: DbIdType): SqlAst; augmentDepTreeNode(nodDep: NodeDependency, relationName: RelationNameType): NodeDependencyAugmented | null; augmentSingleDepTreeNode(nodeDep: NodeDependency, relationName: RelationNameType): void; /** * adding where the location is, as well as the type of location it is. */ augmentDepTree(): void; selectRelationEvalOwner(dbIds: Set): DbIdType; getRemoteInfoById(remoteId: DbIdType): SqlAst; getDbIdByRelationName(rName: string): DbIdType | null; } export declare function dependsOnLocalTables(deps: string[], relationLocations: Map): boolean; export declare function dependsOnRemoteTables(deps: string[], relationLocations: Map): boolean; export declare function dependsOnBothLocalAndForeignTables(deps: string[], relationLocations: Map): boolean; /** * Determines whether the event view can be cached. * This is determined by inpecting all of the join clauses and the * base relation. To be cacheable, all of these must either exclusively * reference local tables or exclusively reference foreign tables. * @param relation * @param relationLocations */ export declare function isEventViewCacheable(relation: DerivedRelation, relationLocations: Map): boolean; //# sourceMappingURL=DielPhysicalExecution.d.ts.map