Unexpected result with s-string including UNNEST

Abierto
#4,385 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust, sql

Línea de trabajo

Start by locating how PRQL handles the s"..." SQL-s-string input and compare its generated query behavior with the DuckDB results described in the issue. The displayed SQL is identical to the expected SQL, so investigate the unexpected result values at the boundary between PRQL's handling and DuckDB execution; done means the reported values match DuckDB's direct UNNEST query.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

web
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 │
└─────────────────────────────────────────┘
Lenguaje dominante
Rust
Estrellas
10.9k
Forks
261
Merge medio
3 d 20 h
PR fusionados (30 d)
85

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PRQL/prql

Todos los issues de PRQL/prql

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.