Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ def validate(self) -> Testdrive:
3 334 "2024-12-31 23:59:59" "2024-12-31 18:59:59" "2024-12-31 18:59:59"
4 335 "2025-01-01 00:00:00" "2024-12-31 19:00:00" "2024-12-31 19:00:00"

>[version>=2603500] SELECT id, jd::text, jh::text, ji::text FROM datetime_fns_convert1
>[version>=2603600] SELECT id, jd::text, jh::text, ji::text FROM datetime_fns_convert1
1 "1 mon 5 days" "35 days" "1 mon 5 days"
2 27:00:00 "1 day 03:00:00" "1 day 03:00:00"
3 "1 mon -01:00:00" "1 mon -01:00:00" "29 days 23:00:00"
4 00:00:00 00:00:00 00:00:00

>[version<2603500] SELECT id, jd::text, jh::text, ji::text FROM datetime_fns_convert1
>[version<2603600] SELECT id, jd::text, jh::text, ji::text FROM datetime_fns_convert1
1 "1 month 5 days" "35 days" "1 month 5 days"
2 27:00:00 "1 day 03:00:00" "1 day 03:00:00"
3 "1 month -01:00:00" "1 month -01:00:00" "29 days 23:00:00"
Expand Down
24 changes: 12 additions & 12 deletions misc/python/materialize/data_ingest/data_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,11 +778,11 @@ def random_value(
in_query: bool = False,
) -> Any:
if rng.randrange(100) == 0:
result = "1-01-01"
result = "0001-01-01"
elif rng.randrange(100) == 0:
result = "99999-12-31"
else:
result = f"{rng.randrange(1, 100000)}-{rng.randrange(1, 13)}-{rng.randrange(1, 29)}"
result = f"{rng.randrange(1, 100000):04}-{rng.randrange(1, 13)}-{rng.randrange(1, 29)}"
return f"TIMESTAMP '{result}'" if in_query else str(result)

@staticmethod
Expand Down Expand Up @@ -813,11 +813,11 @@ def random_value(
in_query: bool = False,
) -> Any:
if rng.randrange(100) == 0:
result = "1-01-01"
result = "0001-01-01"
elif rng.randrange(100) == 0:
result = "99999-12-31"
else:
result = f"{rng.randrange(1, 100000)}-{rng.randrange(1, 13)}-{rng.randrange(1, 29)}"
result = f"{rng.randrange(1, 100000):04}-{rng.randrange(1, 13)}-{rng.randrange(1, 29)}"
return f"TIMESTAMPTZ '{result}'" if in_query else str(result)

@staticmethod
Expand Down Expand Up @@ -878,11 +878,11 @@ def random_value(
in_query: bool = False,
) -> Any:
if rng.randrange(100) == 0:
result = "1-01-01"
result = "0001-01-01"
elif rng.randrange(100) == 0:
result = "99999-12-31"
else:
result = f"{rng.randrange(1, 100000)}-{rng.randrange(1, 13)}-{rng.randrange(1, 29)}"
result = f"{rng.randrange(1, 100000):04}-{rng.randrange(1, 13)}-{rng.randrange(1, 29)}"
return f"DATE '{result}'" if in_query else result

@staticmethod
Expand Down Expand Up @@ -1099,8 +1099,8 @@ def random_value(
day2 = rng.randrange(1, 29)
bounds = rng.choice(["[)", "[]", "()", "(]"])
if in_query:
return f"daterange('{year1}-{month1}-{day1}'::date, '{year2}-{month2}-{day2}'::date, '{bounds}')"
return f"{bounds[0]}{year1}-{month1}-{day1},{year2}-{month2}-{day2}{bounds[1]}"
return f"daterange('{year1:04}-{month1}-{day1}'::date, '{year2:04}-{month2}-{day2}'::date, '{bounds}')"
return f"{bounds[0]}{year1:04}-{month1}-{day1},{year2:04}-{month2}-{day2}{bounds[1]}"

@staticmethod
def numeric_value(num: int, in_query: bool = False) -> Any:
Expand Down Expand Up @@ -1134,8 +1134,8 @@ def random_value(
day2 = rng.randrange(1, 29)
bounds = rng.choice(["[)", "[]", "()", "(]"])
if in_query:
return f"tsrange('{year1}-{month1}-{day1}'::timestamp, '{year2}-{month2}-{day2}'::timestamp, '{bounds}')"
return f"{bounds[0]}{year1}-{month1}-{day1},{year2}-{month2}-{day2}{bounds[1]}"
return f"tsrange('{year1:04}-{month1}-{day1}'::timestamp, '{year2:04}-{month2}-{day2}'::timestamp, '{bounds}')"
return f"{bounds[0]}{year1:04}-{month1}-{day1},{year2:04}-{month2}-{day2}{bounds[1]}"

@staticmethod
def numeric_value(num: int, in_query: bool = False) -> Any:
Expand Down Expand Up @@ -1169,8 +1169,8 @@ def random_value(
day2 = rng.randrange(1, 29)
bounds = rng.choice(["[)", "[]", "()", "(]"])
if in_query:
return f"tstzrange('{year1}-{month1}-{day1}'::timestamptz, '{year2}-{month2}-{day2}'::timestamptz, '{bounds}')"
return f"{bounds[0]}{year1}-{month1}-{day1},{year2}-{month2}-{day2}{bounds[1]}"
return f"tstzrange('{year1:04}-{month1}-{day1}'::timestamptz, '{year2:04}-{month2}-{day2}'::timestamptz, '{bounds}')"
return f"{bounds[0]}{year1:04}-{month1}-{day1},{year2:04}-{month2}-{day2}{bounds[1]}"

@staticmethod
def numeric_value(num: int, in_query: bool = False) -> Any:
Expand Down
Loading