Skip to content

Unexpected result with s-string including UNNEST #4385

@snth

Description

@snth

What happened?

I was just being lazy and thought I'd try out a potentially more ergonomic way of writing some example data when I encountered the following unexpected output.

PRQL input

from s"SELECT UNNEST([0.1, 0.2, 0.3, 1, 2, 4])"

SQL output

WITH table_0 AS (
  SELECT
    UNNEST([0.1, 0.2, 0.3, 1, 2, 4])
)
SELECT
  *
FROM
  table_0

-- Generated by PRQL compiler version:0.11.3 (https://prql-lang.org)

Expected SQL output

WITH table_0 AS (
  SELECT
    UNNEST([0.1, 0.2, 0.3, 1, 2, 4])
)
SELECT
  *
FROM
  table_0

-- Generated by PRQL compiler version:0.11.3 (https://prql-lang.org)

MVCE confirmation

  • Minimal example
  • New issue

Anything else?

The SQL looks fine but the Query Results are surprising:

unnest(main.list_value(0.1, 0.2, 0.3, 1, 2, 4))

1
2
3
10
20
40

Compare this with the results from shell.duckdb.org:

duckdb> from unnest([0.1, 0.2, 0.3, 1, 2, 3]);
┌─────────────────────────────────────────┐
│ main.list_value(0.1, 0.2, 0.3, 1, 2, 3) │
╞═════════════════════════════════════════╡
│                                     0.1 │
│                                     0.2 │
│                                     0.3 │
│                                     1.0 │
│                                     2.0 │
│                                     3.0 │
└─────────────────────────────────────────┘

Metadata

Metadata

Assignees

No one assigned

    Labels

    webrelated to the website or the playground

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions