Skip to content

Commit

Permalink
chore: fix flaky datetime test
Browse files Browse the repository at this point in the history
  • Loading branch information
TCeason committed Jan 7, 2025
1 parent 99cb6e1 commit 4de616d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -882,13 +882,12 @@ SELECT substr(DATE_ADD(month, 1, now())::String, 11)=substr(now()::String, 11);

# format: 11
query T
SELECT substr(DATE_ADD(month, 1, now())::String, 6, 2) =
CASE
WHEN substr(now()::String, 6, 2) = '12' THEN '01'
ELSE LPAD((substr(now()::String, 6, 2)::int + 1)::String, 2, '0')
END;
select sum( ((m1 + number) % 12 = m2 or ((m1 + number) % 12 + m2 = 12))::Int ) from (
select number, DATE_ADD(month, number, now()) as d, to_month(now()) as m1, to_month(d) as m2
from numbers(1000)
);
----
1
1000

# format: 2024
query T
Expand Down Expand Up @@ -947,11 +946,10 @@ SELECT substr(DATE_ADD(month, 1, now())::String, 11)=substr(now()::String, 11);

# format: 11
query T
SELECT substr(DATE_ADD(month, 1, now())::String, 6, 2) =
CASE
WHEN substr(now()::String, 6, 2) = '12' THEN '01'
ELSE LPAD((substr(now()::String, 6, 2)::int + 1)::String, 2, '0')
END;
select sum( ((m1 + number) % 12 = m2 or ((m1 + number) % 12 + m2 = 12))::Int ) from (
select number, DATE_ADD(month, number, now()) as d, to_month(now()) as m1, to_month(d) as m2
from numbers(1000)
);
----
1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,11 +756,10 @@ SELECT substr(DATE_ADD(month, 1, now())::String, 11)=substr(now()::String, 11);

# format: 11
query T
SELECT substr(DATE_ADD(month, 1, now())::String, 6, 2) =
CASE
WHEN substr(now()::String, 6, 2) = '12' THEN '01'
ELSE LPAD((substr(now()::String, 6, 2)::int + 1)::String, 2, '0')
END;
select sum( ((m1 + number) % 12 = m2 or ((m1 + number) % 12 + m2 = 12))::Int ) from (
select number, DATE_ADD(month, number, now()) as d, to_month(now()) as m1, to_month(d) as m2
from numbers(1000)
);
----
1

Expand Down Expand Up @@ -810,11 +809,10 @@ SELECT substr(DATE_ADD(month, 1, now())::String, 11)=substr(now()::String, 11);

# format: 11
query T
SELECT substr(DATE_ADD(month, 1, now())::String, 6, 2) =
CASE
WHEN substr(now()::String, 6, 2) = '12' THEN '01'
ELSE LPAD((substr(now()::String, 6, 2)::int + 1)::String, 2, '0')
END;
select sum( ((m1 + number) % 12 = m2 or ((m1 + number) % 12 + m2 = 12))::Int ) from (
select number, DATE_ADD(month, number, now()) as d, to_month(now()) as m1, to_month(d) as m2
from numbers(1000)
);
----
1

Expand All @@ -828,6 +826,5 @@ END;
----
1


statement ok
unset enable_strict_datetime_parser;

0 comments on commit 4de616d

Please sign in to comment.