semanticdb-v2 2.0.0-alpha.1 → 2.0.0-alpha.10
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.
- package/README.md +346 -46
- package/dist/cache/index.d.ts +2 -1
- package/dist/cache/manager.d.ts +5 -0
- package/dist/cache/registry.d.ts +14 -0
- package/dist/cache/types.d.ts +17 -0
- package/dist/close.d.ts +1 -0
- package/dist/compatibility/index.d.ts +2 -2
- package/dist/compatibility/logicform.d.ts +1 -7
- package/dist/compiler/compile-cte.d.ts +17 -2
- package/dist/compiler/index.d.ts +2 -1
- package/dist/compiler/shorten-sql.d.ts +1 -1
- package/dist/errors.d.ts +3 -0
- package/dist/executor/compatibility.d.ts +13 -0
- package/dist/executor/components.d.ts +8 -3
- package/dist/executor/connection-registry.d.ts +1 -12
- package/dist/executor/execute-query.d.ts +8 -2
- package/dist/executor/federated-execution.d.ts +38 -0
- package/dist/executor/fetch-entities.d.ts +7 -1
- package/dist/executor/index.d.ts +1 -1
- package/dist/executor/result-hydrator/types.d.ts +2 -0
- package/dist/executor/row-identity.d.ts +2 -1
- package/dist/executor/total.d.ts +11 -0
- package/dist/executor/types.d.ts +64 -19
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/locales/en-US.d.ts +2 -0
- package/dist/i18n/locales/zh-CN.d.ts +2 -0
- package/dist/i18n/registry.d.ts +13 -0
- package/dist/i18n/types.d.ts +9 -0
- package/dist/index.d.ts +16 -16
- package/dist/logicform-types.d.ts +56 -36
- package/dist/normalizer/core.d.ts +16 -2
- package/dist/normalizer/default-pred-name.d.ts +2 -0
- package/dist/normalizer/index.d.ts +1 -0
- package/dist/normalizer/pred-expression.d.ts +6 -0
- package/dist/normalizer/property-resolve.d.ts +6 -0
- package/dist/operators/builtins/constant.d.ts +2 -0
- package/dist/operators/builtins/period-name.d.ts +2 -1
- package/dist/operators/builtins/period-value.d.ts +2 -0
- package/dist/operators/builtins/query-expression.d.ts +3 -0
- package/dist/operators/builtins/scalar-extremum.d.ts +3 -0
- package/dist/operators/index.d.ts +2 -1
- package/dist/operators/registry.d.ts +5 -3
- package/dist/operators/resolve.d.ts +3 -0
- package/dist/operators/types.d.ts +102 -49
- package/dist/physical/clickhouse-provider.d.ts +29 -2
- package/dist/physical/connection-registry.d.ts +13 -0
- package/dist/physical/connection.d.ts +57 -15
- package/dist/physical/dameng-provider.d.ts +66 -0
- package/dist/physical/databricks-provider.d.ts +88 -0
- package/dist/physical/db-connector.d.ts +23 -0
- package/dist/physical/display-query.d.ts +3 -0
- package/dist/physical/doris-provider.d.ts +7 -1
- package/dist/physical/duckdb-coordinator-provider.d.ts +37 -0
- package/dist/physical/gbase-provider.d.ts +11 -0
- package/dist/physical/index.d.ts +24 -9
- package/dist/physical/load-driver.d.ts +1 -0
- package/dist/physical/maxcompute-provider.d.ts +44 -0
- package/dist/physical/mysql-protocol-provider.d.ts +27 -7
- package/dist/physical/mysql-provider.d.ts +2 -1
- package/dist/physical/oracle-provider.d.ts +21 -4
- package/dist/physical/postgresql-provider.d.ts +25 -4
- package/dist/physical/provider.d.ts +66 -2
- package/dist/physical/snowflake-provider.d.ts +20 -3
- package/dist/physical/sqlserver-provider.d.ts +69 -0
- package/dist/physical/starrocks-provider.d.ts +7 -1
- package/dist/physical/table-description.d.ts +5 -0
- package/dist/physical/table-discovery.d.ts +10 -0
- package/dist/planner/build-lineage.d.ts +1 -1
- package/dist/planner/create-logical-plan.d.ts +7 -0
- package/dist/planner/index.d.ts +4 -2
- package/dist/planner/mapping-granularity.d.ts +7 -0
- package/dist/planner/rewrite-nested-components.d.ts +8 -0
- package/dist/planner/select-schema-mapping.d.ts +16 -2
- package/dist/planner/semantics/index.d.ts +0 -3
- package/dist/planner/semantics/periods.d.ts +13 -0
- package/dist/planner/semantics/registry-defaults.d.ts +2 -1
- package/dist/planner/semantics/registry.d.ts +2 -1
- package/dist/planner/types.d.ts +94 -14
- package/dist/plugins/hierarchy/index.d.ts +1 -1
- package/dist/plugins/hierarchy/mapping-granularity.d.ts +4 -0
- package/dist/plugins/hierarchy/types.d.ts +20 -2
- package/dist/plugins/index.d.ts +10 -1
- package/dist/{planner/semantics → plugins}/observation/classification.d.ts +1 -1
- package/dist/plugins/observation/index.d.ts +17 -0
- package/dist/{planner/semantics → plugins}/observation/operator-policy.d.ts +4 -5
- package/dist/plugins/observation/periods.d.ts +18 -0
- package/dist/{planner/semantics → plugins}/observation/rule.d.ts +1 -1
- package/dist/plugins/observation/types.d.ts +3 -0
- package/dist/plugins/property-hierarchy/index.d.ts +11 -0
- package/dist/plugins/recursive/index.d.ts +26 -0
- package/dist/plugins/temporal/index.d.ts +13 -0
- package/dist/plugins/types.d.ts +165 -1
- package/dist/plugins/validity/classification.d.ts +5 -0
- package/dist/plugins/validity/index.d.ts +15 -0
- package/dist/plugins/validity/periods.d.ts +15 -0
- package/dist/plugins/validity/query-policy.d.ts +3 -0
- package/dist/plugins/validity/rule.d.ts +2 -0
- package/dist/plugins/validity/semantic-types.d.ts +3 -0
- package/dist/schema/dependent-projection.d.ts +8 -0
- package/dist/schema/entity-identity.d.ts +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema-mappings/freshness.d.ts +1 -1
- package/dist/schema-mappings/granularity.d.ts +5 -0
- package/dist/schema-mappings/index.d.ts +4 -1
- package/dist/schema-mappings/registry.d.ts +6 -3
- package/dist/schema-mappings/types.d.ts +52 -8
- package/dist/schema-mappings/yiask.d.ts +26 -0
- package/dist/semantic-types/builtins/tag.d.ts +2 -0
- package/dist/semantic-types/index.d.ts +5 -3
- package/dist/semantic-types/registry.d.ts +2 -0
- package/dist/semantic-types/resolve-schema.d.ts +1 -1
- package/dist/semantic-types/types.d.ts +22 -10
- package/dist/semantic-types/validate-resolved-schema.d.ts +2 -5
- package/dist/semanticdb.esm.js +5 -0
- package/dist/semanticdb.js +5 -0
- package/package.json +49 -17
- package/dist/cache/expiry.js +0 -1
- package/dist/cache/identity.js +0 -1
- package/dist/cache/redis-query-cache.js +0 -1
- package/dist/cache/serialization.js +0 -1
- package/dist/calendar/constants.d.ts +0 -7
- package/dist/calendar/constants.js +0 -1
- package/dist/calendar/index.d.ts +0 -6
- package/dist/calendar/provider-relation-store.d.ts +0 -9
- package/dist/calendar/provider-relation-store.js +0 -1
- package/dist/calendar/resolver.d.ts +0 -10
- package/dist/calendar/resolver.js +0 -1
- package/dist/calendar/system-schemas.d.ts +0 -3
- package/dist/calendar/system-schemas.js +0 -1
- package/dist/calendar/types.d.ts +0 -31
- package/dist/compatibility/logicform.js +0 -1
- package/dist/compiler/compile-cte.js +0 -1
- package/dist/compiler/compile-plan.js +0 -1
- package/dist/compiler/shorten-sql.js +0 -2
- package/dist/custom-functions/custom-functions.d.ts +0 -6
- package/dist/custom-functions/custom-functions.js +0 -1
- package/dist/custom-functions/index.d.ts +0 -3
- package/dist/custom-functions/operator-adapter.d.ts +0 -12
- package/dist/custom-functions/operator-adapter.js +0 -1
- package/dist/custom-functions/types.d.ts +0 -62
- package/dist/errors.js +0 -1
- package/dist/executor/compatibility.js +0 -1
- package/dist/executor/components.js +0 -1
- package/dist/executor/connection-registry.js +0 -1
- package/dist/executor/evaluate.js +0 -1
- package/dist/executor/execute-query.js +0 -1
- package/dist/executor/execute.js +0 -1
- package/dist/executor/fetch-entities.js +0 -1
- package/dist/executor/result-hydrator/entity-loader.js +0 -1
- package/dist/executor/result-hydrator/format-values.js +0 -1
- package/dist/executor/result-hydrator/hydrate-result.js +0 -1
- package/dist/executor/result-hydrator/missing-entity.js +0 -1
- package/dist/executor/result-hydrator/populate-entities.js +0 -1
- package/dist/executor/row-identity.js +0 -1
- package/dist/index.js +0 -1
- package/dist/logicform-types.js +0 -1
- package/dist/normalizer/core.js +0 -1
- package/dist/normalizer/default-pred-name.js +0 -1
- package/dist/normalizer/entity-id.js +0 -1
- package/dist/normalizer/groupby.js +0 -1
- package/dist/normalizer/normalize-logicform.js +0 -1
- package/dist/normalizer/pagination.js +0 -1
- package/dist/normalizer/pred-query-name.js +0 -1
- package/dist/normalizer/preds.js +0 -1
- package/dist/normalizer/query.js +0 -1
- package/dist/normalizer/version.js +0 -1
- package/dist/operators/builtins/abs.js +0 -1
- package/dist/operators/builtins/accumulate.js +0 -1
- package/dist/operators/builtins/add.js +0 -1
- package/dist/operators/builtins/arithmetic.js +0 -1
- package/dist/operators/builtins/average-per-period.js +0 -1
- package/dist/operators/builtins/avg.js +0 -1
- package/dist/operators/builtins/case.js +0 -1
- package/dist/operators/builtins/concat.js +0 -1
- package/dist/operators/builtins/count-distinct.js +0 -1
- package/dist/operators/builtins/count.js +0 -1
- package/dist/operators/builtins/date-bucket.js +0 -1
- package/dist/operators/builtins/divide.js +0 -1
- package/dist/operators/builtins/index.js +0 -1
- package/dist/operators/builtins/max.js +0 -1
- package/dist/operators/builtins/min.js +0 -1
- package/dist/operators/builtins/multiply.js +0 -1
- package/dist/operators/builtins/newly.js +0 -1
- package/dist/operators/builtins/period-boundary.js +0 -1
- package/dist/operators/builtins/period-difference.js +0 -1
- package/dist/operators/builtins/period-growth.js +0 -1
- package/dist/operators/builtins/period-name.js +0 -1
- package/dist/operators/builtins/period-shift.js +0 -1
- package/dist/operators/builtins/rank.js +0 -1
- package/dist/operators/builtins/row-number.js +0 -1
- package/dist/operators/builtins/share-of-total.js +0 -1
- package/dist/operators/builtins/sql.js +0 -1
- package/dist/operators/builtins/substring.js +0 -1
- package/dist/operators/builtins/subtract.js +0 -1
- package/dist/operators/builtins/sum.js +0 -1
- package/dist/operators/builtins/time-range.js +0 -1
- package/dist/operators/groupby.js +0 -1
- package/dist/operators/index.js +0 -1
- package/dist/operators/registry.js +0 -1
- package/dist/operators/sql-expression.js +0 -1
- package/dist/permissions/permissions.js +0 -1
- package/dist/physical/clickhouse-provider.js +0 -1
- package/dist/physical/connection.js +0 -1
- package/dist/physical/display-query.js +0 -1
- package/dist/physical/doris-provider.js +0 -1
- package/dist/physical/mysql-compatible-sql.js +0 -1
- package/dist/physical/mysql-protocol-provider.js +0 -1
- package/dist/physical/mysql-provider.js +0 -1
- package/dist/physical/oracle-provider.js +0 -1
- package/dist/physical/postgresql-provider.js +0 -1
- package/dist/physical/snowflake-provider.js +0 -1
- package/dist/physical/starrocks-provider.js +0 -1
- package/dist/planner/build-lineage.js +0 -1
- package/dist/planner/create-logical-plan.js +0 -1
- package/dist/planner/select-schema-mapping.js +0 -1
- package/dist/planner/semantics/lifecycle/classification.d.ts +0 -7
- package/dist/planner/semantics/lifecycle/classification.js +0 -1
- package/dist/planner/semantics/lifecycle/index.d.ts +0 -3
- package/dist/planner/semantics/lifecycle/query-policy.d.ts +0 -3
- package/dist/planner/semantics/lifecycle/query-policy.js +0 -1
- package/dist/planner/semantics/lifecycle/rule.d.ts +0 -2
- package/dist/planner/semantics/lifecycle/rule.js +0 -1
- package/dist/planner/semantics/observation/classification.js +0 -1
- package/dist/planner/semantics/observation/index.d.ts +0 -4
- package/dist/planner/semantics/observation/operator-policy.js +0 -1
- package/dist/planner/semantics/observation/rule.js +0 -1
- package/dist/planner/semantics/observation/types.d.ts +0 -3
- package/dist/planner/semantics/registry-defaults.js +0 -1
- package/dist/planner/semantics/registry.js +0 -1
- package/dist/planner/types.js +0 -1
- package/dist/plugins/hierarchy/compatibility.js +0 -1
- package/dist/plugins/hierarchy/entity-identity.js +0 -1
- package/dist/plugins/hierarchy/index.js +0 -1
- package/dist/plugins/hierarchy/operator.js +0 -1
- package/dist/plugins/hierarchy/resolve-schema.js +0 -1
- package/dist/plugins/index.js +0 -1
- package/dist/schema/entity-identity.js +0 -1
- package/dist/schema/resolve-property-path.js +0 -1
- package/dist/schema/schema-registry.js +0 -1
- package/dist/schema-mappings/freshness.js +0 -1
- package/dist/schema-mappings/registry.js +0 -1
- package/dist/semantic-types/builtins/boolean.js +0 -1
- package/dist/semantic-types/builtins/category.js +0 -1
- package/dist/semantic-types/builtins/currency.js +0 -1
- package/dist/semantic-types/builtins/date.js +0 -1
- package/dist/semantic-types/builtins/duration.js +0 -1
- package/dist/semantic-types/builtins/end-date.d.ts +0 -2
- package/dist/semantic-types/builtins/end-date.js +0 -1
- package/dist/semantic-types/builtins/entity.js +0 -1
- package/dist/semantic-types/builtins/file.js +0 -1
- package/dist/semantic-types/builtins/human-name.js +0 -1
- package/dist/semantic-types/builtins/id.js +0 -1
- package/dist/semantic-types/builtins/image.js +0 -1
- package/dist/semantic-types/builtins/index.js +0 -1
- package/dist/semantic-types/builtins/int.js +0 -1
- package/dist/semantic-types/builtins/name.js +0 -1
- package/dist/semantic-types/builtins/number.js +0 -1
- package/dist/semantic-types/builtins/object.js +0 -1
- package/dist/semantic-types/builtins/order.js +0 -1
- package/dist/semantic-types/builtins/percentage.js +0 -1
- package/dist/semantic-types/builtins/start-date.d.ts +0 -2
- package/dist/semantic-types/builtins/start-date.js +0 -1
- package/dist/semantic-types/builtins/string.js +0 -1
- package/dist/semantic-types/builtins/timestamp.js +0 -1
- package/dist/semantic-types/index.js +0 -1
- package/dist/semantic-types/primal-types/date.js +0 -1
- package/dist/semantic-types/primal-types/index.js +0 -1
- package/dist/semantic-types/registry.js +0 -1
- package/dist/semantic-types/resolve-schema.js +0 -1
- package/dist/semantic-types/validate-resolved-schema.js +0 -1
- package/dist/utils/clone.js +0 -1
- /package/dist/operators/builtins/{period-boundary.d.ts → period-boundary-expression.d.ts} +0 -0
|
@@ -1,10 +1,55 @@
|
|
|
1
1
|
export type DataRow = Record<string, unknown>;
|
|
2
2
|
export type SqlParameters = readonly unknown[];
|
|
3
|
+
export type DatePart = 'second' | 'minute' | 'hour' | 'weekday' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
4
|
+
/** Module-augmentation seam for application-owned Provider kinds. */
|
|
5
|
+
export interface ProviderKindExtensions {
|
|
6
|
+
}
|
|
7
|
+
export type ProviderKind = 'clickhouse' | 'databricks' | 'dameng' | 'doris' | 'duckdb' | 'gbase' | 'maxcompute' | 'mysql' | 'oracle' | 'postgresql' | 'snowflake' | 'sqlserver' | 'starrocks' | Extract<keyof ProviderKindExtensions, string>;
|
|
3
8
|
export interface ProviderExecutionRequest {
|
|
4
9
|
readonly sql: string;
|
|
5
10
|
readonly parameters: SqlParameters;
|
|
6
11
|
readonly signal?: AbortSignal;
|
|
7
12
|
}
|
|
13
|
+
/** Native SQL results, without semantic hydration or generated row identities. */
|
|
14
|
+
export interface SQLResult {
|
|
15
|
+
readonly rows: DataRow[];
|
|
16
|
+
/** Omitted when the driver does not report an affected-row count. */
|
|
17
|
+
readonly affectedRows?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface DatabaseTable {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly database?: string;
|
|
22
|
+
readonly schema?: string;
|
|
23
|
+
readonly type: 'table' | 'view';
|
|
24
|
+
}
|
|
25
|
+
export interface TableListRequest {
|
|
26
|
+
/** Database/catalog override; unsupported scopes are rejected, not ignored. */
|
|
27
|
+
readonly database?: string;
|
|
28
|
+
readonly schema?: string;
|
|
29
|
+
readonly signal?: AbortSignal;
|
|
30
|
+
}
|
|
31
|
+
export interface DescribeTableRequest extends TableListRequest {
|
|
32
|
+
/** Literal, unqualified physical table name; use database/schema for its namespace. */
|
|
33
|
+
readonly table: string;
|
|
34
|
+
/** Read one example row by default. Disable to inspect metadata only. */
|
|
35
|
+
readonly includeSample?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface DatabaseColumn {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
/** Native database type, including size/precision where available. */
|
|
40
|
+
readonly type: string;
|
|
41
|
+
readonly comment: string;
|
|
42
|
+
/** Omitted if the database/adapter cannot report primary-key membership. */
|
|
43
|
+
readonly primaryKey?: boolean;
|
|
44
|
+
/** Omitted for empty tables, disabled sampling, or a failed sample query. */
|
|
45
|
+
readonly exampleValue?: unknown;
|
|
46
|
+
}
|
|
47
|
+
export interface TableDescription {
|
|
48
|
+
readonly columns: DatabaseColumn[];
|
|
49
|
+
readonly tableInfo: DatabaseTable & {
|
|
50
|
+
readonly comment: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
8
53
|
export interface SqlRenderCapabilities {
|
|
9
54
|
/** Whether HAVING may reference an alias declared in the same SELECT list. */
|
|
10
55
|
readonly supportsHavingAlias?: boolean;
|
|
@@ -12,15 +57,29 @@ export interface SqlRenderCapabilities {
|
|
|
12
57
|
tableAlias(expression: string, alias: string): string;
|
|
13
58
|
paginate(sql: string, pageSize: number, offset: number): string;
|
|
14
59
|
dateBucket(expression: string, level: string): string;
|
|
60
|
+
/** Extract a numeric date component. weekday uses Monday=1 through Sunday=7. */
|
|
61
|
+
datePart(expression: string, part: DatePart): string;
|
|
15
62
|
dateShift(expression: string, granularity: string, offset: number): string;
|
|
63
|
+
datePeriodBoundary?(expression: string, granularity: string, boundary: 'start' | 'end'): string;
|
|
64
|
+
/** Cast a bound literal to the semantic type required by the SQL expression. */
|
|
65
|
+
castValue?(expression: string, type: string): string;
|
|
66
|
+
/** Render a NULL-ignoring scalar extremum without a correlated subquery. */
|
|
67
|
+
scalarExtremum?(operator: 'least' | 'greatest', expressions: readonly string[]): string;
|
|
16
68
|
aggregateFunction(name: string, expression?: string): string;
|
|
69
|
+
stringify(expression: string): string;
|
|
17
70
|
concat(expressions: readonly string[]): string;
|
|
18
71
|
substring(expression: string, start: number, length: number): string;
|
|
72
|
+
/** Return the number of characters in a string expression. */
|
|
73
|
+
stringLength(expression: string): string;
|
|
19
74
|
regex(expression: string, pattern: string, options?: string): string;
|
|
20
75
|
/** Whether the dialect supports a WITH RECURSIVE subquery. */
|
|
21
76
|
readonly supportsRecursiveCte?: boolean;
|
|
77
|
+
/** Recursive-term set operator. Defaults to UNION when omitted. */
|
|
78
|
+
readonly recursiveCteUnion?: 'UNION' | 'UNION ALL';
|
|
22
79
|
arrayContains?(arrayExpression: string, valueExpression: string): string;
|
|
23
|
-
|
|
80
|
+
/** Coerce a native text array, JSON array, or scalar text value to a text array. */
|
|
81
|
+
normalizeStringArray?(expression: string): string;
|
|
82
|
+
expandArray?(arrayExpression: string, alias: string, column: string, elementType?: 'string'): {
|
|
24
83
|
readonly joinSql: string;
|
|
25
84
|
readonly valueExpression: string;
|
|
26
85
|
};
|
|
@@ -29,12 +88,17 @@ export interface SqlRenderCapabilities {
|
|
|
29
88
|
* Internal physical database contract used by the compiler and executor.
|
|
30
89
|
*/
|
|
31
90
|
export interface CoreComputeProvider extends SqlRenderCapabilities {
|
|
32
|
-
readonly kind:
|
|
91
|
+
readonly kind: ProviderKind;
|
|
33
92
|
/** Maximum items accepted by one SQL IN expression, when the dialect has a limit. */
|
|
34
93
|
readonly maxInListItems?: number;
|
|
35
94
|
parameter(index: number, value: unknown): string;
|
|
36
95
|
/** Render bound parameters for diagnostics only; this SQL is never executed by SemanticDB. */
|
|
37
96
|
displayQuery(sql: string, parameters: SqlParameters): string;
|
|
38
97
|
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
98
|
+
/** Optional native-SQL capability; execute retains its row-query contract. */
|
|
99
|
+
runSQL?(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
100
|
+
/** Optional physical metadata capability, independent of semantic Schemas. */
|
|
101
|
+
getTableList?(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
102
|
+
describeTable?(request: DescribeTableRequest): Promise<TableDescription>;
|
|
39
103
|
close(): Promise<void>;
|
|
40
104
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CoreComputeProvider, DataRow, ProviderExecutionRequest } from './provider';
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
3
2
|
type SnowflakeBind = string | number | boolean | null;
|
|
4
3
|
export interface SnowflakeStatementLike {
|
|
5
4
|
cancel(callback?: (error?: Error) => void): void;
|
|
5
|
+
getNumUpdatedRows?(): number | undefined;
|
|
6
6
|
}
|
|
7
7
|
export interface SnowflakeConnectionLike {
|
|
8
8
|
connect(callback: (error?: Error) => void): unknown;
|
|
@@ -13,9 +13,20 @@ export interface SnowflakeConnectionLike {
|
|
|
13
13
|
}): SnowflakeStatementLike;
|
|
14
14
|
destroy(callback: (error?: Error) => void): unknown;
|
|
15
15
|
}
|
|
16
|
+
export interface SnowflakeConnectionOptions {
|
|
17
|
+
readonly account?: string;
|
|
18
|
+
readonly username?: string;
|
|
19
|
+
readonly password?: string;
|
|
20
|
+
readonly warehouse?: string;
|
|
21
|
+
readonly database?: string;
|
|
22
|
+
readonly schema?: string;
|
|
23
|
+
readonly role?: string;
|
|
24
|
+
readonly authenticator?: string;
|
|
25
|
+
readonly [option: string]: unknown;
|
|
26
|
+
}
|
|
16
27
|
export interface SnowflakeProviderOptions {
|
|
17
28
|
/** Options passed to snowflake-sdk's createConnection(). */
|
|
18
|
-
readonly connection?:
|
|
29
|
+
readonly connection?: object;
|
|
19
30
|
/** Injectable SDK connection used by tests or caller-managed connection factories. */
|
|
20
31
|
readonly client?: SnowflakeConnectionLike;
|
|
21
32
|
}
|
|
@@ -29,10 +40,13 @@ export declare class SnowflakeProvider implements CoreComputeProvider {
|
|
|
29
40
|
parameter(index: number, value: unknown): string;
|
|
30
41
|
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
31
42
|
dateBucket(expression: string, level: string): string;
|
|
43
|
+
datePart(expression: string, part: DatePart): string;
|
|
32
44
|
dateShift(expression: string, granularity: string, offset: number): string;
|
|
33
45
|
aggregateFunction(name: string, expression?: string): string;
|
|
46
|
+
stringify(expression: string): string;
|
|
34
47
|
concat(expressions: readonly string[]): string;
|
|
35
48
|
substring(expression: string, start: number, length: number): string;
|
|
49
|
+
stringLength(expression: string): string;
|
|
36
50
|
regex(expression: string, pattern: string, options?: string): string;
|
|
37
51
|
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
38
52
|
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
@@ -40,6 +54,9 @@ export declare class SnowflakeProvider implements CoreComputeProvider {
|
|
|
40
54
|
valueExpression: string;
|
|
41
55
|
};
|
|
42
56
|
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
57
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
58
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
59
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
43
60
|
close(): Promise<void>;
|
|
44
61
|
}
|
|
45
62
|
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DataRow, DatePart, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
2
|
+
type SQLServerBind = string | number | boolean | Date | Buffer | null;
|
|
3
|
+
export interface SQLServerRequestLike {
|
|
4
|
+
input(name: string, value: SQLServerBind): this;
|
|
5
|
+
query(sql: string): Promise<{
|
|
6
|
+
readonly recordset?: unknown;
|
|
7
|
+
readonly rowsAffected?: readonly number[];
|
|
8
|
+
}>;
|
|
9
|
+
cancel(): void;
|
|
10
|
+
}
|
|
11
|
+
export interface SQLServerPoolLike {
|
|
12
|
+
connect(): Promise<unknown>;
|
|
13
|
+
request(): SQLServerRequestLike;
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export interface SQLServerDriverLike {
|
|
17
|
+
readonly ConnectionPool: new (options: object) => SQLServerPoolLike;
|
|
18
|
+
}
|
|
19
|
+
export interface SQLServerConnectionOptions {
|
|
20
|
+
readonly host?: string;
|
|
21
|
+
readonly server?: string;
|
|
22
|
+
readonly port?: number;
|
|
23
|
+
readonly user?: string;
|
|
24
|
+
readonly password?: string;
|
|
25
|
+
readonly database?: string;
|
|
26
|
+
readonly options?: Readonly<Record<string, unknown>>;
|
|
27
|
+
readonly pool?: Readonly<Record<string, unknown>>;
|
|
28
|
+
readonly requestTimeout?: number;
|
|
29
|
+
readonly connectionTimeout?: number;
|
|
30
|
+
readonly [option: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
export interface SQLServerProviderOptions {
|
|
33
|
+
readonly connection?: SQLServerConnectionOptions;
|
|
34
|
+
readonly pool?: SQLServerPoolLike;
|
|
35
|
+
readonly driver?: SQLServerDriverLike;
|
|
36
|
+
}
|
|
37
|
+
export declare const sqlServerPoolOptions: (connection: SQLServerConnectionOptions) => object;
|
|
38
|
+
export declare class SQLServerProvider implements CoreComputeProvider {
|
|
39
|
+
#private;
|
|
40
|
+
readonly kind: "sqlserver";
|
|
41
|
+
readonly supportsHavingAlias = false;
|
|
42
|
+
constructor(options?: SQLServerProviderOptions);
|
|
43
|
+
quoteIdentifier(identifier: string): string;
|
|
44
|
+
tableAlias(expression: string, alias: string): string;
|
|
45
|
+
paginate(sql: string, pageSize: number, offset: number): string;
|
|
46
|
+
parameter(index: number, value: unknown): string;
|
|
47
|
+
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
48
|
+
dateBucket(expression: string, level: string): string;
|
|
49
|
+
datePart(expression: string, part: DatePart): string;
|
|
50
|
+
dateShift(expression: string, granularity: string, offset: number): string;
|
|
51
|
+
castValue(expression: string, type: string): string;
|
|
52
|
+
aggregateFunction(name: string, expression?: string): string;
|
|
53
|
+
stringify(expression: string): string;
|
|
54
|
+
concat(expressions: readonly string[]): string;
|
|
55
|
+
substring(expression: string, start: number, length: number): string;
|
|
56
|
+
stringLength(expression: string): string;
|
|
57
|
+
regex(expression: string, pattern: string, options?: string): string;
|
|
58
|
+
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
59
|
+
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
60
|
+
readonly joinSql: string;
|
|
61
|
+
readonly valueExpression: string;
|
|
62
|
+
};
|
|
63
|
+
execute(execution: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
64
|
+
runSQL(execution: ProviderExecutionRequest): Promise<SQLResult>;
|
|
65
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
66
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
67
|
+
close(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { MySQLProtocolProvider } from './mysql-protocol-provider';
|
|
2
|
-
import type { MySQLProtocolPoolLike, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
|
|
2
|
+
import type { MySQLProtocolPoolLike, MySQLProtocolConnectionOptions, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
|
|
3
3
|
export type StarRocksPoolLike = MySQLProtocolPoolLike;
|
|
4
|
+
export type StarRocksConnectionOptions = MySQLProtocolConnectionOptions;
|
|
4
5
|
export type StarRocksProviderOptions = MySQLProtocolProviderOptions;
|
|
5
6
|
/** StarRocks adapter using its MySQL-compatible protocol and SQL surface. */
|
|
6
7
|
export declare class StarRocksProvider extends MySQLProtocolProvider {
|
|
7
8
|
readonly kind: "starrocks";
|
|
8
9
|
constructor(options?: StarRocksProviderOptions);
|
|
10
|
+
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
11
|
+
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
12
|
+
readonly joinSql: string;
|
|
13
|
+
readonly valueExpression: string;
|
|
14
|
+
};
|
|
9
15
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DataRow, DescribeTableRequest, TableDescription } from './provider';
|
|
2
|
+
export declare const validateDescribeTable: (request: DescribeTableRequest) => void;
|
|
3
|
+
/** INFORMATION_SCHEMA/Oracle expose size separately; PostgreSQL/MySQL already format native types. */
|
|
4
|
+
export declare const columnType: (row: DataRow) => string;
|
|
5
|
+
export declare const describePhysicalTable: (provider: CoreComputeProvider, request: DescribeTableRequest) => Promise<TableDescription>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DatabaseTable, DataRow, TableListRequest } from './provider';
|
|
2
|
+
export declare const validateTableScope: (request: TableListRequest) => void;
|
|
3
|
+
export declare const rejectTableScope: (provider: CoreComputeProvider, field: "database" | "schema") => never;
|
|
4
|
+
/** Drivers differ in alias casing; never silently discard malformed metadata rows. */
|
|
5
|
+
export declare const metadataValue: (row: DataRow, field: string) => unknown;
|
|
6
|
+
export declare const metadataString: (row: DataRow, field: string) => string;
|
|
7
|
+
export declare const normalizeTableRow: (row: DataRow) => DatabaseTable;
|
|
8
|
+
export declare const normalizeTableMetadata: (rows: DataRow[]) => DatabaseTable[];
|
|
9
|
+
/** Physical metadata SQL only; no semantic Schema resolution belongs here. */
|
|
10
|
+
export declare const discoverTables: (provider: CoreComputeProvider, request: TableListRequest) => Promise<DatabaseTable[]>;
|
|
@@ -2,4 +2,4 @@ import type { OperatorRegistry } from '../operators/index';
|
|
|
2
2
|
import type { CoreComputeProvider } from '../physical/index';
|
|
3
3
|
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
4
4
|
import type { LogicalPlan, QueryLineage } from './types';
|
|
5
|
-
export declare const buildLineage: (plan: LogicalPlan, schema: ResolvedSemanticSchema, provider: CoreComputeProvider, operators?: OperatorRegistry) => QueryLineage;
|
|
5
|
+
export declare const buildLineage: (plan: LogicalPlan, schema: ResolvedSemanticSchema, provider: CoreComputeProvider, operators?: OperatorRegistry, providerForConnection?: (connectionId: string) => CoreComputeProvider) => QueryLineage;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { LogicformType } from '../logicform-types';
|
|
2
2
|
import type { OperatorRegistry } from '../operators/index';
|
|
3
3
|
import { SchemaMappingRegistry } from '../schema-mappings/index';
|
|
4
|
+
import type { SchemaMappingSelection } from '../schema-mappings/index';
|
|
5
|
+
import type { SemanticDBPlugin } from '../plugins/index';
|
|
4
6
|
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
5
7
|
import type { ResolvedSemanticProperty } from '../semantic-types/index';
|
|
6
8
|
import { type PlannerSemanticRegistry } from './semantics/index';
|
|
@@ -8,8 +10,13 @@ import type { LogicalPlan } from './types';
|
|
|
8
10
|
export declare const createResultSchema: (plan: LogicalPlan, sourceSchema: ResolvedSemanticSchema) => ResolvedSemanticSchema;
|
|
9
11
|
export declare const createDerivedSourceSchema: (sourcePlan: LogicalPlan, outerSchema: ResolvedSemanticSchema) => ResolvedSemanticSchema;
|
|
10
12
|
export interface CreateLogicalPlanOptions {
|
|
13
|
+
readonly plugins?: readonly SemanticDBPlugin[];
|
|
11
14
|
readonly resolveSchema?: (schemaId: string) => ResolvedSemanticSchema;
|
|
15
|
+
/** Prefer physical mappings colocated with the execution's main connection. */
|
|
16
|
+
readonly preferredConnectionId?: string;
|
|
12
17
|
readonly canUsePropertyRowIdentity?: (schema: ResolvedSemanticSchema, property: ResolvedSemanticProperty) => boolean;
|
|
13
18
|
readonly semanticRegistry?: PlannerSemanticRegistry;
|
|
19
|
+
/** Observe each physical Schema mapping decision made during planning. */
|
|
20
|
+
readonly onSchemaMappingSelection?: (selection: SchemaMappingSelection) => void;
|
|
14
21
|
}
|
|
15
22
|
export declare const createLogicalPlan: (logicform: LogicformType, schema: ResolvedSemanticSchema, operators?: OperatorRegistry, schemaMappings?: SchemaMappingRegistry, options?: CreateLogicalPlanOptions) => LogicalPlan;
|
package/dist/planner/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { buildLineage } from './build-lineage';
|
|
2
2
|
export { createDerivedSourceSchema, createLogicalPlan, createResultSchema } from './create-logical-plan';
|
|
3
3
|
export type { CreateLogicalPlanOptions } from './create-logical-plan';
|
|
4
|
-
export type { Expression, ArrayExpansionPlan, FieldReferencePlan, GroupLimitPlan, JoinPlan, LogicalQuerySubquery,
|
|
5
|
-
export { isLogicalQuerySubquery,
|
|
4
|
+
export type { Expression, ArrayExpansionPlan, EnrichmentJoinPlan, FieldReferencePlan, GroupLimitPlan, JoinPlan, LogicalQuerySubquery, LogicalQueryOperator, LogicalOrdinalQuery, LogicalExpressionQuery, LineageColumnSource, LineageOutput, LogicalPlan, OrderPlan, PaginationPlan, ProjectionPlan, QueryLineage, RowIdentityPlan, PeriodSourcePlan, TemporalJoinConditionPlan, } from './types';
|
|
5
|
+
export { isLogicalQuerySubquery, isLogicalQueryOperator } from './types';
|
|
6
6
|
export { isLogicalOrdinalQuery } from './types';
|
|
7
|
+
export { isLogicalExpressionQuery } from './types';
|
|
7
8
|
export * from './semantics/index';
|
|
9
|
+
export { createPlannerSemanticRegistry } from './semantics/registry-defaults';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LogicformType } from '../logicform-types';
|
|
2
|
+
import type { SemanticDBPlugin } from '../plugins/index';
|
|
3
|
+
import { type OperatorRegistry } from '../operators/index';
|
|
4
|
+
import { type SchemaMappingDefinition } from '../schema-mappings/index';
|
|
5
|
+
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
6
|
+
/** Checks grouped-source Property coverage and delegates plugin-owned physical grains. */
|
|
7
|
+
export declare const mappingGranularityReason: (logicform: LogicformType, schema: ResolvedSemanticSchema, mapping: SchemaMappingDefinition, resolveSchema?: (schemaId: string) => ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[], operators?: OperatorRegistry) => string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LogicformType } from '../logicform-types';
|
|
2
|
+
import type { OperatorRegistry } from '../operators/index';
|
|
3
|
+
/**
|
|
4
|
+
* Lift component inputs into a derived LogicForm so ordinary expression operators can consume
|
|
5
|
+
* their result columns. The inner LogicForm owns source-grain work; the outer LogicForm owns
|
|
6
|
+
* result operations and the expression path above every component.
|
|
7
|
+
*/
|
|
8
|
+
export declare const rewriteNestedComponents: (logicform: LogicformType, operators: OperatorRegistry) => LogicformType | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { LogicformType } from '../logicform-types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SemanticDBPlugin } from '../plugins/index';
|
|
3
|
+
import type { SchemaMappingDefinition, SchemaMappingRegistry, SchemaMappingSelection } from '../schema-mappings/index';
|
|
3
4
|
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
5
|
+
import { type OperatorRegistry } from '../operators/index';
|
|
4
6
|
export interface PredMappingRewrite {
|
|
5
7
|
readonly predIndex: number;
|
|
6
8
|
readonly column: string;
|
|
@@ -9,6 +11,18 @@ export interface SelectedSchemaMapping {
|
|
|
9
11
|
readonly mapping: SchemaMappingDefinition;
|
|
10
12
|
readonly logicform: LogicformType;
|
|
11
13
|
readonly predRewrites: readonly PredMappingRewrite[];
|
|
14
|
+
readonly selection: SchemaMappingSelection;
|
|
15
|
+
}
|
|
16
|
+
export interface MappedPropertySource {
|
|
17
|
+
readonly column: string;
|
|
18
|
+
readonly sourceRef?: string;
|
|
12
19
|
}
|
|
13
20
|
export declare const mappedPropertyColumn: (mapping: SchemaMappingDefinition, schema: ResolvedSemanticSchema, reference: string) => string | undefined;
|
|
14
|
-
export declare const
|
|
21
|
+
export declare const mappedPropertySource: (mapping: SchemaMappingDefinition, schema: ResolvedSemanticSchema, reference: string) => MappedPropertySource | undefined;
|
|
22
|
+
export declare const selectSchemaMapping: (logicform: LogicformType, schema: ResolvedSemanticSchema, mappings: SchemaMappingRegistry, options?: {
|
|
23
|
+
readonly preferredConnectionId?: string;
|
|
24
|
+
readonly resolveSchema?: (schemaId: string) => ResolvedSemanticSchema;
|
|
25
|
+
/** Extra plugins used by this execution; must also be supplied when registering plugin grains. */
|
|
26
|
+
readonly plugins?: readonly SemanticDBPlugin[];
|
|
27
|
+
readonly operators?: OperatorRegistry;
|
|
28
|
+
}) => SelectedSchemaMapping;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export * from './observation/index';
|
|
2
|
-
export * from './lifecycle/index';
|
|
3
1
|
export { PlannerSemanticRegistry } from './registry';
|
|
4
2
|
export type { PlannerSemanticResolution, PlannerSemanticQueryContext, PlannerSemanticRule, PlannerSemanticRuleContext, } from './registry';
|
|
5
|
-
export { createPlannerSemanticRegistry } from './registry-defaults';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TimeGranularity } from '../../semantic-types/index';
|
|
2
|
+
export interface Period {
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly start: string;
|
|
5
|
+
readonly end: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PeriodErrorContext {
|
|
8
|
+
readonly codePrefix: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const isTimeGranularity: (value: unknown) => value is TimeGranularity;
|
|
12
|
+
/** Expand one bounded time condition into natural boundaries at the requested granularity. */
|
|
13
|
+
export declare const resolvePeriods: (condition: unknown, granularity: TimeGranularity, context: PeriodErrorContext) => readonly Period[];
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { PlannerSemanticRegistry } from './registry';
|
|
2
|
-
|
|
2
|
+
import type { SemanticDBPlugin } from '../../plugins/index';
|
|
3
|
+
export declare const createPlannerSemanticRegistry: (plugins?: readonly SemanticDBPlugin[]) => PlannerSemanticRegistry;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { PredItemType } from '../../logicform-types';
|
|
2
2
|
import type { LogicformType, QueryType } from '../../logicform-types';
|
|
3
3
|
import type { ResolvedSemanticProperty, ResolvedSemanticSchema } from '../../semantic-types/index';
|
|
4
|
-
import type { OperatorDefinition, ResultProperty } from '../../operators/index';
|
|
4
|
+
import type { OperatorDefinition, OperatorExecutionContext, ResultProperty } from '../../operators/index';
|
|
5
5
|
export interface PlannerSemanticRuleContext {
|
|
6
6
|
readonly pred: PredItemType;
|
|
7
7
|
readonly schema: ResolvedSemanticSchema;
|
|
8
8
|
readonly sourceProperty?: ResolvedSemanticProperty;
|
|
9
9
|
readonly outputProperty: ResultProperty;
|
|
10
10
|
readonly operator?: OperatorDefinition;
|
|
11
|
+
readonly executionContext?: OperatorExecutionContext;
|
|
11
12
|
}
|
|
12
13
|
export interface PlannerSemanticQueryContext {
|
|
13
14
|
readonly logicform: LogicformType;
|
package/dist/planner/types.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CoreComputeProvider } from '../physical/index';
|
|
2
|
+
import type { LogicformType } from '../logicform-types';
|
|
2
3
|
import type { ResultProperty } from '../operators/index';
|
|
3
4
|
import type { ComparableCategoryDefinition, TimeGranularity } from '../semantic-types/index';
|
|
5
|
+
import type { QueryOperatorDefinition } from '../plugins/index';
|
|
4
6
|
export interface FieldReferencePlan {
|
|
5
7
|
readonly schemaId: string;
|
|
6
8
|
readonly property: string;
|
|
@@ -10,31 +12,44 @@ export interface FieldReferencePlan {
|
|
|
10
12
|
readonly qualifier: string;
|
|
11
13
|
readonly sql?: string;
|
|
12
14
|
readonly timestampColumn?: string;
|
|
15
|
+
/** Source alias that supplies $TS when it differs from the Property's Schema. */
|
|
16
|
+
readonly timestampQualifier?: string;
|
|
13
17
|
readonly isArray?: boolean;
|
|
18
|
+
/** Accept native text arrays and JSON/scalar representations of string arrays. */
|
|
19
|
+
readonly normalizeStringArray?: boolean;
|
|
14
20
|
readonly comparable?: ComparableCategoryDefinition;
|
|
15
21
|
}
|
|
16
22
|
export interface LogicalQuerySubquery {
|
|
17
23
|
readonly kind: 'logicform-subquery';
|
|
18
24
|
readonly plan: LogicalPlan;
|
|
19
25
|
}
|
|
20
|
-
export interface
|
|
21
|
-
readonly kind: '
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export interface LogicalQueryOperator {
|
|
27
|
+
readonly kind: 'query-operator';
|
|
28
|
+
readonly operator: string;
|
|
29
|
+
readonly value: unknown;
|
|
30
|
+
readonly sources?: readonly {
|
|
31
|
+
readonly schemaId: string;
|
|
32
|
+
readonly source: string;
|
|
33
|
+
readonly connectionId?: string;
|
|
34
|
+
}[];
|
|
35
|
+
/** Capability selected during planning; omitted only by manually constructed plans. */
|
|
36
|
+
readonly definition?: QueryOperatorDefinition;
|
|
29
37
|
}
|
|
30
38
|
export interface LogicalOrdinalQuery {
|
|
31
39
|
readonly kind: 'ordinal-query';
|
|
32
40
|
readonly comparable: ComparableCategoryDefinition;
|
|
33
41
|
readonly condition: unknown;
|
|
34
42
|
}
|
|
43
|
+
export interface LogicalExpressionQuery {
|
|
44
|
+
readonly kind: 'expression-query';
|
|
45
|
+
readonly expression: Expression;
|
|
46
|
+
readonly condition: unknown;
|
|
47
|
+
readonly properties: readonly string[];
|
|
48
|
+
}
|
|
35
49
|
export declare const isLogicalQuerySubquery: (value: unknown) => value is LogicalQuerySubquery;
|
|
36
|
-
export declare const
|
|
50
|
+
export declare const isLogicalQueryOperator: (value: unknown) => value is LogicalQueryOperator;
|
|
37
51
|
export declare const isLogicalOrdinalQuery: (value: unknown) => value is LogicalOrdinalQuery;
|
|
52
|
+
export declare const isLogicalExpressionQuery: (value: unknown) => value is LogicalExpressionQuery;
|
|
38
53
|
export type Expression = {
|
|
39
54
|
readonly kind: 'array-element';
|
|
40
55
|
readonly schemaId: string;
|
|
@@ -55,6 +70,7 @@ export type Expression = {
|
|
|
55
70
|
readonly sql: string;
|
|
56
71
|
readonly qualifier?: string;
|
|
57
72
|
readonly timestampColumn?: string;
|
|
73
|
+
readonly timestampQualifier?: string;
|
|
58
74
|
} | {
|
|
59
75
|
readonly kind: 'operator';
|
|
60
76
|
readonly operator: string;
|
|
@@ -63,7 +79,7 @@ export type Expression = {
|
|
|
63
79
|
readonly qualifier?: string;
|
|
64
80
|
readonly schemaId?: string;
|
|
65
81
|
readonly input?: Expression;
|
|
66
|
-
readonly
|
|
82
|
+
readonly inputs?: readonly Expression[];
|
|
67
83
|
readonly args: Readonly<Record<string, unknown>>;
|
|
68
84
|
readonly query?: Readonly<Record<string, unknown>>;
|
|
69
85
|
} | {
|
|
@@ -107,17 +123,45 @@ export interface JoinPlan {
|
|
|
107
123
|
readonly sourceColumn: string;
|
|
108
124
|
readonly sourceSql?: string;
|
|
109
125
|
readonly sourceTimestampColumn?: string;
|
|
110
|
-
readonly sourceTimestampGranularity?: TimeGranularity;
|
|
111
126
|
readonly targetSchemaId: string;
|
|
127
|
+
/** Physical connection selected for the target Schema mapping. */
|
|
128
|
+
readonly targetConnectionId?: string;
|
|
112
129
|
readonly targetSource: string;
|
|
113
130
|
readonly targetSourceSql?: string;
|
|
114
131
|
readonly targetAlias: string;
|
|
115
132
|
readonly targetColumn: string;
|
|
116
133
|
readonly targetSql?: string;
|
|
117
134
|
readonly targetTimestampColumn?: string;
|
|
118
|
-
readonly
|
|
135
|
+
readonly temporalCondition?: TemporalJoinConditionPlan;
|
|
119
136
|
readonly sourceArrayExpansionPath?: string;
|
|
120
137
|
}
|
|
138
|
+
export type TemporalJoinConditionPlan = {
|
|
139
|
+
readonly kind: 'date-bucket-equal';
|
|
140
|
+
readonly sourceColumn: string;
|
|
141
|
+
readonly targetColumn: string;
|
|
142
|
+
readonly sourceGranularity: TimeGranularity;
|
|
143
|
+
readonly targetGranularity: TimeGranularity;
|
|
144
|
+
} | {
|
|
145
|
+
readonly kind: 'point-in-interval';
|
|
146
|
+
readonly pointSide: 'source' | 'target';
|
|
147
|
+
readonly pointColumn: string;
|
|
148
|
+
readonly intervalSide: 'source' | 'target';
|
|
149
|
+
readonly startColumn: string;
|
|
150
|
+
readonly endColumn: string;
|
|
151
|
+
};
|
|
152
|
+
export interface EnrichmentJoinPlan {
|
|
153
|
+
readonly kind: 'enrichment-left';
|
|
154
|
+
readonly id: string;
|
|
155
|
+
readonly source: string;
|
|
156
|
+
readonly sourceSql?: string;
|
|
157
|
+
readonly alias: string;
|
|
158
|
+
readonly baseAlias: string;
|
|
159
|
+
readonly keys: readonly {
|
|
160
|
+
readonly baseColumn: string;
|
|
161
|
+
readonly targetColumn: string;
|
|
162
|
+
}[];
|
|
163
|
+
readonly temporalCondition?: TemporalJoinConditionPlan;
|
|
164
|
+
}
|
|
121
165
|
export interface ArrayExpansionPlan {
|
|
122
166
|
readonly path: string;
|
|
123
167
|
readonly sourceAlias: string;
|
|
@@ -125,6 +169,8 @@ export interface ArrayExpansionPlan {
|
|
|
125
169
|
readonly sourceSql?: string;
|
|
126
170
|
readonly sourceTimestampColumn?: string;
|
|
127
171
|
readonly alias: string;
|
|
172
|
+
readonly normalizeStringArray?: boolean;
|
|
173
|
+
readonly elementType?: 'string';
|
|
128
174
|
}
|
|
129
175
|
export type PaginationPlan = {
|
|
130
176
|
readonly kind: 'rows';
|
|
@@ -140,9 +186,30 @@ export interface GroupLimitPlan {
|
|
|
140
186
|
readonly partitionBy: readonly string[];
|
|
141
187
|
readonly orderBy: readonly OrderPlan[];
|
|
142
188
|
}
|
|
189
|
+
export interface PeriodSourcePlan {
|
|
190
|
+
readonly alias: string;
|
|
191
|
+
readonly labelColumn: string;
|
|
192
|
+
readonly asOfColumn: string;
|
|
193
|
+
readonly sourceAlias: string;
|
|
194
|
+
readonly periods: readonly {
|
|
195
|
+
readonly label: string;
|
|
196
|
+
readonly asOf: string;
|
|
197
|
+
}[];
|
|
198
|
+
readonly match: {
|
|
199
|
+
readonly kind: 'interval';
|
|
200
|
+
readonly startColumn: string;
|
|
201
|
+
readonly endColumn: string;
|
|
202
|
+
} | {
|
|
203
|
+
readonly kind: 'latest';
|
|
204
|
+
readonly lookupAlias: string;
|
|
205
|
+
readonly timestampColumn: string;
|
|
206
|
+
};
|
|
207
|
+
}
|
|
143
208
|
export type RowIdentityPlan = {
|
|
144
209
|
readonly kind: 'group';
|
|
145
210
|
readonly names: readonly string[];
|
|
211
|
+
readonly separator: string;
|
|
212
|
+
readonly nullLabel: string;
|
|
146
213
|
} | {
|
|
147
214
|
readonly kind: 'property';
|
|
148
215
|
readonly column: string;
|
|
@@ -155,19 +222,27 @@ export type RowIdentityPlan = {
|
|
|
155
222
|
export interface LogicalPlan {
|
|
156
223
|
readonly schemaId: string;
|
|
157
224
|
readonly source: string;
|
|
225
|
+
/** Physical connection selected for this plan's source mapping. */
|
|
226
|
+
readonly connectionId?: string;
|
|
158
227
|
/** Trusted derived-table SQL supplied by the selected physical mapping. */
|
|
159
228
|
readonly sourceSql?: string;
|
|
160
229
|
/** Physical mapping selected by the Planner for this logical Schema. */
|
|
161
230
|
readonly mappingId?: string;
|
|
162
231
|
/** Child relations combined by their compatible group identity. */
|
|
163
|
-
readonly
|
|
232
|
+
readonly subplans?: readonly LogicalPlan[];
|
|
164
233
|
/** Optional query plan compiled as the derived-table source of this plan. */
|
|
165
234
|
readonly sourcePlan?: LogicalPlan;
|
|
235
|
+
/** Normalized LogicForm corresponding to sourcePlan when generated rewrites need execution. */
|
|
236
|
+
readonly sourceLogicform?: LogicformType;
|
|
166
237
|
readonly sourceAlias?: string;
|
|
167
238
|
readonly fields: Readonly<Record<string, string>>;
|
|
168
239
|
readonly fieldReferences?: Readonly<Record<string, FieldReferencePlan>>;
|
|
169
240
|
readonly joins?: readonly JoinPlan[];
|
|
241
|
+
/** Physical extensions of this mapping, added only when a mapped property uses them. */
|
|
242
|
+
readonly enrichmentJoins?: readonly EnrichmentJoinPlan[];
|
|
170
243
|
readonly arrayExpansions?: readonly ArrayExpansionPlan[];
|
|
244
|
+
/** Generated period rows matched to a source by a plugin-selected generic strategy. */
|
|
245
|
+
readonly periodSource?: PeriodSourcePlan;
|
|
171
246
|
readonly projections: readonly ProjectionPlan[];
|
|
172
247
|
readonly columnProperties?: readonly ResultProperty[];
|
|
173
248
|
readonly groupBy: readonly ProjectionPlan[];
|
|
@@ -196,6 +271,11 @@ export interface QueryLineage {
|
|
|
196
271
|
readonly schemaName: string;
|
|
197
272
|
readonly physicalTable: string;
|
|
198
273
|
readonly provider: CoreComputeProvider['kind'];
|
|
274
|
+
readonly connectionId?: string;
|
|
275
|
+
readonly connections?: readonly {
|
|
276
|
+
readonly connectionId: string;
|
|
277
|
+
readonly provider: CoreComputeProvider['kind'];
|
|
278
|
+
}[];
|
|
199
279
|
};
|
|
200
280
|
readonly outputs: readonly LineageOutput[];
|
|
201
281
|
readonly filters: readonly LineageColumnSource[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { SemanticDBPlugin } from '../types';
|
|
2
|
-
export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, } from './types';
|
|
2
|
+
export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, SchemaMappingHierarchyGranularity, } from './types';
|
|
3
3
|
export declare const hierarchyPlugin: SemanticDBPlugin;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MappingGranularityPlugin } from '../types';
|
|
2
|
+
import type { SchemaMappingHierarchyGranularity } from './types';
|
|
3
|
+
export declare const isMappingHierarchyGranularity: (value: unknown) => value is SchemaMappingHierarchyGranularity;
|
|
4
|
+
export declare const hierarchyMappingGranularity: MappingGranularityPlugin;
|