Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Error in BigQuery While Retrieving Columns that Start with a Number #4688

Closed
nishantgaurav-dev opened this issue Oct 25, 2024 · 1 comment · Fixed by #4713 or #4908
Closed

Comments

@nishantgaurav-dev
Copy link
Contributor

nishantgaurav-dev commented Oct 25, 2024

Expected Behavior

We have a feature view like this:

mbr_visits_fv_v1 = FeatureView(
	...
    schema=[
        Field(name="7_days_visits", dtype=Int64),
        Field(name="30_daysvisits", dtype=Int64),
    ],
    source=mbr_visits_bq_ds_v1
    ...
)

While querying this view as offline features I am expecting a data-frame containing desired columns without any error.

Current Behavior

Feast SDK is giving error like:
google.api_core.exceptions.BadRequest: 400 Syntax error: Missing whitespace between literal and alias at ...

I have printed some logs and observed that the generated BQ query contains a segment like this:

SELECT
  event_timestamp as event_timestamp,
  mbr_id AS mbr_id,
  7_days_visits as 7_days_visits
  30_days_visits as 30_days_visits
FROM `myproj.my_dataset.mbr_visits`
WHERE event_timestamp <= '2024-06-27T00:00:00'

This is incorrect BQ query.

It should be like this:

SELECT
  event_timestamp as event_timestamp,
  mbr_id AS mbr_id,
  `7_days_visits` as `7_days_visits`
  `30_days_visits` as `30_days_visits`
FROM `myproj.my_dataset.mbr_visits`
WHERE event_timestamp <= '2024-06-27T00:00:00'

The BQ expects that if a queried column starts with a number, the name should be enclosed in backtick (`) chars.

Steps to reproduce

Try querying a feature view with column name starting with number and use BigQuery data source.

Specifications

  • Version: 0.34.1
  • Platform: Mac
  • Subsystem:

Possible Solution

Enclose all the BQ column names with backtick (`) chars. It will reduce the readability a little bit, but won't cause any performance impact.

@nishantgaurav-dev nishantgaurav-dev changed the title Syntactically incorrect BQ query while retrieving columns with number in the begining. Syntax Error in BigQuery While Retrieving Columns that Start with a Number Oct 25, 2024
@tmihalac
Copy link
Contributor

"While querying this view as offline features I am expecting a data-frame containing desired columns without any error."
Can you also explain how did you query this view, which api and also a stack trace of the exception will be helpful

nishantgaurav-dev pushed a commit to nishantgaurav-dev/feast that referenced this issue Nov 12, 2024
nishantgaurav-dev added a commit to nishantgaurav-dev/feast that referenced this issue Nov 12, 2024
nishantgaurav-dev added a commit to nishantgaurav-dev/feast that referenced this issue Nov 12, 2024
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
Signed-off-by: Dharmisha Doshi <[email protected]>
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
Signed-off-by: Dharmisha Doshi <[email protected]>
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
Signed-off-by: Dharmisha Doshi <[email protected]>
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
Signed-off-by: Dharmisha Doshi <[email protected]>
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
Signed-off-by: Dharmisha Doshi <[email protected]>
dharmisha pushed a commit to nishantgaurav-dev/feast that referenced this issue Jan 15, 2025
Signed-off-by: Dharmisha Doshi <[email protected]>
franciscojavierarceo pushed a commit that referenced this issue Jan 19, 2025
… name starting with a number and BigQuery as data source (#4908)

* Fixing issue #4688

Signed-off-by: Dharmisha Doshi <[email protected]>

* Fixing issue #4688

Signed-off-by: Dharmisha Doshi <[email protected]>

* Fixing issue #4688

Signed-off-by: Dharmisha Doshi <[email protected]>

* resolving PEP 8 warnings

Signed-off-by: Dharmisha Doshi <[email protected]>

* resolving linting issues

Signed-off-by: Dharmisha Doshi <[email protected]>

---------

Signed-off-by: Dharmisha Doshi <[email protected]>
Co-authored-by: n0g0791 <[email protected]>
Co-authored-by: nishantgaurav-dev <[email protected]>
Co-authored-by: [email protected] <[email protected]>
tmihalac pushed a commit to opendatahub-io/feast that referenced this issue Jan 21, 2025
… name starting with a number and BigQuery as data source (feast-dev#4908)

* Fixing issue feast-dev#4688

Signed-off-by: Dharmisha Doshi <[email protected]>

* Fixing issue feast-dev#4688

Signed-off-by: Dharmisha Doshi <[email protected]>

* Fixing issue feast-dev#4688

Signed-off-by: Dharmisha Doshi <[email protected]>

* resolving PEP 8 warnings

Signed-off-by: Dharmisha Doshi <[email protected]>

* resolving linting issues

Signed-off-by: Dharmisha Doshi <[email protected]>

---------

Signed-off-by: Dharmisha Doshi <[email protected]>
Co-authored-by: n0g0791 <[email protected]>
Co-authored-by: nishantgaurav-dev <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment