@@ -51,7 +51,6 @@ def test_online_store_config_default():
51
51
assert dynamodb_store_config .batch_size == 40
52
52
assert dynamodb_store_config .endpoint_url is None
53
53
assert dynamodb_store_config .region == aws_region
54
- assert dynamodb_store_config .sort_response is True
55
54
assert dynamodb_store_config .table_name_template == "{project}.{table_name}"
56
55
57
56
@@ -72,20 +71,17 @@ def test_online_store_config_custom_params():
72
71
aws_region = "us-west-2"
73
72
batch_size = 20
74
73
endpoint_url = "http://localhost:8000"
75
- sort_response = False
76
74
table_name_template = "feast_test.dynamodb_table"
77
75
dynamodb_store_config = DynamoDBOnlineStoreConfig (
78
76
region = aws_region ,
79
77
batch_size = batch_size ,
80
78
endpoint_url = endpoint_url ,
81
- sort_response = sort_response ,
82
79
table_name_template = table_name_template ,
83
80
)
84
81
assert dynamodb_store_config .type == "dynamodb"
85
82
assert dynamodb_store_config .batch_size == batch_size
86
83
assert dynamodb_store_config .endpoint_url == endpoint_url
87
84
assert dynamodb_store_config .region == aws_region
88
- assert dynamodb_store_config .sort_response == sort_response
89
85
assert dynamodb_store_config .table_name_template == table_name_template
90
86
91
87
@@ -186,23 +182,31 @@ def test_online_read_unknown_entity(repo_config):
186
182
_insert_data_test_table (data , PROJECT , f"{ TABLE_NAME } _{ n_samples } " , REGION )
187
183
188
184
entity_keys , features , * rest = zip (* data )
189
- # Append a nonsensical value
185
+ # Append a nonsensical entity to search for
190
186
entity_keys = list (entity_keys )
191
- entity_keys .append (
192
- EntityKeyProto (
193
- join_keys = ["customer" ], entity_values = [ValueProto (string_val = "12359" )]
194
- )
195
- )
196
187
features = list (features )
197
- features .append (None )
198
188
dynamodb_store = DynamoDBOnlineStore ()
199
- returned_items = dynamodb_store .online_read (
200
- config = repo_config ,
201
- table = MockFeatureView (name = f"{ TABLE_NAME } _{ n_samples } " ),
202
- entity_keys = entity_keys ,
203
- )
204
- assert len (returned_items ) == len (entity_keys )
205
- assert [item [1 ] for item in returned_items ] == list (features )
189
+
190
+ # Have the unknown entity be in the beginning, middle, and end of the list of entities.
191
+ for pos in range (len (entity_keys )):
192
+ entity_keys_with_unknown = deepcopy (entity_keys )
193
+ entity_keys_with_unknown .insert (
194
+ pos ,
195
+ EntityKeyProto (
196
+ join_keys = ["customer" ], entity_values = [ValueProto (string_val = "12359" )]
197
+ ),
198
+ )
199
+ features_with_none = deepcopy (features )
200
+ features_with_none .insert (pos , None )
201
+ returned_items = dynamodb_store .online_read (
202
+ config = repo_config ,
203
+ table = MockFeatureView (name = f"{ TABLE_NAME } _{ n_samples } " ),
204
+ entity_keys = entity_keys_with_unknown ,
205
+ )
206
+ assert len (returned_items ) == len (entity_keys_with_unknown )
207
+ assert [item [1 ] for item in returned_items ] == list (features_with_none )
208
+ # The order should match the original entity key order
209
+ assert returned_items [pos ] == (None , None )
206
210
207
211
208
212
@mock_dynamodb2
0 commit comments