I am writing a sql query in AWS Glue job script, where I need to covert timestamp to Varchar and extract date from it. Though the syntax seems to work fine if I try in sql but in Glue, it returns the timestamp instead of just the Date even after casting it. Can anybody please tell what is the issue with the query.
Below is my query. Thanks in Advance.
spark.sql("""SELECT
count(distinct b.user_id) AS count
FROM matomo_matomo_log_visit b
LEFT JOIN matomo_matomo_log_link_visit_action a ON b.idvisit = a.idvisit
WHERE CAST(server_time AS VARCHAR(10)) like '2021-06-%'
GROUP BY CAST(server_time AS VARCHAR(10)), b.user_id
""")