Skip to content

[R] Update the docs to show how to avoid situations like data loss with leading zero in partition column #39660

Description

@arthurgailes

Describe the bug, including details regarding any error messages, version, and platform.

Arrow does not correctly interpret some partition values as character columns, resulting in data loss.

library(arrow)
library(dplyr)

# character col with leading zero
mtcars2 <- mutate(mtcars, test = paste0(0, mtcars$carb)) |> as_tibble()

tmp <- tempfile()

write_dataset(mtcars2, tmp, partitioning = "test")

mtcars3 <- open_dataset(tmp) |> collect()

unique(mtcars2$test)
#> [1] "04" "01" "02" "03" "06" "08"
unique(mtcars3$test)
#> [1] 1 2 3 4 6 8

Created on 2024-01-17 with reprex v2.0.2

Component(s)

R

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions