semanticdb-v2 2.0.0-alpha.8 → 2.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,8 @@ import type { CompiledQuery } from '../compiler/index';
2
2
  import type { DataRow } from '../physical/index';
3
3
  import type { LogicalPlan } from '../planner/index';
4
4
  import type { SchemaMappingDefinition, SchemaMappingRegistry } from '../schema-mappings/index';
5
- import type { InternalExecuteOptions } from './types';
5
+ import type { InternalExecuteOptions, SqlExecutionSource } from './types';
6
+ export type SqlExecutionSourceReporter = (source: SqlExecutionSource) => void;
6
7
  export interface PhysicalQuerySource {
7
8
  readonly schemaId: string;
8
9
  readonly source: string;
@@ -13,6 +14,6 @@ export interface PhysicalQuerySource {
13
14
  export declare const resolvePhysicalSourceMapping: (source: PhysicalQuerySource, mappings: SchemaMappingRegistry) => SchemaMappingDefinition | undefined;
14
15
  export declare const collectPlanSources: (plan: LogicalPlan) => readonly PhysicalQuerySource[];
15
16
  export declare const mergePhysicalSources: (groups: readonly (readonly PhysicalQuerySource[])[]) => readonly PhysicalQuerySource[];
16
- export declare const executeCompiledQuery: (compiled: CompiledQuery, sources: readonly PhysicalQuerySource[], options: Pick<InternalExecuteOptions, "cache" | "provider" | "schemaMappings" | "signal" | "connectionId">) => Promise<DataRow[]>;
17
+ export declare const executeCompiledQuery: (compiled: CompiledQuery, sources: readonly PhysicalQuerySource[], options: Pick<InternalExecuteOptions, "cache" | "provider" | "schemaMappings" | "signal" | "connectionId">, reportExecutionSource?: SqlExecutionSourceReporter) => Promise<DataRow[]>;
17
18
  /** Apply final SQL shaping after all plans, views, and derived sources are compiled. */
18
19
  export declare const shortenCompiledQuery: (compiled: CompiledQuery) => CompiledQuery;
@@ -4,6 +4,7 @@ import type { OperatorRegistry } from '../operators/index';
4
4
  import type { CoreComputeProvider, DataRow } from '../physical/index';
5
5
  import type { LogicalPlan } from '../planner/index';
6
6
  import type { SchemaMappingRegistry } from '../schema-mappings/index';
7
+ import type { SqlExecutionSourceReporter } from './execute-query';
7
8
  import type { InternalExecuteOptions } from './types';
8
9
  export declare const coordinatorConnectionId = "__semanticdb_coordinator__";
9
10
  export interface FederatedCompiledQuery {
@@ -21,7 +22,7 @@ interface FederatedExecutionOptions {
21
22
  readonly cache?: InternalExecuteOptions['cache'];
22
23
  readonly signal?: AbortSignal;
23
24
  readonly maxMaterializedRows: number;
24
- readonly onCompiled: (query: FederatedCompiledQuery) => void;
25
+ readonly onCompiled: (query: FederatedCompiledQuery) => SqlExecutionSourceReporter;
25
26
  }
26
27
  export interface FederatedExecutionResult {
27
28
  readonly rows: DataRow[];
@@ -9,6 +9,7 @@ import type { Permissions } from '../permissions/index';
9
9
  import type { ResolvedSemanticSchema, SemanticTypeRegistry } from '../semantic-types/index';
10
10
  import type { EntityFetchRequest } from './result-hydrator/index';
11
11
  import type { SemanticDBPlugin } from '../plugins/index';
12
+ import type { SqlExecutionSourceReporter } from './execute-query';
12
13
  import type { LocaleRegistry } from '../i18n/index';
13
14
  interface FetchEntityOptions {
14
15
  readonly version: string;
@@ -25,7 +26,7 @@ interface FetchEntityOptions {
25
26
  readonly preferredConnectionId?: string;
26
27
  readonly cache?: QueryCacheExecutionOptions;
27
28
  readonly signal?: AbortSignal;
28
- readonly onCompiled?: (compiled: CompiledQuery, logicform: LogicformType, provider: CoreComputeProvider, connectionId?: string) => void;
29
+ readonly onCompiled?: (compiled: CompiledQuery, logicform: LogicformType, provider: CoreComputeProvider, connectionId?: string) => SqlExecutionSourceReporter | undefined;
29
30
  }
30
31
  export declare const fetchEntities: (request: EntityFetchRequest, options: FetchEntityOptions) => Promise<DataRow[]>;
31
32
  export {};
@@ -1,3 +1,3 @@
1
1
  export { execute } from './execute';
2
2
  export { closeConnections } from './connection-registry';
3
- export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, PartialExecuteResult, ProgressCallback, } from './types';
3
+ export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, SqlExecutionSource, PartialExecuteResult, ProgressCallback, } from './types';
@@ -140,6 +140,7 @@ export interface ExecuteFailureResult {
140
140
  }
141
141
  export type ExecuteResult = ExecuteSuccessResult | ExecuteFailureResult;
142
142
  export type ExecutedSqlType = 'computation' | 'semantic-resolution' | 'total';
143
+ export type SqlExecutionSource = 'cache' | 'database';
143
144
  export interface ExecutedSql {
144
145
  /** Why this SQL participates in the LogicForm execution. */
145
146
  readonly type: ExecutedSqlType;
@@ -155,6 +156,8 @@ export interface ExecutedSql {
155
156
  readonly parameters: SqlParameters;
156
157
  /** Dialect-formatted diagnostic SQL. SemanticDB never executes this string. */
157
158
  readonly displaySql: string;
159
+ /** Actual row source. Absent only before execution, such as in the compiled progress event. */
160
+ readonly executionSource?: SqlExecutionSource;
158
161
  }
159
162
  export type PartialExecuteResult = Partial<ExecuteSuccessResult>;
160
163
  export {};
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export type { OperatorDefinition, OperatorDefaultNameContext, OperatorExecutionC
19
19
  export type { SchemaMappingDefinition, SchemaMappingEnrichmentDefinition, SchemaMappingEnrichmentKey, SchemaMappingItem, SchemaMappingGranularity, SchemaMappingGranularityExtensions, SchemaMappingPointTemporalDefinition, SchemaMappingPredDefinition, SchemaMappingPredMatch, SchemaMappingSelection, RejectedSchemaMapping, SourceFreshnessPolicy, YiAskSchemaMappingItem, YiAskSchemaMappingRecord, } from './schema-mappings/index';
20
20
  export { QueryCacheManager } from './cache/index';
21
21
  export type { InvalidateQueryCacheSourceOptions, QueryCacheConfiguration, } from './cache/index';
22
- export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, PartialExecuteResult, ProgressCallback, } from './executor/index';
22
+ export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, SqlExecutionSource, PartialExecuteResult, ProgressCallback, } from './executor/index';
23
23
  export type { ColumnPermissions, Permissions, SchemaPermissions, } from './permissions/index';
24
24
  export type { CreateLogicalPlanOptions, LogicalPlan, QueryLineage, } from './planner/index';
25
25
  export { PlannerSemanticRegistry, createPlannerSemanticRegistry, } from './planner/index';
@@ -174,9 +174,9 @@ export interface OperatorRewriteLogicformContext extends OperatorHookContext {
174
174
  readonly getOperator?: (name: string) => OperatorDefinition;
175
175
  }
176
176
  export interface OperatorComponentContext extends OperatorHookContext {
177
- /** Fully normalized LogicForm containing this top-level operator projection. */
177
+ /** Normalized input LogicForm; having, sort, limit, limitBy, and page stay on the merged result. */
178
178
  readonly logicform: LogicformType;
179
- /** Caller-authored normalized LogicForm before executor row policies were added. */
179
+ /** Caller-authored normalized input before executor row policies, with result operations removed. */
180
180
  readonly sourceLogicform?: LogicformType;
181
181
  /** The operator projection for which the component is being built. */
182
182
  readonly pred: PredItemType;