I am encountering very weird behavior when converting doubles to characters in sparlyr. It seems that periods are added randomly. Here a reproducible example:
my_test_df <- data.frame(char_val = 004545, char_val2 = 100286908074)
my_test_spark <- my_test_df %>% copy_to(sc, ., 'my_test_df_spark', overwrite = TRUE)
my_test_spark
## Source: spark<my_test_df_spark> [?? x 2]
## char_val char_val2
## <dbl> <dbl>
## 4545 100286908074
my_test_spark %>%
mutate(char_val = lpad(as.character(char_val), 6, "0"),
char_val2 = lpad(as.character(char_val2), 13, "0")) %>%
head
## Source: spark<?> [?? x 2]
## char_val char_val2
## <chr> <chr>
## 4545.0 1.00286908074
I really do not get why I have random periods in the final strings. Is there a way to avoid it?