Repository navigation
Closed
Labels
Description
Expected Behavior
Retrieving training data from an offline store that is BigQuery by using get_historical_features method from Python SDK.
Current Behavior
Getting this error when running get_historical_features:
Traceback (most recent call last):
File "get_offline_data.py", line 22, in <module>
"item_user_stats_v1:is_high_risk_seller",
File "/usr/local/lib/python3.7/site-packages/feast/infra/offline_stores/offline_store.py", line 77, in to_df
features_df = self._to_df_internal()
File "/usr/local/lib/python3.7/site-packages/feast/infra/offline_stores/bigquery.py", line 290, in _to_df_internal
df = self._execute_query(query).to_dataframe(create_bqstorage_client=True)
File "/usr/local/lib/python3.7/site-packages/feast/usage.py", line 280, in wrapper
raise exc.with_traceback(traceback)
File "/usr/local/lib/python3.7/site-packages/feast/usage.py", line 269, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/feast/infra/offline_stores/bigquery.py", line 357, in _execute_query
block_until_done(client=self.client, bq_job=bq_job, timeout=timeout)
File "/usr/local/lib/python3.7/site-packages/feast/infra/offline_stores/bigquery.py", line 415, in block_until_done
raise bq_job.exception()
google.api_core.exceptions.BadRequest: 400 No matching signature for operator <= for argument types: TIMESTAMP, DATETIME. Supported signature: ANY <= ANY at [78:13]The error happens on a query where it compares event timestamps (last line):
item_user_stats_v1__base AS (
SELECT
subquery.*,
entity_dataframe.entity_timestamp,
entity_dataframe.item_user_stats_v1__entity_row_unique_id
FROM item_user_stats_v1__subquery AS subquery
INNER JOIN item_user_stats_v1__entity_dataframe AS entity_dataframe
ON TRUE
AND subquery.event_timestamp <= entity_dataframe.entity_timestampSteps to reproduce
Use Feast project with GCP provider, where the offline store is BigQuery. After installing feast[gcp] (v0.19.4) packages you should get this google-cloud-bigquery==3.0.1 dependency version. I think it should brake also with newer versions of google-cloud-bigquery if it will be available.
Specifications
- Version: v0.19.4
- Platform: GCP
- Subsystem:
Possible Solution
Quick solution: add upper bound of <3.0.0 here.
A better solution: check what is causing this event timestamp type mismatch and fix it 😊 .
Activity
achals commentedon Apr 13, 2022
@KarolisKont could you also share your feature view definition and the schema of the offline store bigquery table?
KarolisKont commentedon Apr 13, 2022
Of course, I can @achals, but have one issue this Bigquery table has 109 fields 😅 . We don't use all fields in the feature view. So perhaps for you will be enough just those fields that are used feature view only?
Also perhaps forgot to mention that when I dropped the
google-cloud-bigqueryversion to under3.0.0Python SDK can returns offline data and jobs in BigQuery don't have errors.achals commentedon Apr 13, 2022
That's very interesting, yeah I just need the fields used in the feature view. Can you also provide the output of the table schema, after getting the table using the python API? Looking at this code snippet an example: https://googleapis.dev/python/bigquery/latest/usage/tables.html#getting-a-table
KarolisKont commentedon Apr 15, 2022
Sorry for the late response 😊 , but here is the info:
feature view definition:
In this feature view used entity definition:
In this feature view helper function to construct query:
This feature view schema from BigQuery UI:
The output of table schema using python API (
google-cloud-bigquery==3.0.1):The output of table schema using python API (
google-cloud-bigquery==2.34.2):KarolisKont commentedon Apr 16, 2022
OK seems that my proposed solution was valid for this particular issue. Thanks @achals 🙇