@malloydata/malloy 0.0.153-dev240716150221 → 0.0.153-dev240717221349

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.
@@ -508,20 +508,24 @@ class PrestoDialect extends TrinoDialect {
508
508
  if (isArray) {
509
509
  if (needDistinctKey) {
510
510
  // return `LEFT JOIN UNNEST(transform(${source}, x -> CAST(ROW(x) as ROW(value) )) WITH ORDINALIITY as words_0(value,__row_id_from_${alias}) ON TRUE`;
511
- return `CROSS JOIN UNNEST(${source}) WITH ORDINALITY as ${alias}(value, __row_id_from_${alias}) `;
511
+ return ('-- Simulate a left join\n' +
512
+ `CROSS JOIN UNNEST(COALESCE(${source},ARRAY[NULL])) WITH ORDINALITY as ${alias}(value, __row_id_almost_${alias})\n` +
513
+ `CROSS JOIN UNNEST(ARRAY[CASE WHEN ${source} IS NOT NULL THEN __row_id_almost_${alias} END]) as ${alias}_ignore(__row_id_from_${alias})`);
512
514
  }
513
515
  else {
514
516
  // return `CROSS JOIN UNNEST(zip_with(${source},array[],(r,ignore) -> (r, ignore))) as ${alias}(value, ignore)`;
515
- return `CROSS JOIN UNNEST(${source}) as ${alias}(value) `;
517
+ return `CROSS JOIN UNNEST(COALESCE(${source}, ARRAY[NULL])) as ${alias}(value) `;
516
518
  }
517
519
  }
518
520
  else if (needDistinctKey) {
519
521
  // return `CROSS JOIN UNNEST(zip_with(${source},array[],(r,ignore) -> (r, ignore))) WITH ORDINALITY as ${alias}_outer(${alias}, ignore,__row_id_from_${alias})`;
520
- return `CROSS JOIN UNNEST(${source}) WITH ORDINALITY as ${alias}_outer(${alias}, __row_id_from_${alias})`;
522
+ return ('-- Simulate a left join\n' +
523
+ `CROSS JOIN UNNEST(COALESCE(${source}, ARRAY[NULL])) WITH ORDINALITY as ${alias}_outer(${alias}, __row_id_almost_${alias})\n` +
524
+ `CROSS JOIN UNNEST(ARRAY[CASE WHEN ${source} IS NOT NULL THEN __row_id_almost_${alias} END]) as ${alias}_ignore(__row_id_from_${alias})`);
521
525
  }
522
526
  else {
523
527
  // return `CROSS JOIN UNNEST(zip_with(${source},array[],(r,ignore) -> (r, ignore)))as ${alias}_outer(${alias},ignore)`;
524
- return `CROSS JOIN UNNEST(${source}) as ${alias}_outer(${alias})`;
528
+ return `CROSS JOIN UNNEST(COALESCE(${source}, ARRAY[NULL])) as ${alias}_outer(${alias})`;
525
529
  }
526
530
  }
527
531
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.153-dev240716150221",
3
+ "version": "0.0.153-dev240717221349",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",