Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-14722

[R] dplyr::arrange converts number values to negative

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 6.0.0
    • 7.0.0
    • None

    Description

      ```

      # Load libraries
      library(arrow)
      library(dplyr)
      
      # Store table
      file_path <- tempfile()
      write_parquet(dplyr::tibble(a = 1:10, b = "A"), file_path)
      
      # Read table 
      my_table <- read_parquet(file_path)
      
      # Table looks normal
      my_table
      # A tibble: 10 x 2
      #       a b    
      #   <int> <chr>
      # 1     1 A    
      # 2     2 A    
      # 3     3 A    
      # 4     4 A    
      # 5     5 A    
      # 6     6 A    
      # 7     7 A    
      # 8     8 A    
      # 9     9 A    
      # 10    10 A  
      
      # First arrange changes number values to negative
      my_table %>% arrange(dplyr::desc(a)) 
      # A tibble: 10 x 2
      #       a b    
      #   <int> <chr>
      # 1   -10 A    
      # 2    -9 A    
      # 3    -8 A    
      # 4    -7 A    
      # 5    -6 A    
      # 6    -5 A    
      # 7    -4 A    
      # 8    -3 A    
      # 9    -2 A    
      # 10   -1 A   
      
      # Even underlying data is changed!!!
      my_table
      # A tibble: 10 x 2
      #       a b    
      #   <int> <chr>
      # 1   -10 A    
      # 2    -9 A    
      # 3    -8 A    
      # 4    -7 A    
      # 5    -6 A    
      # 6    -5 A    
      # 7    -4 A    
      # 8    -3 A    
      # 9    -2 A    
      # 10   -1 A   
      
      # Second arrange changes it back
      my_table %>% arrange(dplyr::desc(a)) 
      my_table
      # A tibble: 10 x 2
      #       a b    
      #   <int> <chr>
      # 1     1 A    
      # 2     2 A    
      # 3     3 A    
      # 4     4 A    
      # 5     5 A    
      # 6     6 A    
      # 7     7 A    
      # 8     8 A    
      # 9     9 A    
      # 10    10 A  
      
      

      ```

      Attachments

        Issue Links

          Activity

            People

              wjones127 Will Jones
              wjones127 Will Jones
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h
                  3h