Skip to content

Commit

Permalink
fix: Allow trancated timestamps when converting (#3861)
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-park authored Jan 19, 2024
1 parent 8f65fe1 commit bdd7dfb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions sdk/python/feast/infra/offline_stores/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ def write_logged_features(
# In Pyarrow v13.0, the parquet version was upgraded to v2.6 from v2.4.
# Set the coerce_timestamps to "us"(microseconds) for backward compatibility.
pyarrow.parquet.write_table(
table=data, where=parquet_temp_file, coerce_timestamps="us"
table=data,
where=parquet_temp_file,
coerce_timestamps="us",
allow_truncated_timestamps=True,
)

parquet_temp_file.seek(0)
Expand Down Expand Up @@ -407,7 +410,10 @@ def offline_write_batch(
# In Pyarrow v13.0, the parquet version was upgraded to v2.6 from v2.4.
# Set the coerce_timestamps to "us"(microseconds) for backward compatibility.
pyarrow.parquet.write_table(
table=table, where=parquet_temp_file, coerce_timestamps="us"
table=table,
where=parquet_temp_file,
coerce_timestamps="us",
allow_truncated_timestamps=True,
)

parquet_temp_file.seek(0)
Expand Down
7 changes: 6 additions & 1 deletion sdk/python/feast/infra/utils/aws_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,12 @@ def upload_arrow_table_to_redshift(
with tempfile.TemporaryFile(suffix=".parquet") as parquet_temp_file:
# In Pyarrow v13.0, the parquet version was upgraded to v2.6 from v2.4.
# Set the coerce_timestamps to "us"(microseconds) for backward compatibility.
pq.write_table(table, parquet_temp_file, coerce_timestamps="us")
pq.write_table(
table,
parquet_temp_file,
coerce_timestamps="us",
allow_truncated_timestamps=True,
)
parquet_temp_file.seek(0)
s3_resource.Object(bucket, key).put(Body=parquet_temp_file)

Expand Down

0 comments on commit bdd7dfb

Please sign in to comment.