prql icon indicating copy to clipboard operation
prql copied to clipboard

trying to remove identical rows per group

Open colemanbroad opened this issue 1 year ago • 2 comments

What happened?

A compiler bug was encountered. Please copy/paste the PRQL query into a new report at: https://github.com/PRQL/prql/issues/new?template=bug_report.yaml

PRQL input

from df = [
{a=1,b=3},
{a=9,b=4},
{a=1,b=3},
{a=2,b=3},
]
group a (
  group df.* (
    take 1
  )
)

SQL output

WITH table_0 AS (
  SELECT
    1 AS a,
    3 AS b
  UNION
  ALL
  SELECT
    9 AS a,
    4 AS b
  UNION
  ALL
  SELECT
    1 AS a,
    3 AS b
  UNION
  ALL
  SELECT
    2 AS a,
    3 AS b
),
table_1 AS (
  SELECT
    a,
    b,
    ROW_NUMBER() OVER (PARTITION BY a) AS _expr_0
  FROM
    table_0
)
SELECT
  a,
  b
FROM
  table_1
WHERE
  _expr_0 <= 1

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

Expected SQL output

No response

MVCE confirmation

  • [X] Minimal example
  • [X] New issue

Anything else?

No response

colemanbroad avatar Jan 25 '24 22:01 colemanbroad

(quick message to say thanks for the issue @colemanbroad — the nested grouping still needs some work)

max-sixty avatar Feb 08 '24 22:02 max-sixty

Thanks for your work! I absolutely love this language.

colemanbroad avatar Feb 09 '24 03:02 colemanbroad