Found while implementing #7117 (the analytics generateSql() echo). Out of that card's scope — it is a different exit with a different failure mode — so it is filed rather than folded in. #7117's PR declares its status in the per-face table.
Measured on origin/main @ 69fde55, executed
MemoryAnalyticsService.query() returns AnalyticsResult.sql from generateSqlFromPipeline() (memory-analytics.ts), which dumps the executed mingo pipeline stage by stage:
conststages=pipeline.map((stage,idx)=>{constop=Object.keys(stage)[0];return`/* Stage ${idx+1}: ${op} */ ${JSON.stringify(stage[op])}`;}).join('\n');For {name: {$contains: 'Industries'}} on a one-row cube that prints:
-- MongoDB Aggregation Pipeline on table: deal
/* Stage 1: $match */ {"name":{"$regex":{}}}
/* Stage 2: $group */ {"_id":{"id":"$id"},"total":{"$sum":1}}
/* Stage 3: $project */ {"_id":0,"id":"$_id.id","total":"$total"}
JSON.stringify renders a RegExp as {} — it has no own enumerable properties — so the pattern is gone. The $match stage is reported as constraining name by an empty object. Every operator whose predicate carries a RegExp is affected: contains, icontains, notContains (the last nested inside $not).
Why this is filed separately from #7117, and at a lower grade
#7117 is the #5333 class — a rendering that contradicts execution. This is not that:
So the direction is lost-information on a transparency surface, not a wrong answer. It is still worth closing: this string is the only thing an author debugging an in-memory chart is given, and the one field it drops is the one they are usually looking for.
Scope
generateSqlFromPipeline() in packages/drivers/driver-memory/src/memory-analytics.ts. A replacer that renders a RegExp as its source / flags would be the smallest fix; whether the dump should render $regex in the pattern's own syntax (/Industries/) or as {"$regex":"Industries"} is the one decision to make.
A check should assert on the dump's content for a pattern operator, not merely that the string is non-empty — the current output is non-empty and passes any such assertion.
Found while implementing #7117 (the analytics
generateSql()echo). Out of that card's scope — it is a different exit with a different failure mode — so it is filed rather than folded in. #7117's PR declares its status in the per-face table.Measured on
origin/main@69fde55, executedMemoryAnalyticsService.query()returnsAnalyticsResult.sqlfromgenerateSqlFromPipeline()(memory-analytics.ts), which dumps the executed mingo pipeline stage by stage:For
{name: {$contains: 'Industries'}}on a one-row cube that prints:JSON.stringifyrenders aRegExpas{}— it has no own enumerable properties — so the pattern is gone. The$matchstage is reported as constrainingnameby an empty object. Every operator whose predicate carries a RegExp is affected:contains,icontains,notContains(the last nested inside$not).Why this is filed separately from #7117, and at a lower grade
#7117 is the #5333 class — a rendering that contradicts execution. This is not that:
-- MongoDB Aggregation Pipeline on table: …), so nobody can run it and get a wrong row set;{"$regex":{}}reads as "something is missing here";WHERE name LIKE 'acme'read as a working predicate, which is exactly what let driver-memory's analyticsgenerateSql()renders the LIKE family with NO wildcards, so the echoed statement is an EQUALITY the pipeline never ran #7117 survive.So the direction is lost-information on a transparency surface, not a wrong answer. It is still worth closing: this string is the only thing an author debugging an in-memory chart is given, and the one field it drops is the one they are usually looking for.
Scope
generateSqlFromPipeline()inpackages/drivers/driver-memory/src/memory-analytics.ts. A replacer that renders aRegExpas itssource/flagswould be the smallest fix; whether the dump should render$regexin the pattern's own syntax (/Industries/) or as{"$regex":"Industries"}is the one decision to make.A check should assert on the dump's content for a pattern operator, not merely that the string is non-empty — the current output is non-empty and passes any such assertion.