Skip to content

Commit

Permalink
Raise exception when BQ_EXPORT_PARQUET_FILE_SIZE_MB is not a digit
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolisKont committed Nov 8, 2023
1 parent 2dd0bf9 commit 27bc435
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sdk/python/feast/infra/offline_stores/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,12 +574,19 @@ def to_remote_storage(self) -> List[str]:
table = self.to_bigquery()

parquet_file_size_mb = os.getenv("BQ_EXPORT_PARQUET_FILE_SIZE_MB")
if parquet_file_size_mb is not None and parquet_file_size_mb.isdigit():
if parquet_file_size_mb is not None:
if not parquet_file_size_mb.isdigit():
raise ValueError(
"The value for the BQ_EXPORT_PARQUET_FILE_SIZE_MB environment variable must "
"be a numeric digit, but it was set to: %s",
parquet_file_size_mb,
)

parquet_file_size_mb_int = int(parquet_file_size_mb)
if parquet_file_size_mb_int > 1000:
raise ValueError(
"The value for the BQ_EXPORT_PARQUET_FILE_SIZE_MB environment variable cannot "
"exceed 1000; however, it was set to %s.",
"exceed 1000; however, it was set to: %s.",
parquet_file_size_mb_int,
)

Expand Down

0 comments on commit 27bc435

Please sign in to comment.