queryverse / queryverse/Query.jl
Column types get obliterated by Query.jl
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 403
- Forks
- 48
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 6
Description
I have a DataFrame df with correct column types (String, Float64, etc). However after processing with Query.jl I'm getting only Any column types. Here's the suspect code snippet:
brand_code_df =
df |>
@groupby((_.Brand, _.Product_Code)) |>
@map({
Brand = key(_)[1],
Product_Code = key(_)[2],
WAP = sum(_.Unit_Price .* _.Units) / sum(_.Units),
WAC = sum(_.Unit_Cost .* _.Units) / sum(_.Units),
total_sales = sum(_.Sales),
gross_margin = sum(_.Margin),
GMP = sum(_.Margin) / sum(_.Sales) * 100,
total_code_units = sum(_.Units),
weight = sum(_.Units) / brand_total_units[key(_)[1]],
unique_prices = unique_prices(_),
}) |>
DataFrame
Now, brand_code_df will have only Any column types.
OTOH I've found that doing ... |> collect |> DataFrame does in fact retain the correct column types.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the shown Julia pipeline using Query.jl, comparing direct DataFrame construction with the working collect |> DataFrame variant. Inspect the @groupby and @map path and verify that the resulting columns preserve their inferred types rather than becoming Any; done means the direct pipeline matches the collected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100