semanticdb-v2 2.0.0-alpha.5 → 2.0.0-alpha.6

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.
Files changed (89) hide show
  1. package/README.md +164 -7
  2. package/dist/cache/redis-query-cache.esm.js +1 -1
  3. package/dist/cache/redis-query-cache.js +1 -1
  4. package/dist/cache/types.d.ts +2 -0
  5. package/dist/executor/connection-registry.d.ts +2 -2
  6. package/dist/executor/execute-query.d.ts +6 -1
  7. package/dist/executor/federated-execution.d.ts +37 -0
  8. package/dist/executor/fetch-entities.d.ts +3 -1
  9. package/dist/executor/result-hydrator/types.d.ts +2 -0
  10. package/dist/executor/total.d.ts +11 -0
  11. package/dist/executor/types.d.ts +33 -4
  12. package/dist/index.d.ts +8 -7
  13. package/dist/logicform-types.d.ts +44 -12
  14. package/dist/normalizer/pred-expression.d.ts +6 -0
  15. package/dist/operators/builtins/query-expression.d.ts +3 -0
  16. package/dist/operators/index.d.ts +1 -1
  17. package/dist/operators/types.d.ts +39 -8
  18. package/dist/physical/clickhouse-provider.d.ts +6 -2
  19. package/dist/physical/connection.d.ts +57 -15
  20. package/dist/physical/dameng-provider.d.ts +61 -0
  21. package/dist/physical/databricks-provider.d.ts +83 -0
  22. package/dist/physical/display-query.d.ts +3 -0
  23. package/dist/physical/doris-provider.d.ts +2 -1
  24. package/dist/physical/duckdb-coordinator-provider.d.ts +37 -0
  25. package/dist/physical/gbase-provider.d.ts +11 -0
  26. package/dist/physical/index.d.ts +21 -9
  27. package/dist/physical/load-driver.d.ts +1 -0
  28. package/dist/physical/maxcompute-provider.d.ts +37 -0
  29. package/dist/physical/mysql-protocol-provider.d.ts +21 -6
  30. package/dist/physical/mysql-provider.d.ts +2 -1
  31. package/dist/physical/oracle-provider.d.ts +15 -4
  32. package/dist/physical/postgresql-provider.d.ts +18 -4
  33. package/dist/physical/provider.d.ts +12 -1
  34. package/dist/physical/snowflake-provider.d.ts +15 -3
  35. package/dist/physical/sqlserver-provider.d.ts +65 -0
  36. package/dist/physical/starrocks-provider.d.ts +2 -1
  37. package/dist/planner/build-lineage.d.ts +1 -1
  38. package/dist/planner/create-logical-plan.d.ts +7 -0
  39. package/dist/planner/index.d.ts +4 -2
  40. package/dist/planner/mapping-granularity.d.ts +7 -0
  41. package/dist/planner/rewrite-nested-components.d.ts +8 -0
  42. package/dist/planner/select-schema-mapping.d.ts +16 -2
  43. package/dist/planner/semantics/index.d.ts +0 -4
  44. package/dist/planner/semantics/periods.d.ts +13 -0
  45. package/dist/planner/semantics/registry-defaults.d.ts +2 -1
  46. package/dist/planner/types.d.ts +71 -34
  47. package/dist/plugins/hierarchy/index.d.ts +1 -1
  48. package/dist/plugins/hierarchy/mapping-granularity.d.ts +4 -0
  49. package/dist/plugins/hierarchy/types.d.ts +17 -0
  50. package/dist/plugins/index.d.ts +10 -1
  51. package/dist/{planner/semantics → plugins}/observation/classification.d.ts +1 -1
  52. package/dist/plugins/observation/index.d.ts +17 -0
  53. package/dist/{planner/semantics → plugins}/observation/operator-policy.d.ts +2 -3
  54. package/dist/{planner/semantics → plugins}/observation/periods.d.ts +2 -3
  55. package/dist/{planner/semantics → plugins}/observation/rule.d.ts +1 -1
  56. package/dist/{planner/semantics → plugins}/observation/types.d.ts +1 -1
  57. package/dist/plugins/property-hierarchy/index.d.ts +11 -0
  58. package/dist/plugins/recursive/index.d.ts +26 -0
  59. package/dist/plugins/temporal/index.d.ts +13 -0
  60. package/dist/plugins/types.d.ts +165 -1
  61. package/dist/plugins/validity/classification.d.ts +5 -0
  62. package/dist/{planner/semantics → plugins}/validity/index.d.ts +9 -0
  63. package/dist/{planner/semantics → plugins}/validity/periods.d.ts +2 -3
  64. package/dist/{planner/semantics → plugins}/validity/query-policy.d.ts +1 -2
  65. package/dist/{planner/semantics → plugins}/validity/rule.d.ts +1 -1
  66. package/dist/plugins/validity/semantic-types.d.ts +3 -0
  67. package/dist/schema-mappings/freshness.d.ts +1 -1
  68. package/dist/schema-mappings/granularity.d.ts +5 -0
  69. package/dist/schema-mappings/index.d.ts +2 -1
  70. package/dist/schema-mappings/registry.d.ts +5 -3
  71. package/dist/schema-mappings/types.d.ts +43 -0
  72. package/dist/schema-mappings/yiask.d.ts +6 -2
  73. package/dist/semantic-types/index.d.ts +5 -3
  74. package/dist/semantic-types/registry.d.ts +2 -0
  75. package/dist/semantic-types/resolve-schema.d.ts +1 -1
  76. package/dist/semantic-types/types.d.ts +0 -14
  77. package/dist/semantic-types/validate-resolved-schema.d.ts +2 -5
  78. package/dist/semanticdb.esm.js +4 -3
  79. package/dist/semanticdb.js +4 -3
  80. package/package.json +46 -5
  81. package/dist/planner/semantics/annual-periods.d.ts +0 -11
  82. package/dist/planner/semantics/lifecycle/classification.d.ts +0 -5
  83. package/dist/planner/semantics/lifecycle/index.d.ts +0 -3
  84. package/dist/planner/semantics/lifecycle/query-policy.d.ts +0 -2
  85. package/dist/planner/semantics/lifecycle/rule.d.ts +0 -2
  86. package/dist/planner/semantics/observation/index.d.ts +0 -6
  87. package/dist/planner/semantics/validity/classification.d.ts +0 -14
  88. package/dist/semantic-types/builtins/end-date.d.ts +0 -2
  89. package/dist/semantic-types/builtins/start-date.d.ts +0 -2
