Skip to content
Merged
Prev Previous commit
Next Next commit
fix test
Signed-off-by: HaoXuAI <sduxuhao@gmail.com>
  • Loading branch information
HaoXuAI committed Apr 18, 2025
commit 4765d8fd544bf475b71c536b3e72e6734bd9aec8
14 changes: 5 additions & 9 deletions sdk/python/feast/infra/offline_stores/offline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,12 @@ def format_casted_ts(val: Union[str, datetime]) -> str:
if isinstance(val, datetime):
if tz:
val = val.astimezone(tz)
val_str = val.isoformat()
else:
val_str = val

if cast_style == "timestamp_func":
return f"TIMESTAMP('{val_str}')"
return f"TIMESTAMP('{val}')"
elif cast_style == "timestamptz":
return f"'{val_str}'::timestamptz"
else: # raw
return f"'{val_str}'"
return f"'{val}'::timestamptz"
else:
return f"'{val}'"

def format_date(val: Union[str, datetime]) -> str:
if isinstance(val, datetime):
Expand All @@ -321,7 +317,7 @@ def format_date(val: Union[str, datetime]) -> str:
# Timestamp filters
if start_date and end_date:
filters.append(
f"{timestamp_field} BETWEEN {format_casted_ts(start_date)} AND {format_casted_ts(end_date)}"
f'"{timestamp_field}" BETWEEN {format_casted_ts(start_date)} AND {format_casted_ts(end_date)}'
)
elif start_date:
filters.append(f"{timestamp_field} >= {format_casted_ts(start_date)}")
Expand Down
Loading