internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: feast-dev/feast

Issue:
Support requested features on Postgresql online store
**Is your feature request related to a problem? Please describe.**
As a user, I want to retrieve subset of features on Postgresql online store instead of fetching all features

**Describe the solution you'd like**
Update online_read method to retrieve subset of features

**Additional context**
I'm close to creating a pull request for this issue myself.


Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/online_stores/contrib/postgres.py b/sdk/python/feast/infra/online_stores/contrib/postgres.py
--- a/sdk/python/feast/infra/online_stores/contrib/postgres.py
+++ b/sdk/python/feast/infra/online_stores/contrib/postgres.py
@@ -114,17 +114,30 @@ def online_read(
                     )
                 )
 
-            cur.execute(
-                sql.SQL(
-                    """
-                    SELECT entity_key, feature_name, value, event_ts
-                    FROM {} WHERE entity_key = ANY(%s);
-                    """
-                ).format(
-                    sql.Identifier(_table_id(project, table)),
-                ),
-                (keys,),
-            )
+            if not requested_features:
+                cur.execute(
+                    sql.SQL(
+                        """
+                        SELECT entity_key, feature_name, value, event_ts
+                        FROM {} WHERE entity_key = ANY(%s);
+                        """
+                    ).format(
+                        sql.Identifier(_table_id(project, table)),
+                    ),
+                    (keys,),
+                )
+            else:
+                cur.execute(
+                    sql.SQL(
+                        """
+                        SELECT entity_key, feature_name, value, event_ts
+                        FROM {} WHERE entity_key = ANY(%s) and feature_name = ANY(%s);
+                        """
+                    ).format(
+                        sql.Identifier(_table_id(project, table)),
+                    ),
+                    (keys, requested_features),
+                )
 
             rows = cur.fetchall()
 


Test patch:
Repository: feast-dev/feast

Issue:
Allow `snowflake-connector-python >= 2.7.8`
I have a project that uses both `snowpark-python` and `feast`, and this restriction by `feast` on `snowflake-connector-python<=2.7.8` is preventing an upgrade to `snowpark-python==0.10` which now requires `snowflake-connector-python>=2.7.12`.

I would like to know whether this requirement is still valid or whether it can be eased to allow newer versions of `snowflake-connector-python`.