@@ -0,0 +1,3 @@
1
+ import type { OperatorDefinition } from '../types';
2
+ export declare const lengthOperator: OperatorDefinition;
3
+ export declare const datePartOperators: readonly OperatorDefinition[];
@@ -3,6 +3,6 @@ import { OperatorRegistry } from './registry';
3
3
  export { OperatorRegistry } from './registry';
4
4
  export { resolveOperator } from './resolve';
5
5
  export { bindTrustedSqlExpression } from './sql-expression';
6
- export type { OperatorDefinition, OperatorDefaultNameContext, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorExecutionComponent, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorEvaluateContext, OperatorOutputPropertyContext, OperatorObservationPolicy, OperatorObservationPolicyContext, OperatorNormalizePredContext, OperatorPlanExpressionContext, OperatorPeriodEvaluationContext, OperatorPlanInputContext, OperatorPlannedInput, OperatorRewriteLogicformContext, OperatorValidatePlanContext, OperatorSqlCapabilities, OperatorSqlContext, ResultProperty, ResultPropertyTemporalMetadata, } from './types';
6
+ export type { OperatorDefinition, OperatorDefaultNameContext, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorExecutionComponent, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorEvaluateContext, OperatorOutputPropertyContext, OperatorPeriodBoundaryPolicy, OperatorPeriodBoundaryPolicyContext, OperatorNormalizePredContext, OperatorPlanExpressionContext, OperatorPeriodEvaluationContext, OperatorPlanInputContext, OperatorPlannedInput, OperatorRewriteLogicformContext, OperatorValidatePlanContext, OperatorSqlCapabilities, OperatorSqlContext, ResultProperty, ResultPropertyTemporalMetadata, ResultPropertyTemporalMetadataExtensions, } from './types';
7
7
  export declare const builtinOperators: readonly import("./types").OperatorDefinition[];
8
8
  export declare const createOperatorRegistry: (plugins?: readonly SemanticDBPlugin[]) => OperatorRegistry;
@@ -1,7 +1,7 @@
1
1
  import type { PrimalType, ResolvedSemanticProperty, ResolvedSemanticSchema, TimeGranularity, ComparableCategoryDefinition } from '../semantic-types/index';
2
2
  import type { LogicformType, PredItemType } from '../logicform-types';
3
3
  import type { DataRow } from '../physical/index';
4
- import type { Expression } from '../planner/index';
4
+ import type { Expression, LogicalPlan } from '../planner/index';
5
5
  import type { LocaleTranslate } from '../i18n/index';
