if assigned like this as-of_dt = 02/28/2023 , this errors - “Cannot apply operator: date = integer”
I think you are trying to convert a string in that format into a date (or timestamp) value. If so, does this help?
-- parsing string 'mm/dd/yyyy' to a timestamp
SELECT date_parse('02/28/2023', '%m/%d/%Y');
-- returns 2023-02-28 00:00:00.000
-- if want a date instead of timestamp, just cast it
SELECT CAST(date_parse('02/28/2023', '%m/%d/%Y') AS date);
-- returns 2023-02-28
If you are wanting something different, just let me know.
this seems to work in a select but when compared to a date element it errors out
dt_as_of = CAST(date_parse(‘04/30/2025’, ‘%m/%d/%Y’) AS date)
error - mismatched input ‘’. Expecting: ‘(’, ‘)’, ‘ARRAY’
Maybe I need some more info on what you’re doing and what kind of table format you are using. Here are some examples for Iceberg running on Starburst Galaxy.
Was able to use this approach when inserting rows.
create table test_date (a_string varchar, a_date date)
with (type='iceberg');
insert into test_date values
('Jan 1, 2025', CAST(date_parse('01/01/2025', '%m/%d/%Y') AS date)),
('Feb 9, 2025', CAST(date_parse('02/09/2025', '%m/%d/%Y') AS date));
select * from test_date;
Was able to use this approach when performing a filter.
select * from test_date
where a_date = CAST(date_parse('01/01/2025', '%m/%d/%Y') AS date);
If this is still not working, please provide a bit more of your example. Preferably something I can reproduce. Good luck!