I have a Spark dataframe with a column of characters as 20/01/2000 (day/month/year).
But I'm trying to change it to date format, so I'd be able to use the funcitons here: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions to get only the data I want (as for extract months and days, for example).
But seems like the functions only works when I'm using other formats of dates, as 1970-01-30.
An example:
sc <- spark_connect(master = "spark://XXXX")
df <- data.frame(date = c("20/10/2010", "19/11/2010"))
df_tbl <- copy_to(sc, df, "df")
If I want to extract only the month in a new column:
df_tbl <- df_tbl %>% mutate(month = month(date))
I get:
> df_tbl %>% glimpse()
Observations: 2
Variables: 2
$ data <chr> "20/10/2010", "19/11/2010"
$ month <int> NA, NA
Since R's function as.Date() doesn't work, I'd have to use another tool.
any clues?