malloy icon indicating copy to clipboard operation
malloy copied to clipboard

another "nextstructdef" error

Open mtoy-googly-moogly opened this issue 1 year ago • 0 comments

This incorrect code references the x in the input space, in the definition of the pipeline for x. It should give some sort of circular reference error. Instead it generates a next-struct-def problem.

run: duckdb.sql("SELECT 'first' as row UNION ALL SELECT 'second'")-> {
  group_by: row
  nest: x is {
    group_by: xone is 1, xtwo is 2
  } -> {
    select: x.xone
  }
}
INTERNAL ERROR model/Segment.nextStructDef: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
QUERY: {
  type: 'reduce',
  fields: [
    'row',
    {
      type: 'turtle',
      name: 'x',
      pipeline: [
        {
          type: 'reduce',
          fields: [
            {
              name: 'xone',
              type: 'number',
              location: {
                url: 'file:///Users/mtoy/malloy/speros-one.malloy',
                range: {
                  start: { line: 3, character: 14 },
                  end: { line: 3, character: 23 }
                }
              },
              e: [
                {
                  type: 'dialect',
                  function: 'numberLiteral',
                  literal: '1'
                }
              ],
              expressionType: 'scalar',
              code: '1'
            },
            {
              name: 'xtwo',
              type: 'number',
              location: {
                url: 'file:///Users/mtoy/malloy/speros-one.malloy',
                range: {
                  start: { line: 3, character: 25 },
                  end: { line: 3, character: 34 }
                }
              },
              e: [
                {
                  type: 'dialect',
                  function: 'numberLiteral',
                  literal: '2'
                }
              ],
              expressionType: 'scalar',
              code: '2'
            }
          ],
          filterList: []
        },
        { type: 'project', fields: [], filterList: [] }
      ],
      location: {
        url: 'file:///Users/mtoy/malloy/speros-one.malloy',
        range: {
          start: { line: 2, character: 8 },
          end: { line: 6, character: 3 }
        }
      }
    }
  ],
  filterList: []
}

mtoy-googly-moogly avatar Sep 26 '23 21:09 mtoy-googly-moogly