6
6
  export interface OperatorSqlCapabilities {
7
7
  /** Produce a dialect-specific aggregate function around an expression. */
@@ -10,6 +10,8 @@ export interface OperatorSqlCapabilities {
10
10
  quoteIdentifier(identifier: string): string;
11
11
  concat(expressions: readonly string[]): string;
12
12
  substring(expression: string, start: number, length: number): string;
13
+ stringLength(expression: string): string;
14
+ datePart(expression: string, part: 'second' | 'minute' | 'hour' | 'weekday' | 'day' | 'week' | 'month' | 'quarter' | 'year'): string;
13
15
  dateBucket(expression: string, granularity: TimeGranularity): string;
14
16
  dateShift(expression: string, granularity: TimeGranularity, offset: number): string;
15
17
  /** Render a period boundary directly when the dialect has a concise native form. */
@@ -46,6 +48,8 @@ export interface ResultProperty {
46
48
  readonly type: string;
47
49
  readonly primal_type: PrimalType;
48
50
  readonly isArray: boolean;
51
+ /** Description inherited from the source Property or supplied by the operator. */
52
+ readonly description?: string;
49
53
  /** Referenced Schema for object-valued result columns. */
50
54
  readonly ref?: string;
51
55
  readonly granularity?: TimeGranularity;
@@ -53,8 +57,11 @@ export interface ResultProperty {
53
57
  /** Runtime temporal semantics for this output column, when applicable. */
54
58
  readonly temporal?: ResultPropertyTemporalMetadata;
55
59
  }
56
- export interface ResultPropertyTemporalMetadata {
57
- readonly kind: 'period-boundary' | 'period-shift' | 'date-bucket' | 'validity' | 'lifecycle';
60
+ /** Plugin-owned result temporal metadata extends this interface by key. */
61
+ export interface ResultPropertyTemporalMetadataExtensions {
62
+ }
63
+ export type ResultPropertyTemporalMetadata = {
64
+ readonly kind: 'period-boundary' | 'period-shift' | 'date-bucket';
58
65
  readonly boundary?: 'start' | 'end';
59
66
  readonly sourceProperty?: string;
60
67
  readonly requestedRange?: {
@@ -74,7 +81,7 @@ export interface ResultPropertyTemporalMetadata {
74
81
  readonly group: Readonly<Record<string, unknown>>;
75
82
  readonly date: string;
76
83
  }[];
77
- }
84
+ } | ResultPropertyTemporalMetadataExtensions[keyof ResultPropertyTemporalMetadataExtensions];
78
85
  export interface OperatorOutputPropertyContext {
79
86
  /** Final alias assigned to this operator's single output column. */
80
87
  readonly name: string;
@@ -135,10 +142,10 @@ export interface OperatorPlanExpressionContext {
135
142
  readonly getOperator: (name: string) => OperatorDefinition;
136
143
  readonly planQuery: (query: Readonly<Record<string, unknown>>) => Readonly<Record<string, unknown>>;
137
144
  }
138
- export interface OperatorObservationPolicyContext {
145
+ export interface OperatorPeriodBoundaryPolicyContext {
139
146
  readonly pred: PredItemType;
140
147
  }
141
- export interface OperatorObservationPolicy {
148
+ export interface OperatorPeriodBoundaryPolicy {
142
149
  readonly boundary: 'start' | 'end';
143
150
  readonly implicit: boolean;
144
151
  }
@@ -148,6 +155,9 @@ export interface OperatorValidatePlanContext {
148
155
  readonly resolveGroupName: (reference: string) => string | undefined;
149
156
  readonly getOperator: (name: string) => OperatorDefinition;
150
157
  }
158
+ export interface OperatorValidateGroupbyContext {
159
+ readonly pred: PredItemType;
160
+ }
151
161
  export interface OperatorRewriteLogicformContext {
152
162
  readonly logicform: LogicformType;
153
163
  readonly schema: ResolvedSemanticSchema;
@@ -222,8 +232,23 @@ export type OperatorExecutionComponent = OperatorQueryComponent | OperatorCompon
222
232
  interface OperatorDefinitionBase {
223
233
  /** Public registry key. Built-in operators commonly use a `$` prefix, but it is not required. */
224
234
  readonly name: string;
235
+ /** Description of the computed metric, exposed on its result Property. */
236
+ readonly description?: string;
225
237
  /** Produce the normalized output name when the PredItem does not declare one. */
226
238
  readonly defaultName: (context: OperatorDefaultNameContext) => string;
239
+ /** Translation key for the generated name. Defaults to `operator.${name}`. */
240
+ readonly defaultNameKey?: string | ((context: OperatorDefaultNameContext) => string);
241
+ /** defaultName already used the translator and must not be translated a second time. */
242
+ readonly defaultNameIsLocalized?: boolean;
243
+ /** A grouped physical source may safely apply this operator again to stored partial results. */
244
+ readonly supportsGroupedSourceRollup?: boolean;
245
+ /** This computed operator preserves a grouped physical source's dimension semantics. */
246
+ readonly supportsGroupedSourceGroupby?: boolean;
247
+ /** Requested time grain of a grouped dimension, when this is a time grouping operator. */
248
+ readonly groupedSourceTimeGranularity?: (context: {
249
+ readonly pred: PredItemType;
250
+ readonly property: ResolvedSemanticProperty;
251
+ }) => TimeGranularity | undefined;
227
252
  /** Logical property names read in addition to the direct input property. */
228
253
  readonly dependencies?: readonly string[];
229
254
  /** Set to false for operators such as `$count` that do not require a property. */
@@ -236,10 +261,16 @@ interface OperatorDefinitionBase {
236
261
  readonly normalizePred?: (context: OperatorNormalizePredContext) => PredItemType;
237
262
  /** Build a provider-independent expression for operators with custom planning semantics. */
238
263
  readonly planExpression?: (context: OperatorPlanExpressionContext) => Expression | undefined;
239
- /** Resolve observation temporal semantics for this operator, when applicable. */
240
- readonly observationPolicy?: (context: OperatorObservationPolicyContext) => OperatorObservationPolicy | undefined;
264
+ /** Describe how this operator selects a value at a generated period boundary. */
265
+ readonly periodBoundaryPolicy?: (context: OperatorPeriodBoundaryPolicyContext) => OperatorPeriodBoundaryPolicy | undefined;
241
266
  /** Validate this operator against the completed group key set. */
242
267
  readonly validatePlan?: (context: OperatorValidatePlanContext) => void;
268
+ /** Validate semantics that apply only when this Operator is used as a group key. */
269
+ readonly validateGroupby?: (context: OperatorValidateGroupbyContext) => void;
270
+ /** The logical planner may fully lower a component, so no executor child query is needed. */
271
+ readonly skipComponentExecution?: (context: {
272
+ readonly plan: LogicalPlan;
273
+ }) => boolean;
243
274
  /** Expand high-level operator semantics into ordinary nested LogicForm objects before planning. */
244
275
  readonly rewriteLogicform?: (context: OperatorRewriteLogicformContext) => LogicformType | undefined;
245
276
  /** Whether this operator requires one evaluation per time bucket. */
@@ -1,4 +1,4 @@
1
- import type { CoreComputeProvider, DataRow, ProviderExecutionRequest } from './provider';
1
+ import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest } from './provider';
2
2
  interface ClickHouseResultLike {
3
3
  json<T>(): Promise<T>;
4
4
  }
@@ -25,8 +25,10 @@ export interface ClickHouseProviderOptions {
25
25
  readonly client?: ClickHouseClientLike;
26
26
  }
27
27
  export declare class ClickHouseProvider implements CoreComputeProvider {
28
+ #private;
28
29
  readonly kind: "clickhouse";
29
- private readonly client;
30
+ readonly supportsRecursiveCte = true;
31
+ readonly recursiveCteUnion: "UNION ALL";
30
32
  constructor(options?: ClickHouseProviderOptions);
31
33
  quoteIdentifier(identifier: string): string;
32
34
  tableAlias(expression: string, alias: string): string;
@@ -34,6 +36,7 @@ export declare class ClickHouseProvider implements CoreComputeProvider {
34
36
  parameter(index: number, value: unknown): string;
35
37
  displayQuery(sql: string, parameters: readonly unknown[]): string;
36
38
  dateBucket(expression: string, level: string): string;
39
+ datePart(expression: string, part: DatePart): string;
37
40
  dateShift(expression: string, granularity: string, offset: number): string;
38
41
  castValue(expression: string, type: string): string;
39
42
  scalarExtremum(operator: 'least' | 'greatest', expressions: readonly string[]): string;
@@ -41,6 +44,7 @@ export declare class ClickHouseProvider implements CoreComputeProvider {
41
44
  stringify(expression: string): string;
42
45
  concat(expressions: readonly string[]): string;
43
46
  substring(expression: string, start: number, length: number): string;
47
+ stringLength(expression: string): string;
44
48
  regex(expression: string, pattern: string, options?: string): string;
45
49
  arrayContains(arrayExpression: string, valueExpression: string): string;
46
50
  expandArray(arrayExpression: string, alias: string, column: string): {
@@ -1,32 +1,74 @@
1
1
  import type { CoreComputeProvider } from './provider';
2
2
  import type { ClickHouseProviderOptions } from './clickhouse-provider';
3
- import type { DorisProviderOptions } from './doris-provider';
4
- import type { MySQLProviderOptions } from './mysql-provider';
5
- import type { OracleProviderOptions } from './oracle-provider';
6
- import type { PostgreSQLProviderOptions } from './postgresql-provider';
7
- import type { SnowflakeProviderOptions } from './snowflake-provider';
8
- import type { StarRocksProviderOptions } from './starrocks-provider';
9
- /** Connection information supplied by an application. Provider instances stay internal. */
10
- export type DatabaseConnection = ({
3
+ import type { DatabricksConnectionOptions } from './databricks-provider';
4
+ import type { DamengConnectionOptions } from './dameng-provider';
5
+ import type { DorisConnectionOptions } from './doris-provider';
6
+ import type { GBaseConnectionOptions } from './gbase-provider';
7
+ import type { MaxComputeConnectionOptions } from './maxcompute-provider';
8
+ import type { MySQLConnectionOptions } from './mysql-provider';
9
+ import type { OracleConnectionOptions } from './oracle-provider';
10
+ import type { PostgreSQLConnectionOptions } from './postgresql-provider';
11
+ import type { SnowflakeConnectionOptions } from './snowflake-provider';
12
+ import type { SQLServerConnectionOptions } from './sqlserver-provider';
13
+ import type { StarRocksConnectionOptions } from './starrocks-provider';
14
+ export interface DatabaseConnectionBase {
15
+ readonly id: string;
16
+ readonly kind: string;
17
+ }
18
+ /** Module-augmentation seam for application-owned connection kinds. */
19
+ export interface DatabaseConnectionExtensions {
20
+ }
21
+ export type BuiltinDatabaseConnection = ({
11
22
  readonly id: string;
12
23
  readonly kind: 'mysql';
13
- } & NonNullable<MySQLProviderOptions['connection']>) | ({
24
+ } & MySQLConnectionOptions) | ({
14
25
  readonly id: string;
15
26
  readonly kind: 'doris';
16
- } & NonNullable<DorisProviderOptions['connection']>) | ({
27
+ } & DorisConnectionOptions) | ({
28
+ readonly id: string;
29
+ readonly kind: 'gbase';
30
+ } & GBaseConnectionOptions) | ({
17
31
  readonly id: string;
18
32
  readonly kind: 'starrocks';
19
- } & NonNullable<StarRocksProviderOptions['connection']>) | ({
33
+ } & StarRocksConnectionOptions) | ({
34
+ readonly id: string;
35
+ readonly kind: 'maxcompute';
36
+ } & MaxComputeConnectionOptions) | ({
20
37
  readonly id: string;
21
38
  readonly kind: 'postgresql';
22
- } & NonNullable<PostgreSQLProviderOptions['connection']>) | ({
39
+ } & PostgreSQLConnectionOptions) | ({
23
40
  readonly id: string;
24
41
  readonly kind: 'clickhouse';
25
42
  } & Omit<ClickHouseProviderOptions, 'client'>) | ({
43
+ readonly id: string;
44
+ readonly kind: 'databricks';
45
+ } & DatabricksConnectionOptions) | ({
46
+ readonly id: string;
47
+ readonly kind: 'dameng';
48
+ } & DamengConnectionOptions) | ({
26
49
  readonly id: string;
27
50
  readonly kind: 'snowflake';
28
- } & NonNullable<SnowflakeProviderOptions['connection']>) | ({
51
+ } & SnowflakeConnectionOptions) | ({
52
+ readonly id: string;
53
+ readonly kind: 'sqlserver';
54
+ } & SQLServerConnectionOptions) | ({
29
55
  readonly id: string;
30
56
  readonly kind: 'oracle';
31
- } & NonNullable<OracleProviderOptions['connection']>);
32
- export declare const createProvider: (connection: DatabaseConnection) => CoreComputeProvider;
57
+ } & OracleConnectionOptions);
58
+ type ExtendedDatabaseConnection = DatabaseConnectionExtensions[keyof DatabaseConnectionExtensions];
59
+ export type DatabaseConnection = BuiltinDatabaseConnection | ExtendedDatabaseConnection;
60
+ export interface ProviderDefinition<Connection extends DatabaseConnectionBase = DatabaseConnectionBase> {
61
+ readonly kind: Connection['kind'];
62
+ readonly create: (connection: Connection) => CoreComputeProvider;
63
+ }
64
+ export declare const builtinProviderDefinitions: readonly ProviderDefinition[];
65
+ export declare class ProviderRegistry {
66
+ #private;
67
+ constructor(definitions?: readonly ProviderDefinition[]);
68
+ register<Connection extends DatabaseConnectionBase>(definition: ProviderDefinition<Connection>): this;
69
+ create(connection: DatabaseConnectionBase): CoreComputeProvider;
70
+ has(kind: string): boolean;
71
+ }
72
+ export declare const defaultProviderRegistry: ProviderRegistry;
73
+ export declare const createProvider: (connection: DatabaseConnection, providers?: ProviderRegistry) => CoreComputeProvider;
74
+ export {};
@@ -0,0 +1,61 @@
1
+ import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest } from './provider';
2
+ type DamengBind = string | number | Date | Buffer | null;
3
+ export interface DamengConnectionOptions {
4
+ readonly connectString?: string;
5
+ readonly host?: string;
6
+ readonly port?: number;
7
+ readonly user?: string;
8
+ readonly password?: string;
9
+ readonly schema?: string;
10
+ readonly poolMin?: number;
11
+ readonly poolMax?: number;
12
+ readonly poolTimeout?: number;
13
+ readonly [option: string]: unknown;
14
+ }
15
+ export interface DamengConnectionLike {
16
+ execute(sql: string, binds: DamengBind[], options: {
17
+ readonly outFormat: number;
18
+ }): Promise<{
19
+ readonly rows?: unknown[];
20
+ }>;
21
+ close(): Promise<void>;
22
+ }
23
+ export interface DamengPoolLike {
24
+ getConnection(): Promise<DamengConnectionLike>;
25
+ close(drainTime?: number): Promise<void>;
26
+ }
27
+ export interface DamengDriverLike {
28
+ createPool(options: DamengPoolOptions): Promise<DamengPoolLike>;
29
+ }
30
+ export interface DamengPoolOptions extends Omit<DamengConnectionOptions, 'host' | 'port'> {
31
+ readonly connectString: string;
32
+ }
33
+ export interface DamengProviderOptions {
34
+ readonly connection?: DamengConnectionOptions;
35
+ readonly pool?: DamengPoolLike;
36
+ readonly driver?: DamengDriverLike;
37
+ }
38
+ export declare const damengPoolOptions: (options: DamengConnectionOptions) => DamengPoolOptions;
39
+ export declare class DamengProvider implements CoreComputeProvider {
40
+ #private;
41
+ readonly kind: "dameng";
42
+ readonly supportsHavingAlias = false;
43
+ constructor(options?: DamengProviderOptions);
44
+ quoteIdentifier(identifier: string): string;
45
+ tableAlias(expression: string, alias: string): string;
46
+ paginate(sql: string, pageSize: number, offset: number): string;
47
+ parameter(index: number, value: unknown): string;
48
+ displayQuery(sql: string, parameters: readonly unknown[]): string;
49
+ dateBucket(expression: string, level: string): string;
50
+ datePart(expression: string, part: DatePart): string;
51
+ dateShift(expression: string, granularity: string, offset: number): 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
+ execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
59
+ close(): Promise<void>;
60
+ }
61
+ export {};
@@ -0,0 +1,83 @@
1
+ import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest } from './provider';
2
+ type DatabricksBind = string | number | boolean | bigint | Date | null;
3
+ export interface DatabricksConnectionBase {
4
+ readonly host: string;
5
+ readonly path: string;
6
+ readonly catalog?: string;
7
+ readonly schema?: string;
8
+ /** Legacy datasource field for the default schema. */
9
+ readonly database?: string;
10
+ }
11
+ export interface DatabricksAccessTokenAuth {
12
+ readonly authType: 'access-token';
13
+ readonly token: string;
14
+ readonly oauthClientId?: never;
15
+ readonly oauthClientSecret?: never;
16
+ readonly azureTenantId?: never;
17
+ readonly useDatabricksOAuthInAzure?: never;
18
+ readonly oauthScopes?: never;
19
+ }
20
+ export interface DatabricksOAuthAuth {
21
+ readonly authType: 'databricks-oauth';
22
+ readonly oauthClientId: string;
23
+ readonly oauthClientSecret: string;
24
+ readonly token?: never;
25
+ readonly azureTenantId?: string;
26
+ readonly useDatabricksOAuthInAzure?: boolean;
27
+ readonly oauthScopes?: readonly string[];
28
+ }
29
+ export type DatabricksConnectionOptions = DatabricksConnectionBase & (DatabricksAccessTokenAuth | DatabricksOAuthAuth);
30
+ export interface DatabricksOperationLike {
31
+ fetchAll(): Promise<unknown>;
32
+ cancel(): Promise<unknown>;
33
+ close(): Promise<unknown>;
34
+ }
35
+ export interface DatabricksSessionLike {
36
+ executeStatement(sql: string, options: {
37
+ readonly ordinalParameters: DatabricksBind[];
38
+ }): Promise<DatabricksOperationLike>;
39
+ close(): Promise<unknown>;
40
+ }
41
+ export interface DatabricksClientLike {
42
+ connect(options: object): Promise<unknown>;
43
+ openSession(options: {
44
+ readonly initialCatalog?: string;
45
+ readonly initialSchema?: string;
46
+ }): Promise<DatabricksSessionLike>;
47
+ close(): Promise<void>;
48
+ }
49
+ export interface DatabricksProviderOptions {
50
+ readonly connection?: DatabricksConnectionOptions;
51
+ readonly client?: DatabricksClientLike;
52
+ }
53
+ export declare const databricksConnectOptions: (input: unknown) => object;
54
+ export declare class DatabricksProvider implements CoreComputeProvider {
55
+ #private;
56
+ readonly kind: "databricks";
57
+ readonly supportsHavingAlias = false;
58
+ readonly supportsRecursiveCte = true;
59
+ constructor(options?: DatabricksProviderOptions);
60
+ quoteIdentifier(identifier: string): string;
61
+ tableAlias(expression: string, alias: string): string;
62
+ paginate(sql: string, pageSize: number, offset: number): string;
63
+ parameter(index: number, value: unknown): string;
64
+ displayQuery(sql: string, parameters: readonly unknown[]): string;
65
+ dateBucket(expression: string, level: string): string;
66
+ datePart(expression: string, part: DatePart): string;
67
+ dateShift(expression: string, granularity: string, offset: number): string;
68
+ castValue(expression: string, type: string): string;
69
+ aggregateFunction(name: string, expression?: string): string;
70
+ stringify(expression: string): string;
71
+ concat(expressions: readonly string[]): string;
72
+ substring(expression: string, start: number, length: number): string;
73
+ stringLength(expression: string): string;
74
+ regex(expression: string, pattern: string, options?: string): string;
75
+ arrayContains(arrayExpression: string, valueExpression: string): string;
76
+ expandArray(arrayExpression: string, alias: string, column: string): {
77
+ joinSql: string;
78
+ valueExpression: string;
79
+ };
80
+ execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
81
+ close(): Promise<void>;
82
+ }
83
+ export {};
@@ -1,4 +1,7 @@
1
1
  export declare const displayClickHouseQuery: (sql: string, parameters: readonly unknown[]) => string;
2
2
  export declare const displayOracleQuery: (sql: string, parameters: readonly unknown[]) => string;
3
3
  export declare const displayPostgreSQLQuery: (sql: string, parameters: readonly unknown[]) => string;
4
+ export declare const displayMySQLQuery: (sql: string, parameters: readonly unknown[]) => string;
4
5
  export declare const displayQuestionMarkQuery: (sql: string, parameters: readonly unknown[]) => string;
6
+ export declare const displayDamengQuery: (sql: string, parameters: readonly unknown[]) => string;
7
+ export declare const displaySQLServerQuery: (sql: string, parameters: readonly unknown[]) => string;
@@ -1,6 +1,7 @@
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 DorisPoolLike = MySQLProtocolPoolLike;
4
+ export type DorisConnectionOptions = MySQLProtocolConnectionOptions;
4
5
  export type DorisProviderOptions = MySQLProtocolProviderOptions;
5
6
  /** Doris adapter using its MySQL-compatible protocol and SQL surface. */
6
7
  export declare class DorisProvider extends MySQLProtocolProvider {
@@ -0,0 +1,37 @@
1
+ import type { CoreComputeProvider, DataRow, DatePart, ProviderExecutionRequest } from './provider';
2
+ export type DuckDBCoordinatorColumnKind = 'boolean' | 'date' | 'number' | 'string';
3
+ export interface DuckDBCoordinatorColumn {
4
+ readonly name: string;
5
+ readonly kind: DuckDBCoordinatorColumnKind;
6
+ }
7
+ /** In-process SQL engine used only to combine results from separate physical connections. */
8
+ export declare class DuckDBCoordinatorProvider implements CoreComputeProvider {
9
+ private readonly instance;
10
+ private readonly connection;
11
+ readonly kind: "duckdb";
12
+ readonly supportsHavingAlias = true;
13
+ readonly supportsRecursiveCte = true;
14
+ static create(): Promise<DuckDBCoordinatorProvider>;
15
+ private constructor();
16
+ quoteIdentifier(identifier: string): string;
17
+ tableAlias(expression: string, alias: string): string;
18
+ paginate(sql: string, pageSize: number, offset: number): string;
19
+ parameter(index: number, value: unknown): string;
20
+ displayQuery(sql: string, parameters: readonly unknown[]): string;
21
+ dateBucket(expression: string, level: string): string;
22
+ datePart(expression: string, part: DatePart): string;
23
+ dateShift(expression: string, granularity: string, offset: number): string;
24
+ datePeriodBoundary(expression: string, granularity: string, boundary: 'start' | 'end'): string;
25
+ castValue(expression: string, type: string): string;
26
+ scalarExtremum(operator: 'least' | 'greatest', expressions: readonly string[]): string;
27
+ aggregateFunction(name: string, expression?: string): string;
28
+ stringify(expression: string): string;
29
+ concat(expressions: readonly string[]): string;
30
+ substring(expression: string, start: number, length: number): string;
31
+ stringLength(expression: string): string;
32
+ regex(expression: string, pattern: string, options?: string): string;
33
+ arrayContains(arrayExpression: string, valueExpression: string): string;
34
+ materialize(tableName: string, inputColumns: readonly DuckDBCoordinatorColumn[], rows: readonly DataRow[]): Promise<void>;
35
+ execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
36
+ close(): Promise<void>;
37
+ }
@@ -0,0 +1,11 @@
1
+ import { MySQLProtocolProvider } from './mysql-protocol-provider';
2
+ import type { MySQLProtocolConnectionOptions, MySQLProtocolPoolLike, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
3
+ export type GBasePoolLike = MySQLProtocolPoolLike;
4
+ export type GBaseConnectionOptions = MySQLProtocolConnectionOptions;
5
+ export type GBaseProviderOptions = MySQLProtocolProviderOptions;
6
+ /** GBase 8a adapter using its MySQL-compatible protocol and SQL surface. */
7
+ export declare class GBaseProvider extends MySQLProtocolProvider {
8
+ readonly kind: "gbase";
9
+ readonly supportsRecursiveCte = false;
10
+ constructor(options?: GBaseProviderOptions);
11
+ }
@@ -1,18 +1,30 @@
1
1
  /** Internal physical adapters selected from the public database connection configuration. */
2
- export type { CoreComputeProvider, DataRow, ProviderExecutionRequest, SqlRenderCapabilities, SqlParameters, } from './provider';
3
- export { createProvider } from './connection';
4
- export type { DatabaseConnection } from './connection';
2
+ export type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, ProviderKind, ProviderKindExtensions, SqlRenderCapabilities, SqlParameters, } from './provider';
3
+ export { builtinProviderDefinitions, createProvider, defaultProviderRegistry, ProviderRegistry, } from './connection';
4
+ export type { BuiltinDatabaseConnection, DatabaseConnection, DatabaseConnectionBase, DatabaseConnectionExtensions, ProviderDefinition, } from './connection';
5
+ export { DuckDBCoordinatorProvider } from './duckdb-coordinator-provider';
6
+ export type { DuckDBCoordinatorColumn, DuckDBCoordinatorColumnKind, } from './duckdb-coordinator-provider';
5
7
  export { ClickHouseProvider, } from './clickhouse-provider';
6
8
  export type { ClickHouseClientLike, ClickHouseProviderOptions, } from './clickhouse-provider';
9
+ export { DatabricksProvider } from './databricks-provider';
10
+ export type { DatabricksClientLike, DatabricksConnectionBase, DatabricksConnectionOptions, DatabricksAccessTokenAuth, DatabricksOAuthAuth, DatabricksProviderOptions, DatabricksSessionLike, DatabricksOperationLike, } from './databricks-provider';
11
+ export { DamengProvider } from './dameng-provider';
12
+ export type { DamengConnectionLike, DamengConnectionOptions, DamengDriverLike, DamengPoolLike, DamengPoolOptions, DamengProviderOptions, } from './dameng-provider';
7
13
  export { DorisProvider } from './doris-provider';
8
- export type { DorisPoolLike, DorisProviderOptions } from './doris-provider';
14
+ export type { DorisConnectionOptions, DorisPoolLike, DorisProviderOptions } from './doris-provider';
15
+ export { GBaseProvider } from './gbase-provider';
16
+ export type { GBaseConnectionOptions, GBasePoolLike, GBaseProviderOptions } from './gbase-provider';
17
+ export { MaxComputeProvider } from './maxcompute-provider';
18
+ export type { MaxComputeClientLike, MaxComputeConnectionOptions, MaxComputeProviderOptions, } from './maxcompute-provider';
9
19
  export { MySQLProvider } from './mysql-provider';
10
- export type { MySQLPoolLike, MySQLProviderOptions } from './mysql-provider';
20
+ export type { MySQLConnectionOptions, MySQLPoolLike, MySQLProviderOptions } from './mysql-provider';
11
21
  export { OracleProvider } from './oracle-provider';
12
- export type { OracleConnectionLike, OracleDriverLike, OraclePoolLike, OracleProviderOptions, } from './oracle-provider';
22
+ export type { OracleConnectionLike, OracleConnectionOptions, OracleDriverLike, OraclePoolLike, OracleProviderOptions, } from './oracle-provider';
13
23
  export { PostgreSQLProvider } from './postgresql-provider';
14
- export type { PostgreSQLPoolLike, PostgreSQLProviderOptions, } from './postgresql-provider';
24
+ export type { PostgreSQLPoolLike, PostgreSQLConnectionOptions, PostgreSQLProviderOptions, } from './postgresql-provider';
15
25
  export { SnowflakeProvider } from './snowflake-provider';
16
- export type { SnowflakeConnectionLike, SnowflakeProviderOptions, SnowflakeStatementLike, } from './snowflake-provider';
26
+ export type { SnowflakeConnectionLike, SnowflakeConnectionOptions, SnowflakeProviderOptions, SnowflakeStatementLike, } from './snowflake-provider';
27
+ export { SQLServerProvider, sqlServerPoolOptions } from './sqlserver-provider';
28
+ export type { SQLServerConnectionOptions, SQLServerDriverLike, SQLServerPoolLike, SQLServerProviderOptions, SQLServerRequestLike, } from './sqlserver-provider';
17
29
  export { StarRocksProvider } from './starrocks-provider';
18
- export type { StarRocksPoolLike, StarRocksProviderOptions, } from './starrocks-provider';
30
+ export type { StarRocksPoolLike, StarRocksConnectionOptions, StarRocksProviderOptions, } from './starrocks-provider';
@@ -0,0 +1 @@
1
+ export declare const driverLoadError: (packageName: string, cause: unknown) => Error;
@@ -0,0 +1,37 @@
1
+ import type { CoreComputeProvider, DataRow, DatePart, ProviderExecutionRequest, SqlParameters } from './provider';
2
+ /**
3
+ * Parameterized MaxCompute execution boundary supplied by the application.
4
+ * Implementations must bind `parameters`; they must not interpolate them into `sql`.
5
+ */
6
+ export interface MaxComputeClientLike {
7
+ execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
8
+ close(): Promise<void>;
9
+ }
10
+ export interface MaxComputeConnectionOptions {
11
+ readonly client: MaxComputeClientLike;
12
+ }
13
+ export type MaxComputeProviderOptions = MaxComputeConnectionOptions;
14
+ /** MaxCompute SQL dialect backed by a caller-owned parameterized execution client. */
15
+ export declare class MaxComputeProvider implements CoreComputeProvider {
16
+ #private;
17
+ readonly kind: "maxcompute";
18
+ readonly supportsRecursiveCte = false;
19
+ constructor(options: MaxComputeProviderOptions);
20
+ quoteIdentifier(identifier: string): string;
21
+ tableAlias(expression: string, alias: string): string;
22
+ paginate(sql: string, pageSize: number, offset: number): string;
23
+ parameter(index: number, value: unknown): string;
24
+ displayQuery(sql: string, parameters: SqlParameters): string;
25
+ dateBucket(expression: string, level: string): string;
26
+ datePart(expression: string, part: DatePart): string;
27
+ dateShift(expression: string, granularity: string, offset: number): string;
28
+ datePeriodBoundary(expression: string, granularity: string, boundary: 'start' | 'end'): string;
29
+ aggregateFunction(name: string, expression?: string): string;
30
+ stringify(expression: string): string;
31
+ concat(expressions: readonly string[]): string;
32
+ substring(expression: string, start: number, length: number): string;
33
+ stringLength(expression: string): string;
34
+ regex(expression: string, pattern: string, options?: string): string;
35
+ execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
36
+ close(): Promise<void>;
37
+ }
@@ -1,17 +1,30 @@
1
- import type { PoolOptions } from 'mysql2/promise';
2
- import type { CoreComputeProvider, DataRow, ProviderExecutionRequest, SqlParameters } from './provider';
1
+ import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SqlParameters } from './provider';
3
2
  export interface MySQLProtocolPoolLike {
4
3
  execute(sql: string, values: readonly unknown[]): Promise<readonly [unknown, unknown]>;
5
4
  end(): Promise<void>;
6
5
  }
6
+ export interface MySQLProtocolConnectionOptions {
7
+ readonly host?: string;
8
+ readonly port?: number;
9
+ readonly user?: string;
10
+ readonly password?: string;
11
+ readonly database?: string;
12
+ readonly connectionLimit?: number;
13
+ readonly maxIdle?: number;
14
+ readonly idleTimeout?: number;
15
+ readonly enableKeepAlive?: boolean;
16
+ readonly keepAliveInitialDelay?: number;
17
+ readonly decimalNumbers?: boolean;
18
+ readonly [option: string]: unknown;
19
+ }
7
20
  export interface MySQLProtocolProviderOptions {
8
- readonly connection?: PoolOptions;
21
+ readonly connection?: object;
9
22
  readonly pool?: MySQLProtocolPoolLike;
10
23
  }
11
24
  export declare abstract class MySQLProtocolProvider implements CoreComputeProvider {
12
- readonly supportsRecursiveCte = true;
13
- abstract readonly kind: 'doris' | 'mysql' | 'starrocks';
14
- private readonly pool;
25
+ #private;
26
+ readonly supportsRecursiveCte: boolean;
27
+ abstract readonly kind: 'doris' | 'gbase' | 'maxcompute' | 'mysql' | 'starrocks';
15
28
  protected constructor(options?: MySQLProtocolProviderOptions);
16
29
  quoteIdentifier(identifier: string): string;
17
30
  tableAlias(expression: string, alias: string): string;
@@ -19,12 +32,14 @@ export declare abstract class MySQLProtocolProvider implements CoreComputeProvid
19
32
  parameter(index: number, value: unknown): string;
20
33
  displayQuery(sql: string, parameters: SqlParameters): string;
21
34
  dateBucket(expression: string, level: string): string;
35
+ datePart(expression: string, part: DatePart): string;
22
36
  dateShift(expression: string, granularity: string, offset: number): string;
23
37
  datePeriodBoundary(expression: string, granularity: string, boundary: 'start' | 'end'): string;
24
38
  aggregateFunction(name: string, expression?: string): string;
25
39
  stringify(expression: string): string;
26
40
  concat(expressions: readonly string[]): string;
27
41
  substring(expression: string, start: number, length: number): string;
42
+ stringLength(expression: string): string;
28
43
  regex(expression: string, pattern: string, options?: string): string;
29
44
  arrayContains(arrayExpression: string, valueExpression: string): string;
30
45
  expandArray(arrayExpression: string, alias: string, column: string): {
@@ -1,6 +1,7 @@
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 MySQLPoolLike = MySQLProtocolPoolLike;
4
+ export type MySQLConnectionOptions = MySQLProtocolConnectionOptions;
4
5
  export type MySQLProviderOptions = MySQLProtocolProviderOptions;
5
6
  export declare class MySQLProvider extends MySQLProtocolProvider {
6
7
  readonly kind: "mysql";