https://github.com/feast-dev/feast/blob/769c31869eb8d9bb693f8a2876cc68b8cdd16521/setup.py#L99


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -96,7 +96,7 @@
 BYTEWAX_REQUIRED = ["bytewax==0.10.0", "docker>=5.0.2", "kubernetes<=20.13.0"]
 
 SNOWFLAKE_REQUIRED = [
-    "snowflake-connector-python[pandas]>=2.7.3,<=2.7.8",
+    "snowflake-connector-python[pandas]>=2.7.3,<3",
 ]
 
 SPARK_REQUIRED = [


Test patch:
Repository: feast-dev/feast

Issue:
Minimal Python version on PyPI seems to be too low
## Expected Behavior 

From what I can understand, the minimal version of Python to run Feast is 3.8; that's what I would expect on the PyPI page.

## Current Behavior

`Requires: Python >=3.7.0`

## Steps to reproduce

https://pypi.org/project/feast/



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -43,7 +43,7 @@
 DESCRIPTION = "Python SDK for Feast"
 URL = "https://github.com/feast-dev/feast"
 AUTHOR = "Feast"
-REQUIRES_PYTHON = ">=3.7.0"
+REQUIRES_PYTHON = ">=3.8.0"
 
 REQUIRED = [
     "click>=7.0.0,<9.0.0",


Test patch:
Repository: feast-dev/feast

Issue:
On-demand feature view cannot handle boolean Pandas native type
## Expected Behavior 
After applying some extra transformation steps within on-demand feature view decorator, the returned dataframe as Pandas DataFrame, which contains couple of `boolean` type columns (not `bool`). I was expecting type mapping mechanism can internally infer them as bool type also.

## Current Behavior
It throws exception right here [line 201](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/type_map.py#L201)

<img width="474" alt="image" src="https://user-images.githubusercontent.com/22145541/206345466-e257353b-9f5a-4465-b714-52ae602bbb68.png">

## Steps to reproduce
- Use on_demand_feature_view 
- transform the input dataframe and cast some columns as `boolean` type
- return immediately 
- apply the created on-demand view

### Specifications

- Version: 0.27.0
- Platform: Linux/AMD64
- Subsystem: Ubuntu

## Possible Solution
Simple add a `boolean` mapping below this [line](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/type_map.py#L149)



Discussion:

Resolving patch:
diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py
--- a/sdk/python/feast/type_map.py
+++ b/sdk/python/feast/type_map.py
@@ -147,6 +147,7 @@ def python_type_to_feast_value_type(
         "uint8": ValueType.INT32,
         "int8": ValueType.INT32,
         "bool": ValueType.BOOL,
+        "boolean": ValueType.BOOL,
         "timedelta": ValueType.UNIX_TIMESTAMP,
         "timestamp": ValueType.UNIX_TIMESTAMP,
         "datetime": ValueType.UNIX_TIMESTAMP,


Test patch:
Repository: feast-dev/feast

Issue:
sampled scalar value verification failure for 0 value if float is defined
## Expected Behavior 
Regardless of whether it is 0 or 0.0, conversion for int and float types must be performed.

## Current Behavior
It is defined as a float type, but if 0 is set other than 0.0, an [assert](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/type_map.py#L405) fail occurs.

## Steps to reproduce
If 0 is set in the BigQuery table that owns the float type, it may be recognized as an int when materializing using the feast sdk.

### Specifications

- Version: 0.27.1
- Platform: regardless
- Subsystem: regardless

## Possible Solution
If the value is set to 0, the assertion is modified so that it is not related to int or float.


Discussion:

Resolving patch:
diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py
--- a/sdk/python/feast/type_map.py
+++ b/sdk/python/feast/type_map.py
@@ -402,7 +402,12 @@ def _python_value_to_proto_value(
             valid_scalar_types,
         ) = PYTHON_SCALAR_VALUE_TYPE_TO_PROTO_VALUE[feast_value_type]
         if valid_scalar_types:
-            assert type(sample) in valid_scalar_types
+            if sample == 0 or sample == 0.0:
+                # Numpy convert 0 to int. However, in the feature view definition, the type of column may be a float.
+                # So, if value is 0, type validation must pass if scalar_types are either int or float.
+                assert type(sample) in [np.int64, int, np.float64, float]
+            else:
+                assert type(sample) in valid_scalar_types
         if feast_value_type == ValueType.BOOL:
             # ProtoValue does not support conversion of np.bool_ so we need to convert it to support np.bool_.
             return [


Test patch:
Repository: feast-dev/feast

Issue:
Add way to skip snowflake materialization query if no table changes occurred in materialization window
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.



Discussion:
https://docs.snowflake.com/en/sql-reference/functions/system_last_change_commit_time.html

Resolving patch:
diff --git a/sdk/python/feast/infra/materialization/snowflake_engine.py b/sdk/python/feast/infra/materialization/snowflake_engine.py
--- a/sdk/python/feast/infra/materialization/snowflake_engine.py
+++ b/sdk/python/feast/infra/materialization/snowflake_engine.py
@@ -8,6 +8,7 @@
 import pandas as pd
 from colorama import Fore, Style
 from pydantic import Field, StrictStr
+from pytz import utc
 from tqdm import tqdm
 
 import feast
@@ -256,6 +257,18 @@ def _materialize_one(
                 end_date=end_date,
             )
 
+            # Lets check and see if we can skip this query, because the table hasnt changed
+            # since before the start date of this query
+            with get_snowflake_conn(self.repo_config.offline_store) as conn:
+                query = f"""SELECT SYSTEM$LAST_CHANGE_COMMIT_TIME('{feature_view.batch_source.get_table_query_string()}') AS last_commit_change_time"""
+                last_commit_change_time = (
+                    conn.cursor().execute(query).fetchall()[0][0] / 1_000_000_000
+                )
+            if last_commit_change_time < start_date.astimezone(tz=utc).timestamp():
+                return SnowflakeMaterializationJob(
+                    job_id=job_id, status=MaterializationJobStatus.SUCCEEDED
+                )
+
             fv_latest_values_sql = offline_job.to_sql()
 
             if feature_view.batch_source.field_mapping is not None:


Test patch:
Repository: feast-dev/feast

Issue:
Job to infer schema from BigQuerySource with query not running on billing project id
## Expected Behavior 
when using BigQuery Batch source with the given query instead of table name, I suppose the schema would be inferred internally by executing jobs on billing project id (if provided).

## Current Behavior
The inference job is running on the attached project id with the current service account even when I provided specific billing project id.

## Steps to reproduce
1. Prepare a repo with provided billing project id (named A) which is different from the attached one (named B).
2. Create a BigQuerySource with query statements.
3. `feast apply`
4. Now check where the job running -> it's B

### Specifications

- Version: 0.27.1
- Platform: Linux
- Subsystem: Ubuntu

## Possible Solution
a few changes needed here [line 162](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/infra/offline_stores/bigquery_source.py#L162)



Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/offline_stores/bigquery.py b/sdk/python/feast/infra/offline_stores/bigquery.py
--- a/sdk/python/feast/infra/offline_stores/bigquery.py
+++ b/sdk/python/feast/infra/offline_stores/bigquery.py
@@ -44,9 +44,9 @@
 from feast.infra.registry.base_registry import BaseRegistry
 from feast.on_demand_feature_view import OnDemandFeatureView
 from feast.repo_config import FeastConfigBaseModel, RepoConfig
+from feast.saved_dataset import SavedDatasetStorage
+from feast.usage import get_user_agent, log_exceptions_and_usage
 
-from ...saved_dataset import SavedDatasetStorage
-from ...usage import get_user_agent, log_exceptions_and_usage
 from .bigquery_source import (
     BigQueryLoggingDestination,
     BigQuerySource,
diff --git a/sdk/python/feast/infra/offline_stores/bigquery_source.py b/sdk/python/feast/infra/offline_stores/bigquery_source.py
--- a/sdk/python/feast/infra/offline_stores/bigquery_source.py
+++ b/sdk/python/feast/infra/offline_stores/bigquery_source.py
@@ -15,8 +15,16 @@
 )
 from feast.repo_config import RepoConfig
 from feast.saved_dataset import SavedDatasetStorage
+from feast.usage import get_user_agent
 from feast.value_type import ValueType
 
+try:
+    from google.api_core import client_info as http_client_info
+except ImportError as e:
+    from feast.errors import FeastExtrasDependencyImportError
+
+    raise FeastExtrasDependencyImportError("gcp", str(e))
+
 
 @typechecked
 class BigQuerySource(DataSource):
@@ -159,7 +167,14 @@ def get_table_column_names_and_types(
     ) -> Iterable[Tuple[str, str]]:
         from google.cloud import bigquery
 
-        client = bigquery.Client()
+        project_id = (
+            config.offline_store.billing_project_id or config.offline_store.project_id
+        )
+        client = bigquery.Client(
+            project=project_id,
+            location=config.offline_store.location,
+            client_info=http_client_info.ClientInfo(user_agent=get_user_agent()),
+        )
         if self.table:
             schema = client.get_table(self.table).schema
             if not isinstance(schema[0], bigquery.schema.SchemaField):


Test patch:
Repository: feast-dev/feast

Issue:
schema has duplicate fields
## Expected Behavior 
feature_view.schema has no duplicate fields

## Current Behavior
feature_view.schema has no duplicate fields

## Steps to reproduce

### Specifications

- Version:
- Platform:
- Subsystem:

## Possible Solution

in feature_view:
```
    def schema(self) -> List[Field]:
        return list(set(self.entity_columns + self.features))
```



Discussion:
@hao-affirm would you mind sharing the feature view definition that led to duplicate fields shared between `self.entity_columns` and `self.features`?

I'm slightly surprised by that, since I thought our inference process would place each `Field` in either `self.entity_columns` or `self.features`, but not both
https://github.com/feast-dev/feast/blob/2f7c4ede8f9e66703714261f1152f78526d4bf43/sdk/python/feast/feature_view.py#L261
and https://github.com/feast-dev/feast/blob/2f7c4ede8f9e66703714261f1152f78526d4bf43/sdk/python/feast/feature_view.py#L171 i think both `entity_column` and `features` will append the `field`, if the field is defined in both `entities` and `schema`

Resolving patch:
diff --git a/sdk/python/feast/feature_view.py b/sdk/python/feast/feature_view.py
--- a/sdk/python/feast/feature_view.py
+++ b/sdk/python/feast/feature_view.py
@@ -259,7 +259,7 @@ def join_keys(self) -> List[str]:
 
     @property
     def schema(self) -> List[Field]:
-        return self.entity_columns + self.features
+        return list(set(self.entity_columns + self.features))
 
     def ensure_valid(self):
         """
diff --git a/sdk/python/feast/field.py b/sdk/python/feast/field.py
--- a/sdk/python/feast/field.py
+++ b/sdk/python/feast/field.py
@@ -30,11 +30,13 @@ class Field:
     Attributes:
         name: The name of the field.
         dtype: The type of the field, such as string or float.
-        tags (optional): User-defined metadata in dictionary form.
+        description: A human-readable description.
+        tags: User-defined metadata in dictionary form.
     """
 
     name: str
     dtype: FeastType
+    description: str
     tags: Dict[str, str]
 
     def __init__(
@@ -51,6 +53,7 @@ def __init__(
         Args:
             name: The name of the field.
             dtype: The type of the field, such as string or float.
+            description (optional): A human-readable description.
             tags (optional): User-defined metadata in dictionary form.
         """
         self.name = name
@@ -65,6 +68,7 @@ def __eq__(self, other):
         if (
             self.name != other.name
             or self.dtype != other.dtype
+            or self.description != other.description
             or self.tags != other.tags
         ):
             return False


Test patch:
Repository: feast-dev/feast

Issue:
Greate Expectations version a bit outdated
## Expected Behavior 
GX version works well with >=0.15.41

## Current Behavior
It got pinned between 0.14 and 0.15


### Specifications

- Version: 0.29.0

## Possible Solution
Bump GX version



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -127,7 +127,7 @@
     "cassandra-driver>=3.24.0,<4",
 ]
 
-GE_REQUIRED = ["great_expectations>=0.14.0,<0.15.0"]
+GE_REQUIRED = ["great_expectations>=0.15.41,<0.16.0"]
 
 GO_REQUIRED = [
     "cffi~=1.15.0",


Test patch:
Repository: feast-dev/feast

Issue:
Bytewax Image Pull Secrets Wrong Format
## Expected Behavior

Bytewax materializer uses a correctly configured list of image secrets to pull the job container on execution

## Current Behavior

Current configuration is a list of strings. Container scheduling fails to start because of an invalid generated job spec.

## Steps to reproduce

Configure Bytewax materialization engine with image pull secrets as list of strings, and run materialization. It'll fail.

### Specifications

- Version: 0.30.0
- Platform: Linux & EKS
- Subsystem: Python, Feast with Bytewax option enabled

## Possible Solution

The Bytewax materialization engine config needs to be configured with a `List[dict]` per Kubernetes configuration requirements. This will correctly schedule the materialization job and use the secrets to pull the job container from the registry.



Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py b/sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py
--- a/sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py
+++ b/sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py
@@ -46,7 +46,7 @@ class BytewaxMaterializationEngineConfig(FeastConfigBaseModel):
     These environment variables can be used to reference Kubernetes secrets.
     """
 
-    image_pull_secrets: List[str] = []
+    image_pull_secrets: List[dict] = []
     """ (optional) The secrets to use when pulling the image to run for the materialization job """
 
     resources: dict = {}
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -95,7 +95,7 @@
 
 AWS_REQUIRED = ["boto3>=1.17.0,<=1.20.23", "docker>=5.0.2", "s3fs>=0.4.0,<=2022.01.0"]
 
-BYTEWAX_REQUIRED = ["bytewax==0.13.1", "docker>=5.0.2", "kubernetes<=20.13.0"]
+BYTEWAX_REQUIRED = ["bytewax==0.15.1", "docker>=5.0.2", "kubernetes<=20.13.0"]
 
 SNOWFLAKE_REQUIRED = [
     "snowflake-connector-python[pandas]>=2.7.3,<3",


Test patch:
Repository: feast-dev/feast

Issue:
BigQuery: _upload_entity_df does not escape the table name
## Expected Behavior 

I expect `get_historical_features` to work even if the project name is not correctly detected by BigQuery without enclosing it in backtick.

## Current Behavior

Some project names can cause the `get_historical_features` to fail because the create statement in `_upload_entity_df` 
[code](https://github.com/feast-dev/feast/blob/09746aa14f5cb72e7b3f46d862d7afe8651ace7b/sdk/python/feast/infra/offline_stores/bigquery.py#L557)
```
job = client.query(f"CREATE TABLE {table_name} AS ({entity_df})")
```
does not enclose the `table_name` in backtick

We currently have the issue with a GCP project name that is suffixed by `-12c1`

The relevant error on BigQuery is
```
Syntax error: Missing whitespace between literal and alias at [1:28]
```

## Steps to reproduce
1. Create a GCP project with a suffix that must be backticked in BigQuery (e.g `dummy-project-12c1`)
2. Attempt to run a `get_historical_features` 

### Specifications

- Version: 0.22
- Platform: Linux
- Subsystem: Ubuntu 20.04

## Possible Solution

I think the best solution is to add the backticks around the `table_name`

```
job = client.query(f"CREATE TABLE `{table_name}` AS ({entity_df})")
```




Discussion:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


Resolving patch:
diff --git a/sdk/python/feast/infra/offline_stores/bigquery.py b/sdk/python/feast/infra/offline_stores/bigquery.py
--- a/sdk/python/feast/infra/offline_stores/bigquery.py
+++ b/sdk/python/feast/infra/offline_stores/bigquery.py
@@ -503,7 +503,7 @@ def to_bigquery(
                 temp_dest_table = f"{tmp_dest['projectId']}.{tmp_dest['datasetId']}.{tmp_dest['tableId']}"
 
                 # persist temp table
-                sql = f"CREATE TABLE {dest} AS SELECT * FROM {temp_dest_table}"
+                sql = f"CREATE TABLE `{dest}` AS SELECT * FROM {temp_dest_table}"
                 self._execute_query(sql, timeout=timeout)
 
             print(f"Done writing to '{dest}'.")
@@ -663,7 +663,7 @@ def _upload_entity_df(
     job: Union[bigquery.job.query.QueryJob, bigquery.job.load.LoadJob]
 
     if isinstance(entity_df, str):
-        job = client.query(f"CREATE TABLE {table_name} AS ({entity_df})")
+        job = client.query(f"CREATE TABLE `{table_name}` AS ({entity_df})")
 
     elif isinstance(entity_df, pd.DataFrame):
         # Drop the index so that we don't have unnecessary columns


Test patch:
Repository: feast-dev/feast

Issue:
to_remote_storage() resulting in undeleted temporary tables in Snowflake
## Expected Behavior 
When calling get_historical_features.to_remote_storage(), any temporary tables created in Snowflake are deleted after the Snowflake session ends.
## Current Behavior
When calling get_historical_features.to_remote_storage(), the temporary tables created during the join process are not deleted after the Snowflake session ends. These tables are set to a retention time of 1 day, but they are not deleted and still exist after 24 hours.

I tested this with `to_df()` and the above described issue does not occur. I also tried explicitly ending the session to make sure that wasn't the issue, but even after confirming the session was ended, the issue still persists.

## Steps to reproduce
1. For the FeatureStore object, set the RepoConfig offline store config to specify the following:
```json
{
     "blob_export_location": <s3_staging_url>,
     "storage_integration_name": <storage_integration>,
     "role": <stage_role>,
     "schema_": <stage_schema>,
}
```
2. Call `get_historical_features(entity_df=entity, features=features, full_feature_names=True).to_remote_storage()`
3. Check snowflake stage tables and look for tables created at the time of running that start with `temporary_`

### Specifications

- Version: 0.30.0
- Platform: Ubuntu
- Subsystem:

## Possible Solution
No possible solution known at the time of reporting


Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/offline_stores/snowflake.py b/sdk/python/feast/infra/offline_stores/snowflake.py
--- a/sdk/python/feast/infra/offline_stores/snowflake.py
+++ b/sdk/python/feast/infra/offline_stores/snowflake.py
@@ -556,7 +556,7 @@ def to_remote_storage(self) -> List[str]:
             )
 
         table = f"temporary_{uuid.uuid4().hex}"
-        self.to_snowflake(table)
+        self.to_snowflake(table, temporary=True)
 
         query = f"""
             COPY INTO '{self.export_path}/{table}' FROM "{self.config.offline_store.database}"."{self.config.offline_store.schema_}"."{table}"\n


Test patch: