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

Pivot with default() of different type does not re-infer type #734

Closed
Jolanrensen opened this issue Jun 12, 2024 · 0 comments · Fixed by #735
Closed

Pivot with default() of different type does not re-infer type #734

Jolanrensen opened this issue Jun 12, 2024 · 0 comments · Fixed by #735
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Jolanrensen
Copy link
Collaborator

Relates to #713

Given

val df = dataFrameOf("firstName", "lastName", "age", "city", "weight", "isHappy")(
    "Alice", "Cooper", 15, "London", 54, true,
    "Bob", "Dylan", 45, "Dubai", 87, true,
    "Charlie", "Daniels", 20, "Moscow", null, false,
    "Charlie", "Chaplin", 40, "Milan", null, true,
    "Bob", "Marley", 30, "Tokyo", 68, true,
    "Alice", "Wolf", 20, null, 55, false,
    "Charlie", "Byrd", 30, "Moscow", 90, true
).group("firstName", "lastName").into("name")
---
df.pivot { city }.groupBy { name }.default(0).min()

we get pivoted.city.London.isHappy.type() == typeOf<Boolean>(), while the column values are: [true, 0, 0, 0, 0, 0, 0]

I narrowed the issue down to concatImpl(). This collects column types when just col != null. When defaultValue is used, this is not added to the set of types, skipping guessType.

It can fix 3 tests in #713

@Jolanrensen Jolanrensen added the bug Something isn't working label Jun 12, 2024
@Jolanrensen Jolanrensen added this to the 0.14.0 milestone Jun 12, 2024
@Jolanrensen Jolanrensen self-assigned this Jun 12, 2024
@Jolanrensen Jolanrensen mentioned this issue Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant