Validates that there are no collisions among the feature references. Args: feature_refs: List of feature references to validate. Feature references must have format "feature_view:feature", e.g. "customer_fv:daily_transactions". full_feature_names: If True, the f
(feature_refs: List[str], full_feature_names: bool = False)
| 559 | |
| 560 | |
| 561 | def _validate_feature_refs(feature_refs: List[str], full_feature_names: bool = False): |
| 562 | """ |
| 563 | Validates that there are no collisions among the feature references. |
| 564 | |
| 565 | Args: |
| 566 | feature_refs: List of feature references to validate. Feature references must have format |
| 567 | "feature_view:feature", e.g. "customer_fv:daily_transactions". |
| 568 | full_feature_names: If True, the full feature references are compared for collisions; if False, |
| 569 | only the feature names are compared. |
| 570 | |
| 571 | Raises: |
| 572 | FeatureNameCollisionError: There is a collision among the feature references. |
| 573 | """ |
| 574 | collided_feature_refs = [] |
| 575 | |
| 576 | if full_feature_names: |
| 577 | collided_feature_refs = [ |
| 578 | ref for ref, occurrences in Counter(feature_refs).items() if occurrences > 1 |
| 579 | ] |
| 580 | else: |
| 581 | feature_names = [_parse_feature_ref(ref)[2] for ref in feature_refs] |
| 582 | collided_feature_names = [ |
| 583 | ref |
| 584 | for ref, occurrences in Counter(feature_names).items() |
| 585 | if occurrences > 1 |
| 586 | ] |
| 587 | |
| 588 | for feature_name in collided_feature_names: |
| 589 | collided_feature_refs.extend( |
| 590 | [ref for ref in feature_refs if ref.endswith(":" + feature_name)] |
| 591 | ) |
| 592 | |
| 593 | if len(collided_feature_refs) > 0: |
| 594 | raise FeatureNameCollisionError(collided_feature_refs, full_feature_names) |
| 595 | |
| 596 | |
| 597 | def _group_feature_refs( |