@malloydata/malloy 0.0.226-dev250113222119 → 0.0.226-dev250113232418

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.
@@ -391,7 +391,6 @@ class DuckDBTypeParser extends tiny_parser_1.TinyParser {
391
391
  return token.text.toUpperCase();
392
392
  }
393
393
  typeDef() {
394
- const unknownStart = this.parseCursor;
395
394
  const wantID = this.next('id');
396
395
  const id = this.sqlID(wantID);
397
396
  let baseType;
@@ -438,17 +437,18 @@ class DuckDBTypeParser extends tiny_parser_1.TinyParser {
438
437
  }
439
438
  else {
440
439
  if (wantID.type === 'id') {
441
- for (;;) {
442
- const next = this.peek();
443
- // Might be WEIRDTYP(a,b)[] ... stop at the []
444
- if (next.type === 'arrayOf' || next.type === 'eof') {
445
- break;
446
- }
440
+ // unknown field type, strip all type decorations, there was a regex for this
441
+ // in the pre-parser code, but no tests, so this is also untested
442
+ let idEnd = wantID.cursor + wantID.text.length;
443
+ if (this.peek().type === 'precision') {
447
444
  this.next();
448
445
  }
446
+ if (this.peek().type === 'eof') {
447
+ idEnd = this.input.length;
448
+ }
449
449
  baseType = {
450
450
  type: 'sql native',
451
- rawType: this.input.slice(unknownStart, this.parseCursor - unknownStart + 1),
451
+ rawType: this.input.slice(wantID.cursor, idEnd),
452
452
  };
453
453
  }
454
454
  else {
@@ -1,4 +1,5 @@
1
1
  export interface TinyToken {
2
+ cursor: number;
2
3
  type: string;
3
4
  text: string;
4
5
  }
@@ -129,12 +129,14 @@ class TinyParser {
129
129
  if (foundToken) {
130
130
  notFound = false;
131
131
  let tokenText = foundToken[0];
132
+ const cursor = this.parseCursor;
132
133
  this.parseCursor += tokenText.length;
133
134
  if (tokenType !== 'space') {
134
135
  if (tokenType[0] === 'q') {
135
136
  tokenText = tokenText.slice(1, -1); // strip quotes
136
137
  }
137
138
  yield {
139
+ cursor,
138
140
  type: tokenType === 'char' ? tokenText : tokenType,
139
141
  text: tokenText,
140
142
  };
@@ -143,7 +145,7 @@ class TinyParser {
143
145
  }
144
146
  }
145
147
  if (notFound) {
146
- yield { type: 'unexpected token', text: src };
148
+ yield { cursor: this.parseCursor, type: 'unexpected token', text: src };
147
149
  return;
148
150
  }
149
151
  }
@@ -170,7 +170,7 @@ class QueryOperationSpace extends refined_space_1.RefinedSpace {
170
170
  const lookup = this.exprSpace.lookup(reference);
171
171
  // Should always be found...
172
172
  if (lookup.found && lookup.found instanceof struct_space_field_base_1.StructSpaceFieldBase) {
173
- return ((_a = lookup.found.fieldDef().onCompositeFieldUsage) !== null && _a !== void 0 ? _a : (0, composite_source_utils_1.emptyCompositeFieldUsage)());
173
+ return (0, composite_source_utils_1.joinedCompositeFieldUsage)(joinPath.slice(0, -1), (_a = lookup.found.fieldDef().onCompositeFieldUsage) !== null && _a !== void 0 ? _a : (0, composite_source_utils_1.emptyCompositeFieldUsage)());
174
174
  }
175
175
  throw new Error('Unexpected join lookup was not found or not a struct');
176
176
  }
@@ -571,6 +571,19 @@ describe('query:', () => {
571
571
  extend: { join_one: b with astr }
572
572
  group_by: b.ai
573
573
  }`).toTranslate();
574
+ });
575
+ test('reference field in double nested join inside nest', () => {
576
+ expect(`
577
+ source: a_2 is a extend { join_one: b is b extend {
578
+ join_one: c is b on 1 = c.ai
579
+ } with astr }
580
+
581
+ run: a_2 -> {
582
+ nest: x is {
583
+ group_by: ai is b.c.ai
584
+ }
585
+ }
586
+ `).toTranslate();
574
587
  });
575
588
  test.skip('reference join as field', () => {
576
589
  expect(`run: a -> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.226-dev250113222119",
3
+ "version": "0.0.226-dev250113232418",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",