Skip to content

forEach on same path as repeat fails with "No such struct field" error #2533

@johngrimes

Description

@johngrimes

ViewDefinitions that use forEach to access the same path being recursively traversed by repeat fail with a Spark AnalysisException.

Reproduction

{
  "resourceType": "ViewDefinition",
  "resource": "CodeSystem",
  "status": "active",
  "select": [
    {
      "column": [{"name": "cs_id", "path": "id"}]
    },
    {
      "repeat": ["concept"],
      "column": [{"name": "parent_code", "path": "code"}],
      "select": [
        {
          "forEach": "concept",
          "column": [{"name": "code", "path": "code"}]
        }
      ]
    }
  ]
}

Expected behaviour

The view should produce rows showing parent-child relationships in the CodeSystem concept hierarchy, with parent_code containing the code of each concept and code containing the codes of its direct children.

Actual behaviour

Returns HTTP 500 with:

[FIELD_NOT_FOUND] No such struct field `concept` in `id`, `code`, `display`, `definition`, `designation`, `property`, `_fid`. SQLSTATE: 42704

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions