Skip to content

Compiler crash when joining a zero-row relation #5988

Closed

Description

@kgutwin

What happened?

Context: support for relations created by from_text that have zero rows was added in #4693 and discussed in #4421.

The PRQL below crashes on compilation with:

Message:  called `Option::unwrap()` on a `None` value
Location: prqlc/prqlc/src/semantic/resolver/transforms.rs:579

PRQL input

from foo
select {bar}
join side:left map = (
  from_text format:json '{"columns":["key","value"],"data":[]}'
) this.bar == that.key

SQL output

N/A

Expected SQL output

WITH table_0 AS (
  SELECT
    NULL AS "key",
    NULL AS value
  WHERE
    false
)
SELECT
  foo.bar,
  table_0."key",
  table_0.value
FROM
  foo
  LEFT OUTER JOIN table_0 ON foo.bar = table_0."key"

MVCE confirmation

  • Minimal example
  • New issue

Anything else?

The analogous PRQL code with more than one row does compile successfully:

from foo
select {bar}
join side:left map = (
  from_text format:json '{"columns":["key","value"],"data":[["x","y"]]}'
) this.bar == that.key

Activity

  1. added
    bug
    on Jun 8, 2026
  2. mansiverma897993 commented on Jun 19, 2026

    @mansiverma897993

    is this issue resloved ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions