@effectuate/cubejs-mongosql-driver 1.0.0
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/LICENSE +23 -0
- package/README.md +579 -0
- package/dist/MongoSqlDriver.d.ts +238 -0
- package/dist/MongoSqlDriver.d.ts.map +1 -0
- package/dist/MongoSqlDriver.js +745 -0
- package/dist/MongoSqlDriver.js.map +1 -0
- package/dist/MongoSqlQuery.d.ts +353 -0
- package/dist/MongoSqlQuery.d.ts.map +1 -0
- package/dist/MongoSqlQuery.js +551 -0
- package/dist/MongoSqlQuery.js.map +1 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +298 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/native.d.ts +104 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +192 -0
- package/dist/native.js.map +1 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +24 -0
- package/dist/types.js.map +1 -0
- package/index.d.ts +160 -0
- package/index.js +316 -0
- package/package.json +108 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoSqlDriver.js","sourceRoot":"","sources":["../src/MongoSqlDriver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;;;AAEH,6DAAyD;AAgBzD,2CAAiF;AACjF,yDAAmD;AACnD,2CAA+C;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAa,cAAe,SAAQ,wBAAU;IAC3B,cAAc,CAAiB;IAExC,MAAM,CAA6B;IAE3C,YAAY,MAAgC;QAC1C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,c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;AACb,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,IAAI,KAAK,CACd,oBAAoB,MAAM,+EAA+E,CAC1G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MongoSqlQuery — Cube SQL dialect for MongoSQL.
|
|
3
|
+
*
|
|
4
|
+
* See SPEC.md FR-2 and ARCHITECTURE.md §4.1. Reference:
|
|
5
|
+
* https://www.mongodb.com/docs/sql-interface/language-reference/
|
|
6
|
+
*
|
|
7
|
+
* T12a scope: STATIC SYNTAX — identifier quoting, type names, timestamp
|
|
8
|
+
* casts, timezone passthrough, NULL/param tokens.
|
|
9
|
+
* T12b scope: DATE ARITHMETIC, INTERVALS, time-series generation,
|
|
10
|
+
* date-truncation, dateBin, unixTimestampSql.
|
|
11
|
+
*
|
|
12
|
+
* MongoSQL date-function audit (verified against mongosql v1.8.5 source —
|
|
13
|
+
* `mongosql/src/ast/definitions.rs` `FunctionName::try_from` and
|
|
14
|
+
* `algebrize_date_function`, plus `ast/rewrites/test.rs`):
|
|
15
|
+
*
|
|
16
|
+
* | Function | Signature | Notes |
|
|
17
|
+
* |----------------|--------------------------------------------------------|--------------------------------------------------------------------|
|
|
18
|
+
* | DATEADD | DATEADD(<date_part>, <numeric>, <date>) | TIMESTAMPADD is an alias. |
|
|
19
|
+
* | DATEDIFF | DATEDIFF(<date_part>, <start>, <end>[, <start_of_week>]) | Returns LONG. TIMESTAMPDIFF is an alias. |
|
|
20
|
+
* | DATETRUNC | DATETRUNC(<date_part>, <date>[, <start_of_week>]) | TIMESTAMPTRUNC is an alias. |
|
|
21
|
+
* | EXTRACT | EXTRACT(<date_part> FROM <date>) | Supports YEAR/MONTH/WEEK/DAY/HOUR/MINUTE/SECOND/MILLISECOND/... |
|
|
22
|
+
* | YEAR/MONTH/... | YEAR(d), MONTH(d), ... — rewritten to EXTRACT | All datepart helpers map to EXTRACT. |
|
|
23
|
+
* | CURRENT_TIMESTAMP | CURRENT_TIMESTAMP[(<precision>)] | SQL-92 keyword. Replaces NOW(). |
|
|
24
|
+
*
|
|
25
|
+
* <date_part> for DATEADD / DATEDIFF / DATETRUNC must be one of:
|
|
26
|
+
* YEAR | QUARTER | MONTH | WEEK | DAY | HOUR | MINUTE | SECOND | MILLISECOND
|
|
27
|
+
* (mongosql `DatePart` enum; `IsoWeek`/`DayOfYear` are EXTRACT-only and
|
|
28
|
+
* panic for date-functions per `algebrize_date_function`.)
|
|
29
|
+
*
|
|
30
|
+
* NOT available in MongoSQL (called out so future maintainers don't try):
|
|
31
|
+
* - `INTERVAL '1 day'` literals — REJECTED by parser.
|
|
32
|
+
* - `EXTRACT(EPOCH FROM ...)` — EPOCH is not a `DatePart`.
|
|
33
|
+
* - `AT TIME ZONE` / `CONVERT_TZ` — no SQL-level timezone function.
|
|
34
|
+
* - `VALUES (...)` table constructors — no parser support.
|
|
35
|
+
* - `WITH RECURSIVE` / `generate_series` — no recursive CTEs.
|
|
36
|
+
* For each gap, see the override below for the closest viable substitute.
|
|
37
|
+
*
|
|
38
|
+
* BaseQuery method-list audit (against
|
|
39
|
+
* `node_modules/@cubejs-backend/schema-compiler/dist/src/adapter/BaseQuery.js`,
|
|
40
|
+
* cross-checked against `MysqlQuery.js` and `PostgresQuery.js`):
|
|
41
|
+
*
|
|
42
|
+
* | BaseQuery method | T12a/b action | Why |
|
|
43
|
+
* |-------------------------------------------|-------------------|---------------------------------------------------------------------|
|
|
44
|
+
* | escapeColumnName(name) | OVERRIDE (T12a) | Default emits double-quoted ident; MongoSQL uses backticks. |
|
|
45
|
+
* | quoteIdentifier(name) | ADD (alias) (T12a)| Not on BaseQuery, but task spec + driver doc-comment expect it. |
|
|
46
|
+
* | autoPrefixWithCubeName(c, sql, isExpr) | OVERRIDE (T19a) | mongosql v1.8.5 rejects `<alias>.<col>` outside JOIN scope (3008). |
|
|
47
|
+
* | timeStampCast(value) | OVERRIDE (T12a) | Base emits `value::timestamptz` (Postgres). Mongosql has no `::`. |
|
|
48
|
+
* | dateTimeCast(value) | OVERRIDE (T12a) | Base emits `value::timestamp` (Postgres) — invalid in MongoSQL. |
|
|
49
|
+
* | timeStampParam(td) | INHERIT | Default delegates to timeStampCast — fine once we override that. |
|
|
50
|
+
* | timestampFormat() | INHERIT | ISO-8601 default matches mongosql's accepted CAST literal form. |
|
|
51
|
+
* | castToString(sql) | OVERRIDE (T12a) | Base emits `CAST(.. as TEXT)`; MongoSQL spells it `STRING`. |
|
|
52
|
+
* | convertTz(field) | OVERRIDE (T12a) | MongoSQL has no AT TIME ZONE / CONVERT_TZ. UTC-only passthrough. |
|
|
53
|
+
* | inDbTimeZone(date) | INHERIT | Pure JS — converts JS-side; no SQL emitted. |
|
|
54
|
+
* | nowTimestampSql() | OVERRIDE (T12a) | Base emits `NOW()`; MongoSQL spells it `CURRENT_TIMESTAMP`. |
|
|
55
|
+
* | unixTimestampSql() | OVERRIDE (T12b) | Base uses EXTRACT(EPOCH ...) — not in MongoSQL. Use DATEDIFF. |
|
|
56
|
+
* | concatStringsSql(strings) | INHERIT | Default uses `||` template; MongoSQL accepts `||` for concat. |
|
|
57
|
+
* | sqlTemplates() | OVERRIDE (T12a) | Patch quotes/identifiers + types.* to MongoSQL spellings. |
|
|
58
|
+
* | timeGroupedColumn(g, dim) | OVERRIDE (T12b) | Use DATETRUNC. Week pinned to 'sunday' for determinism. |
|
|
59
|
+
* | dateBin(interval, source, origin) | OVERRIDE (T12b) | DATEADD(unit, FLOOR(DATEDIFF/N)*N, origin) — no INTERVAL literals. |
|
|
60
|
+
* | subtractInterval / addInterval | OVERRIDE (T12b) | DATEADD with positive/negative numeric. Compound = chained calls. |
|
|
61
|
+
* | intervalString(interval) | OVERRIDE (T12b) | Quote-and-pass; no INTERVAL keyword. Used only in error/diag paths. |
|
|
62
|
+
* | seriesSql(td) | OVERRIDE (T12b) | UNION ALL of literal rows (MysqlQuery pattern, CAST not TIMESTAMP). |
|
|
63
|
+
* | newFilter(f) | OVERRIDE (Gap 4) | Return MongoSqlFilter — rewrites ILIKE (unsupported) to LOWER+LIKE. |
|
|
64
|
+
* | newParamAllocator(p) | INHERIT | Default `?` placeholder works for MongoSQL. |
|
|
65
|
+
* | escapeColumnName-driven preAggTableName | INHERIT | Inherited tableName logic produces backtick-safe identifiers. |
|
|
66
|
+
*
|
|
67
|
+
* Anything not in this table is BaseQuery default behaviour and is either
|
|
68
|
+
* (a) provably valid MongoSQL or (b) routed through the overrides above.
|
|
69
|
+
*/
|
|
70
|
+
import { BaseFilter, BaseQuery } from '@cubejs-backend/schema-compiler';
|
|
71
|
+
/** A single component of a parsed Cube interval, mapped to MongoSQL units. */
|
|
72
|
+
export interface IntervalComponent {
|
|
73
|
+
value: number;
|
|
74
|
+
unit: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* BaseTimeDimension shape we depend on inside `seriesSql`. Cube's TS
|
|
78
|
+
* declaration types `timeSeries()` as `string[][]` (loose), so we accept
|
|
79
|
+
* the same and cast the inner row to a 2-tuple for safer destructuring.
|
|
80
|
+
*/
|
|
81
|
+
interface SeriesTimeDimension {
|
|
82
|
+
timeSeries(): string[][];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Cube SQL-dialect adapter that emits MongoSQL-compatible SQL.
|
|
86
|
+
*
|
|
87
|
+
* Instantiated by `MongoSqlDriver.dialectClass()`. Cube calls into this for
|
|
88
|
+
* every measure/dimension/timeDimension SQL fragment.
|
|
89
|
+
*/
|
|
90
|
+
export declare class MongoSqlQuery extends BaseQuery {
|
|
91
|
+
/**
|
|
92
|
+
* Identifier quoting — MongoSQL uses backticks.
|
|
93
|
+
* Reference: https://www.mongodb.com/docs/sql-interface/language-reference/identifiers/
|
|
94
|
+
*
|
|
95
|
+
* BaseQuery's actual identifier-quoting hook is `escapeColumnName`; we
|
|
96
|
+
* also expose `quoteIdentifier` as an alias because it's the conventional
|
|
97
|
+
* name and the driver's audit comment refers to it.
|
|
98
|
+
*/
|
|
99
|
+
escapeColumnName(name: string): string;
|
|
100
|
+
quoteIdentifier(identifier: string): string;
|
|
101
|
+
/**
|
|
102
|
+
* Suppress the cube-alias prefix on bare column references when the query
|
|
103
|
+
* has only one cube in scope.
|
|
104
|
+
*
|
|
105
|
+
* Background (T19 discovery): mongosql v1.8.5's algebrizer rejects qualified
|
|
106
|
+
* `<table_alias>.<col>` references in projections when only one collection
|
|
107
|
+
* is in scope — Error 3008 "Field `orders` in the `SELECT` clause at the 0
|
|
108
|
+
* scope level not found". Cube's BaseQuery emits `${cubeAlias}.${sql}` for
|
|
109
|
+
* every dimension that is a bare identifier (see BaseQuery.js:2508
|
|
110
|
+
* `autoPrefixWithCubeName`), which makes every realistic Cube query against
|
|
111
|
+
* a single cube fail translation.
|
|
112
|
+
*
|
|
113
|
+
* Strategy:
|
|
114
|
+
* - Single-cube query (`this.join.joins.length === 0`): drop the prefix
|
|
115
|
+
* — emit a bare column reference (`SELECT email FROM users`).
|
|
116
|
+
* - Multi-cube / JOIN: keep the prefix (`SELECT users.email`) — mongosql
|
|
117
|
+
* accepts qualified refs in JOIN scope (verified end-to-end in
|
|
118
|
+
* tests/integration/basic-queries.test.ts).
|
|
119
|
+
* - `this.join` may be `null` during pre-build / collect-cube-names paths
|
|
120
|
+
* before `prebuildJoin` runs; treat that as "not enough info, keep
|
|
121
|
+
* BaseQuery's behaviour" so we don't drop a prefix Cube actually needed.
|
|
122
|
+
* - `isMemberExpr` (member-expression SQL) bypasses the prefix entirely
|
|
123
|
+
* in BaseQuery; keep that semantics for forward compat.
|
|
124
|
+
*
|
|
125
|
+
* The conditional fall-through to `super` keeps every other code path
|
|
126
|
+
* (non-bare expressions like `LOWER(email)` already escape the regex match
|
|
127
|
+
* and are returned verbatim by the base implementation) unchanged.
|
|
128
|
+
*/
|
|
129
|
+
autoPrefixWithCubeName(cubeName: string, sql: string, isMemberExpr?: boolean): string;
|
|
130
|
+
/**
|
|
131
|
+
* GROUP BY by column alias instead of positional `1, 2, ...`.
|
|
132
|
+
* mongosql v1.8.5's algebrizer rejects positional refs in GROUP BY
|
|
133
|
+
* (and the failure mode misreports as Error 3008 "Field <col> in the
|
|
134
|
+
* SELECT clause not found"). Mirrors the ClickHouseQuery pattern.
|
|
135
|
+
*/
|
|
136
|
+
groupByClause(): string;
|
|
137
|
+
/**
|
|
138
|
+
* ORDER BY by column alias instead of positional `1, 2, ...`.
|
|
139
|
+
* Same constraint as `groupByClause` — mongosql requires named refs.
|
|
140
|
+
*/
|
|
141
|
+
orderHashToString(hash: {
|
|
142
|
+
id: string;
|
|
143
|
+
desc: boolean;
|
|
144
|
+
} | null | undefined): string | null;
|
|
145
|
+
/**
|
|
146
|
+
* Timestamp literal cast — CRITICAL DISCOVERY (T07): MongoSQL does NOT
|
|
147
|
+
* accept the SQL-92 `TIMESTAMP 'literal'` form. Use `CAST('...' AS TIMESTAMP)`.
|
|
148
|
+
* Reference: https://www.mongodb.com/docs/sql-interface/language-reference/data-types/
|
|
149
|
+
* (and crates/native/src/translate.rs::date_filter_emits_match_referencing_created_at)
|
|
150
|
+
*/
|
|
151
|
+
timeStampCast(value: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* datetime cast — MongoSQL has only `TIMESTAMP` (no separate `DATETIME` /
|
|
154
|
+
* `DATE` types), so `dateTimeCast` and `timeStampCast` produce the same SQL.
|
|
155
|
+
* SPEC FR-2 explicitly substitutes `TIMESTAMP` for `DATE`.
|
|
156
|
+
*/
|
|
157
|
+
dateTimeCast(value: string): string;
|
|
158
|
+
/**
|
|
159
|
+
* String cast — MongoSQL's string type is spelt `STRING`, not the SQL-92
|
|
160
|
+
* `TEXT` (BaseQuery's default) or MySQL's `CHAR`.
|
|
161
|
+
* Reference: https://www.mongodb.com/docs/sql-interface/language-reference/data-types/
|
|
162
|
+
*/
|
|
163
|
+
castToString(sql: string): string;
|
|
164
|
+
/**
|
|
165
|
+
* Generic typed cast helper. MongoSQL accepts the standard CAST grammar;
|
|
166
|
+
* the *type name* must be one of MongoSQL's documented type tokens
|
|
167
|
+
* (BOOL, INT, LONG, DOUBLE, DECIMAL, STRING, TIMESTAMP, ARRAY, DOCUMENT).
|
|
168
|
+
*/
|
|
169
|
+
castSqlType(value: string, type: string): string;
|
|
170
|
+
/**
|
|
171
|
+
* Timezone conversion — MongoSQL has no `AT TIME ZONE` or `CONVERT_TZ`
|
|
172
|
+
* function (verified against the v1.8.5 grammar). Data is stored in UTC
|
|
173
|
+
* (BSON DateTime), and `inDbTimeZone()` (inherited) shifts JS-side
|
|
174
|
+
* timestamp parameters. For SQL-emitted field references we passthrough —
|
|
175
|
+
* correct for UTC data and matching "no conversion" semantics.
|
|
176
|
+
*
|
|
177
|
+
* Revisit if MongoSQL adds a timezone-aware function form, or if T14
|
|
178
|
+
* integration shows non-UTC dimensions break.
|
|
179
|
+
*/
|
|
180
|
+
convertTz(field: string): string;
|
|
181
|
+
/**
|
|
182
|
+
* NOW() equivalent. MongoSQL's documented form for the current time is
|
|
183
|
+
* `CURRENT_TIMESTAMP` (SQL-92 keyword), not MySQL/Postgres `NOW()`.
|
|
184
|
+
*/
|
|
185
|
+
nowTimestampSql(): string;
|
|
186
|
+
/**
|
|
187
|
+
* Seconds since the Unix epoch. BaseQuery default uses
|
|
188
|
+
* `EXTRACT(EPOCH FROM NOW())`, but MongoSQL's `EXTRACT` does NOT support
|
|
189
|
+
* the `EPOCH` date-part (only YEAR/MONTH/WEEK/DAY/HOUR/MINUTE/SECOND/
|
|
190
|
+
* MILLISECOND/DAYOFYEAR/DAYOFWEEK/ISOWEEK/ISOWEEKDAY — see
|
|
191
|
+
* `algebrize_extract` in mongosql/src/algebrizer/definitions.rs).
|
|
192
|
+
*
|
|
193
|
+
* Use `DATEDIFF(SECOND, '1970-01-01T00:00:00Z', CURRENT_TIMESTAMP)`
|
|
194
|
+
* instead. Returns LONG (mongosql `$dateDiff`).
|
|
195
|
+
*/
|
|
196
|
+
unixTimestampSql(): string;
|
|
197
|
+
/**
|
|
198
|
+
* Parse a Cube/Postgres-style interval string ("1 day", "2 weeks",
|
|
199
|
+
* "1 year 6 months") into an ordered list of MongoSQL DATEADD components.
|
|
200
|
+
*
|
|
201
|
+
* Cube emits compound intervals for partition ranges and granularity
|
|
202
|
+
* offsets. MongoSQL's DATEADD takes a single `<date_part>`, so we apply
|
|
203
|
+
* each component as a chained DATEADD call (see `addInterval` /
|
|
204
|
+
* `subtractInterval`). Order is preserved from `parseSqlInterval` so the
|
|
205
|
+
* outermost DATEADD is the *last* component (matches semantics: applying
|
|
206
|
+
* `(YEAR, 1)` then `(MONTH, 6)` is equivalent to "1 year 6 months").
|
|
207
|
+
*
|
|
208
|
+
* Public for unit-testing the bridge in isolation; not on BaseQuery.
|
|
209
|
+
*/
|
|
210
|
+
intervalUnitsForMongo(interval: string): IntervalComponent[];
|
|
211
|
+
/**
|
|
212
|
+
* Add a Cube interval to a date expression. Compound intervals
|
|
213
|
+
* ("1 year 6 months") are emitted as chained DATEADD calls.
|
|
214
|
+
*
|
|
215
|
+
* MongoSQL has no `INTERVAL '...'` literal. The base implementation emits
|
|
216
|
+
* `${date} + interval '...'` which the parser rejects.
|
|
217
|
+
*/
|
|
218
|
+
addInterval(date: string, interval: string): string;
|
|
219
|
+
/**
|
|
220
|
+
* Subtract a Cube interval from a date expression. Implemented as DATEADD
|
|
221
|
+
* with negated values (so `subtractInterval('d', '1 month')` becomes
|
|
222
|
+
* `DATEADD(MONTH, -1, d)`). Compound intervals chain the same way as
|
|
223
|
+
* `addInterval`.
|
|
224
|
+
*/
|
|
225
|
+
subtractInterval(date: string, interval: string): string;
|
|
226
|
+
private applyIntervalChain;
|
|
227
|
+
/**
|
|
228
|
+
* Printable interval string. MongoSQL has no INTERVAL literal so this is
|
|
229
|
+
* not safe to splice into emitted SQL — kept for diagnostic / error
|
|
230
|
+
* messages and for any BaseQuery code path we haven't audited yet (a
|
|
231
|
+
* future grep for `'1 day'` in SQL output would surface a regression).
|
|
232
|
+
*/
|
|
233
|
+
intervalString(interval: string): string;
|
|
234
|
+
/**
|
|
235
|
+
* Truncate a timestamp to a granularity boundary. MongoSQL's documented
|
|
236
|
+
* form is `DATETRUNC(<unit>, <date>[, <start_of_week>])`. For week we pin
|
|
237
|
+
* `'sunday'` explicitly: mongosql's `ScalarFunctionsRewritePass` defaults
|
|
238
|
+
* a missing third arg to `'sunday'` (per ast/rewrites/test.rs::
|
|
239
|
+
* `timestamp_trunc`), but Cube's tests should not depend on that
|
|
240
|
+
* implicit default — a future mongosql release could change it.
|
|
241
|
+
*/
|
|
242
|
+
timeGroupedColumn(granularity: string, dimension: string): string;
|
|
243
|
+
/**
|
|
244
|
+
* Bucket `source` into intervals starting from `origin`. Cube uses this
|
|
245
|
+
* for custom (non-natural) granularities like "5 minutes" or "10 days".
|
|
246
|
+
*
|
|
247
|
+
* MongoSQL has no INTERVAL literal, so PostgresQuery's
|
|
248
|
+
* `'origin'::ts + INTERVAL N * FLOOR(EXTRACT(EPOCH ...))` form doesn't
|
|
249
|
+
* port. Instead we use the DATEADD/DATEDIFF identity:
|
|
250
|
+
*
|
|
251
|
+
* floor((source - origin) / interval) * interval + origin
|
|
252
|
+
*
|
|
253
|
+
* which becomes:
|
|
254
|
+
*
|
|
255
|
+
* DATEADD(unit, FLOOR(DATEDIFF(unit, origin, source) / N) * N, origin)
|
|
256
|
+
*
|
|
257
|
+
* Year and quarter intervals are normalised to MONTH (1 year = 12 months,
|
|
258
|
+
* 1 quarter = 3 months) so arithmetic doesn't depend on leap-day-aware
|
|
259
|
+
* second math. Every other unit (week / day / hour / minute / second /
|
|
260
|
+
* millisecond) is used as-is — DATEDIFF/DATEADD operate in the unit's
|
|
261
|
+
* native granularity which is the most precise viable choice.
|
|
262
|
+
*
|
|
263
|
+
* NOTE: only single-component intervals are supported here (matches
|
|
264
|
+
* Cube's custom-granularity inputs which are always one unit). Compound
|
|
265
|
+
* dateBin intervals would need a different strategy.
|
|
266
|
+
*/
|
|
267
|
+
dateBin(interval: string, source: string, origin: string): string;
|
|
268
|
+
/**
|
|
269
|
+
* Generate the date-series SQL Cube uses for time-bucketed pre-aggregations.
|
|
270
|
+
* MongoSQL has no `VALUES (...)`, no recursive CTE, and no `generate_series`,
|
|
271
|
+
* so we emit a UNION ALL of literal-row SELECTs (MysqlQuery's strategy)
|
|
272
|
+
* and CAST in the outer projection. Identical row count to MysqlQuery's
|
|
273
|
+
* version; the difference is `CAST(... AS TIMESTAMP)` instead of
|
|
274
|
+
* MySQL-specific `TIMESTAMP(...)`.
|
|
275
|
+
*
|
|
276
|
+
* NOTE: emits N rows for an N-row series. For very large partition ranges
|
|
277
|
+
* Cube can pre-compute the row set in JS — there's no in-DB way to grow
|
|
278
|
+
* the series without recursive CTEs, which v1.8.5 doesn't support.
|
|
279
|
+
*/
|
|
280
|
+
seriesSql(timeDimension: SeriesTimeDimension): string;
|
|
281
|
+
/**
|
|
282
|
+
* Override Cube's filter class for every filter on a MongoSQL query.
|
|
283
|
+
*
|
|
284
|
+
* Background (Gap 4 discovery): Cube's default `BaseFilter.likeIgnoreCase`
|
|
285
|
+
* emits `<col> [NOT] ILIKE <pattern>` for `contains`, `notContains`,
|
|
286
|
+
* `startsWith`, `notStartsWith`, `endsWith`, `notEndsWith`. mongosql
|
|
287
|
+
* v1.8.5's grammar does NOT include the `ILIKE` keyword (verified
|
|
288
|
+
* empirically against atlas-local — the parser reports
|
|
289
|
+
* `Error 2001: Unrecognized token ILIKE, expected: BETWEEN` /
|
|
290
|
+
* `expected COMMA, RIGHT_PAREN`). mongosql DOES support the standard
|
|
291
|
+
* SQL-92 `LIKE` keyword.
|
|
292
|
+
*
|
|
293
|
+
* Strategy: subclass BaseFilter and override `likeIgnoreCase` to
|
|
294
|
+
* emit `LOWER(<col>) LIKE LOWER(<pattern>)` instead of
|
|
295
|
+
* `<col> ILIKE <pattern>`. Wrapping both sides in `LOWER(...)`
|
|
296
|
+
* preserves case-insensitive semantics; mongosql's `LOWER` is the
|
|
297
|
+
* standard SQL function and round-trips strings unchanged for ASCII
|
|
298
|
+
* content. We do NOT use `ESCAPE` clauses here because Cube's
|
|
299
|
+
* `escapeWildcardChars` pre-escapes `%` and `_` with `\` and SQL's
|
|
300
|
+
* default LIKE escape character IS `\` per the SQL standard (mongosql
|
|
301
|
+
* v1.8.5 follows this).
|
|
302
|
+
*
|
|
303
|
+
* **Non-ASCII / Unicode caveat.** This override is ASCII-aware case
|
|
304
|
+
* folding only. mongosql v1.8.5 does not expose `COLLATE` at the SQL
|
|
305
|
+
* surface, so case-folding non-ASCII characters (e.g. the German
|
|
306
|
+
* sharp-s `ß` → `ss`, Turkish dotless-i, etc.) is NOT performed. For
|
|
307
|
+
* pure-Latin inputs (the dominant Cube use case) this is correct.
|
|
308
|
+
* For locale-sensitive case-insensitive search, use MongoDB's
|
|
309
|
+
* collation feature outside the SQL surface or pre-normalise data.
|
|
310
|
+
*/
|
|
311
|
+
newFilter(filter: unknown): BaseFilter;
|
|
312
|
+
/**
|
|
313
|
+
* Patch the SQL templates that drive the rest of BaseQuery's builders.
|
|
314
|
+
* Mirrors MysqlQuery.sqlTemplates()'s pattern of `super` + targeted
|
|
315
|
+
* overrides.
|
|
316
|
+
*
|
|
317
|
+
* T12b additions: remove the `expressions.interval` template (BaseQuery's
|
|
318
|
+
* default emits `INTERVAL '<x>'` — invalid MongoSQL) so any caller that
|
|
319
|
+
* tries to render an interval literal surfaces an error rather than
|
|
320
|
+
* silently emitting unparseable SQL. The arithmetic-emitting paths
|
|
321
|
+
* (subtractInterval/addInterval/dateBin) don't go through this template.
|
|
322
|
+
* Also drop `statements.generated_time_series_*` for the same reason —
|
|
323
|
+
* those are recursive-CTE forms that mongosql doesn't accept.
|
|
324
|
+
*/
|
|
325
|
+
sqlTemplates(): ReturnType<BaseQuery['sqlTemplates']>;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Filter override for MongoSQL — rewrites `ILIKE` to `LOWER(...) LIKE LOWER(...)`.
|
|
329
|
+
*
|
|
330
|
+
* See `MongoSqlQuery.newFilter` for the rationale. Exported so unit tests
|
|
331
|
+
* can exercise `likeIgnoreCase` in isolation without instantiating the
|
|
332
|
+
* whole query stack.
|
|
333
|
+
*/
|
|
334
|
+
export declare class MongoSqlFilter extends BaseFilter {
|
|
335
|
+
/**
|
|
336
|
+
* Emit `LOWER(<col>) [NOT] LIKE LOWER(<wrapped-param>)` for mongosql.
|
|
337
|
+
*
|
|
338
|
+
* Layout mirrors BaseFilter.likeIgnoreCase:
|
|
339
|
+
* - `type === 'contains'`: wrap pattern with `'%' || ... || '%'`
|
|
340
|
+
* - `type === 'starts'`: suffix with `|| '%'` only (no prefix)
|
|
341
|
+
* - `type === 'ends'`: prefix with `'%' ||` only (no suffix)
|
|
342
|
+
*
|
|
343
|
+
* Cube's BaseFilter passes type as 'contains' / 'starts' / 'ends'
|
|
344
|
+
* (NOT the camelized operator — see BaseFilter.likeOr where `type`
|
|
345
|
+
* is hardcoded to one of those three values).
|
|
346
|
+
*
|
|
347
|
+
* `allocateParam` returns Cube's `?` placeholder; the driver's
|
|
348
|
+
* `substituteParameters` inlines literals before sending to mongosql.
|
|
349
|
+
*/
|
|
350
|
+
likeIgnoreCase(column: string, not: boolean, param: unknown, type: string): string;
|
|
351
|
+
}
|
|
352
|
+
export {};
|
|
353
|
+
//# sourceMappingURL=MongoSqlQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoSqlQuery.d.ts","sourceRoot":"","sources":["../src/MongoSqlQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AA4DxE,8EAA8E;AAC9E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,UAAU,mBAAmB;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