- Newest
- Most votes
- Most comments
Hello,
To understand your issue better, I tried to reproduce the issue referring your above mentioned schema. I created a table with above value and a date column with data type is varchar.
I was getting the same error with Athena engine version 2 and as well as 3:
'>=' cannot be applied to varchar
Then I tried to run the query by removing 'DATE' from sql and it got successful.
Additionally, You can query in the below format, I have tested at my end and it is working fine.
SELECT * FROM MyDatabase.MyTable WHERE sessiondate >= ('2022-12-18')
SELECT * FROM MyDatabase.MyTable WHERE cast(sessiondate as date) >= date('2022-12-18')
We are unable to provide you the root cause why your query was working fine earlier as we need to check your query logs, meanwhile please check if there is any new data of different type is added recently in your date column.
Or check if there is any change in query execution like Athena version 2 or 3 being used, IAM role or any IAM permissions etc, or if there is any change in schema of 'sessiondate' column.
You can check and confirm the column schema from Glue or Athena console.
For further investigation and to find the root cause of the issue , we require details that are non-public information. Please open a support case with AWS using the following
https://support.console.aws.amazon.com/support/home#/case/create
Relevant content
- asked 4 months ago
- Accepted Answerasked 3 years ago
- asked 3 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
Hello Shahrukh,
A couple of answers in this [1] post also indicate that >= DATE('2022-12-18') works. I believe something changed in Athena.
I am not able to open a support case, it says "User: my userID is not authorized to perform: support:DescribeServices because no identity-based policy allows the support:DescribeServices action." That is fine because your answer works for me.
Thanks for your help
[1] https://stackoverflow.com/questions/51269919/athena-greater-than-condition-in-date-column