|
92 | 92 | FEATURE_GROUP_OCID_3 = "ocid1.featuregroup1.oc1.iad.xxx"
|
93 | 93 |
|
94 | 94 | FEATURE_GROUP_PAYLOAD_3 = {
|
95 |
| - "id": FEATURE_GROUP_OCID_2, |
| 95 | + "id": FEATURE_GROUP_OCID_3, |
96 | 96 | "name": "feature_group3",
|
97 | 97 | "entityId": "ocid1.entity.oc1.iad.xxx",
|
98 | 98 | "description": "feature group description",
|
|
111 | 111 | {
|
112 | 112 | "featureType": "STRING",
|
113 | 113 | "name": "X",
|
114 |
| - "featureGroupId": FEATURE_GROUP_OCID_2, |
| 114 | + "featureGroupId": FEATURE_GROUP_OCID_3, |
115 | 115 | },
|
116 | 116 | {
|
117 | 117 | "featureType": "STRING",
|
118 | 118 | "name": "Y",
|
119 |
| - "featureGroupId": FEATURE_GROUP_OCID_2, |
| 119 | + "featureGroupId": FEATURE_GROUP_OCID_3, |
120 | 120 | },
|
121 | 121 | {
|
122 | 122 | "featureType": "STRING",
|
123 | 123 | "name": "Z",
|
124 |
| - "featureGroupId": FEATURE_GROUP_OCID_2, |
| 124 | + "featureGroupId": FEATURE_GROUP_OCID_3, |
125 | 125 | },
|
126 | 126 | ],
|
127 | 127 | },
|
@@ -277,42 +277,41 @@ def test_select_subset_and_multi_join_query(
|
277 | 277 | self, spark_session, get_spark_session, mock_feature_store
|
278 | 278 | ):
|
279 | 279 | """Tests with select and join query."""
|
280 |
| - with pytest.raises( |
281 |
| - ValueError, |
282 |
| - match="Cannot join feature group '" + self.mock_dsc_feature_group_1.name + "' on 'X', as it is not present " |
283 |
| - "in the feature group. "): |
284 |
| - dsc_query = ( |
285 |
| - Query( |
286 |
| - left_feature_group=self.mock_dsc_feature_group_1, |
287 |
| - left_features=["cc_num", "provider"], |
288 |
| - feature_store_id=self.feature_store_id, |
289 |
| - entity_id=self.entity_id, |
290 |
| - ) |
291 |
| - .join( |
292 |
| - Query( |
293 |
| - left_feature_group=self.mock_dsc_feature_group_2, |
294 |
| - left_features=["cc_num", "provider"], |
295 |
| - feature_store_id=self.feature_store_id, |
296 |
| - entity_id=self.entity_id, |
297 |
| - ), |
298 |
| - on=["cc_num"], |
299 |
| - ) |
300 |
| - .join( |
301 |
| - Query( |
302 |
| - left_feature_group=self.mock_dsc_feature_group_3, |
303 |
| - left_features=["X", "Y"], |
304 |
| - feature_store_id=self.feature_store_id, |
305 |
| - entity_id=self.entity_id, |
306 |
| - ), |
307 |
| - on=["X"], |
308 |
| - ) |
| 280 | + dsc_query = ( |
| 281 | + Query( |
| 282 | + left_feature_group=self.mock_dsc_feature_group_1, |
| 283 | + left_features=["cc_num", "provider"], |
| 284 | + feature_store_id=self.feature_store_id, |
| 285 | + entity_id=self.entity_id, |
| 286 | + ) |
| 287 | + .join( |
| 288 | + Query( |
| 289 | + left_feature_group=self.mock_dsc_feature_group_2, |
| 290 | + left_features=["cc_num", "provider"], |
| 291 | + feature_store_id=self.feature_store_id, |
| 292 | + entity_id=self.entity_id, |
| 293 | + ), |
| 294 | + on=["cc_num"], |
| 295 | + ) |
| 296 | + .join( |
| 297 | + Query( |
| 298 | + left_feature_group=self.mock_dsc_feature_group_3, |
| 299 | + left_features=["X", "Y"], |
| 300 | + feature_store_id=self.feature_store_id, |
| 301 | + entity_id=self.entity_id, |
| 302 | + ), |
| 303 | + left_on=["cc_num"], |
| 304 | + right_on=["X"] |
| 305 | + ) |
| 306 | + ) |
| 307 | + assert dsc_query.to_string() == ( |
| 308 | + "SELECT fg_2.cc_num cc_num, fg_2.provider provider, fg_1.X X, fg_1.Y Y " |
| 309 | + "FROM `ocid1.entity.oc1.iad.xxx`.feature_group1 fg_2 " |
| 310 | + "INNER JOIN `ocid1.entity.oc1.iad.xxx`.feature_group2 fg_0 " |
| 311 | + "ON fg_2.cc_num = fg_0.cc_num " |
| 312 | + "INNER JOIN `ocid1.entity.oc1.iad.xxx`.feature_group3 fg_1 " |
| 313 | + "ON fg_0.cc_num = fg_1.X" |
309 | 314 | )
|
310 |
| - # TODO(fixme): Query not nesting all feature groups |
311 |
| - # assert dsc_query.to_string() == ( |
312 |
| - # "SELECT fg_2.cc_num cc_num, fg_2.provider provider, fg_1.X X, fg_1.Y Y FROM " |
313 |
| - # "`ocid1.entity.oc1.iad.xxx`.feature_group1 fg_2 INNER JOIN " |
314 |
| - # "`ocid1.entity.oc1.iad.xxx`.feature_group3 fg_1 ON fg_2.X = fg_1.X" |
315 |
| - # ) |
316 | 315 |
|
317 | 316 | @patch.object(SparkSessionSingleton, "get_spark_session")
|
318 | 317 | @patch.object(FeatureStore, "from_id")
|
|
0 commit comments