Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playground does not display float/decimal results correctly #4716

Open
2 tasks
richb-hanover opened this issue Jul 10, 2024 · 1 comment
Open
2 tasks

Playground does not display float/decimal results correctly #4716

richb-hanover opened this issue Jul 10, 2024 · 1 comment
Labels
web related to the website or the playground

Comments

@richb-hanover
Copy link
Contributor

What happened?

Using the public Playground (version 0.12.2), the Playground displays incorrect results for the round function. It seems to be missing the decimal points in the output.

The generated SQL is correct, and pasting that SQL into SQLite shows the expected results.

PRQL input

from [ { a=1 } ]
select {
  math.round 1  1.23,
  math.round 1  4.56
}

SQL output

WITH table_0 AS (
  SELECT
    1 AS a
)
SELECT
  ROUND(1.23, 1),
  ROUND(4.56, 1)
FROM
  table_0

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

Expected SQL output

==== EXPECTED ====

ROUND(1.23, 1)	ROUND(4.56, 1)
1.2	4.6

==== ACTUAL ====

round(1.23, 1)	round(4.56, 1)
12	46         <-- Note the lack of decimal points

MVCE confirmation

  • Minimal example
  • New issue

Anything else?

No response

@richb-hanover richb-hanover added the bug Invalid compiler output or panic label Jul 10, 2024
@kgutwin
Copy link
Collaborator

kgutwin commented Jul 10, 2024

This doesn't require math.round, as you can reproduce the missing decimals without it:

from [ { a=1.23 } ]
derive { b=4.56 }

When you select the "Query Results" tab and click "Copy to clipboard" you get this JSON:

[
  {"a": 123, "b": 456}
]

So the playground is just misbehaving when it comes to decimals.

@kgutwin kgutwin changed the title Playground displays incorrect results for round Playground does not display float/decimal results correctly Jul 10, 2024
@max-sixty max-sixty added web related to the website or the playground and removed bug Invalid compiler output or panic labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web related to the website or the playground
Projects
None yet
Development

No branches or pull requests

3 participants