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

Example produces incorrect results #44

Open
andygrove opened this issue Nov 19, 2023 · 0 comments
Open

Example produces incorrect results #44

andygrove opened this issue Nov 19, 2023 · 0 comments

Comments

@andygrove
Copy link
Collaborator

The tips.py runs a grouping query but the result set has duplicate keys:

0    Male     No  0.160669
1  Female    Yes  0.182150
      sex smoker   tip_pct
0  Female     No  0.156921
1    Male    Yes  0.152771

Debug logging:

Planning select sex, smoker, avg(tip/total_bill) as tip_pct from tips group by sex, smoker
Query stage #0:
RayShuffleWriterExec(stage_id=0, output_partitioning=Hash([Column { name: "sex", index: 0 }, Column { name: "smoker", index: 1 }], 2))
  AggregateExec: mode=Partial, gby=[sex@2 as sex, smoker@3 as smoker], aggr=[AVG(tips.tip / tips.total_bill)]
    ParquetExec: limit=None, partitions={1 group: [[home/andy/git/personal/ray-sql/examples/tips.parquet]]}, projection=[total_bill, tip, sex, smoker]

Query stage #1:
CoalescePartitionsExec
  ProjectionExec: expr=[sex@0 as sex, smoker@1 as smoker, AVG(tips.tip / tips.total_bill)@2 as tip_pct]
    AggregateExec: mode=FinalPartitioned, gby=[sex@0 as sex, smoker@1 as smoker], aggr=[AVG(tips.tip / tips.total_bill)]
      CoalesceBatchesExec: target_batch_size=16384
        RayShuffleReaderExec(stage_id=0, input_partitioning=Hash([Column { name: "sex", index: 0 }, Column { name: "smoker", index: 1 }], 2))

Scheduling query stage #0 with 1 input partitions and 2 output partitions
Forcing reduce stage concurrency from 2 to 1
Scheduling query stage #1 with 1 input partitions and 1 output partitions
      sex smoker   tip_pct
0    Male     No  0.160669
1  Female    Yes  0.182150
      sex smoker   tip_pct
0  Female     No  0.156921
1    Male    Yes  0.152771
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant