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

Temporarily disable multi-hop LinkableMetrics #1181

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,21 @@ def get_joinable_metrics_for_semantic_model(
f"last join path element: {using_join_path.last_semantic_model_reference.semantic_model_name}",
)
properties = properties.union(frozenset({LinkableElementProperty.MULTI_HOP}))
# Temp: diable multi-hop options for LinkableMetrics.
return LinkableElementSet()

path_key_to_linkable_metrics: Dict[ElementPathKey, Tuple[LinkableMetric, ...]] = {}
for entity_reference in [entity.reference for entity in semantic_model.entities]:
# Avoid creating an entity link cycle.
if using_join_path and entity_reference in using_join_path.entity_links:
continue
for metric_subquery_join_path_element in self._joinable_metrics_for_entities[entity_reference]:
# Temp: diable multi-hop options for LinkableMetrics.
if (
metric_subquery_join_path_element.metric_to_entity_join_path
or len(metric_subquery_join_path_element.entity_links) > 1
):
continue
linkable_metric = LinkableMetric(
properties=properties,
join_path=SemanticModelToMetricSubqueryJoinPath(
Expand Down Expand Up @@ -489,6 +497,8 @@ def _get_metric_time_elements(self, measure_reference: Optional[MeasureReference

def _get_joined_elements(self, measure_semantic_model: SemanticModel) -> LinkableElementSet:
"""Get the elements that can be generated by joining other models to the given model."""
metrics_linked_to_semantic_model = self.get_joinable_metrics_for_semantic_model(measure_semantic_model)

# Create single-hop elements
join_paths = []
for entity in measure_semantic_model.entities:
Expand Down Expand Up @@ -533,7 +543,9 @@ def _get_joined_elements(self, measure_semantic_model: SemanticModel) -> Linkabl
)
join_paths = new_join_paths

return LinkableElementSet.merge_by_path_key((single_hop_elements, multi_hop_elements))
return LinkableElementSet.merge_by_path_key(
(single_hop_elements, multi_hop_elements, metrics_linked_to_semantic_model)
)

def _get_linkable_element_set_for_measure(
self,
Expand All @@ -545,14 +557,12 @@ def _get_linkable_element_set_for_measure(
measure_semantic_model = self._get_semantic_model_for_measure(measure_reference)

elements_in_semantic_model = self._get_elements_in_semantic_model(measure_semantic_model)
metrics_linked_to_semantic_model = self.get_joinable_metrics_for_semantic_model(measure_semantic_model)
metric_time_elements = self._get_metric_time_elements(measure_reference)
joined_elements = self._get_joined_elements(measure_semantic_model)

return LinkableElementSet.merge_by_path_key(
(
elements_in_semantic_model,
metrics_linked_to_semantic_model,
metric_time_elements,
joined_elements,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,55 +120,6 @@
'listing__lux_booking_fraction_of_max_value',
'listing__lux_booking_value_rate_expr',
'listing__lux_listing',
'listing__lux_listing__active_listings',
'listing__lux_listing__approximate_continuous_booking_value_p99',
'listing__lux_listing__approximate_discrete_booking_value_p99',
'listing__lux_listing__average_booking_value',
'listing__lux_listing__average_instant_booking_value',
'listing__lux_listing__bookers',
'listing__lux_listing__booking_fees',
'listing__lux_listing__booking_fees_per_booker',
'listing__lux_listing__booking_payments',
'listing__lux_listing__booking_value',
'listing__lux_listing__booking_value_for_non_null_listing_id',
'listing__lux_listing__booking_value_p99',
'listing__lux_listing__booking_value_per_view',
'listing__lux_listing__booking_value_sub_instant',
'listing__lux_listing__booking_value_sub_instant_add_10',
'listing__lux_listing__bookings',
'listing__lux_listing__bookings_fill_nulls_with_0',
'listing__lux_listing__bookings_fill_nulls_with_0_without_time_spine',
'listing__lux_listing__bookings_join_to_time_spine',
'listing__lux_listing__bookings_per_booker',
'listing__lux_listing__bookings_per_dollar',
'listing__lux_listing__bookings_per_listing',
'listing__lux_listing__bookings_per_lux_listing_derived',
'listing__lux_listing__bookings_per_view',
'listing__lux_listing__derived_bookings_0',
'listing__lux_listing__derived_bookings_1',
'listing__lux_listing__discrete_booking_value_p99',
'listing__lux_listing__double_counted_delayed_bookings',
'listing__lux_listing__instant_booking_fraction_of_max_value',
'listing__lux_listing__instant_booking_value',
'listing__lux_listing__instant_booking_value_ratio',
'listing__lux_listing__instant_bookings',
'listing__lux_listing__instant_lux_booking_value_rate',
'listing__lux_listing__instant_plus_non_referred_bookings_pct',
'listing__lux_listing__largest_listing',
'listing__lux_listing__listings',
'listing__lux_listing__lux_booking_fraction_of_max_value',
'listing__lux_listing__lux_booking_value_rate_expr',
'listing__lux_listing__lux_listings',
'listing__lux_listing__max_booking_value',
'listing__lux_listing__median_booking_value',
'listing__lux_listing__min_booking_value',
'listing__lux_listing__nested_fill_nulls_without_time_spine',
'listing__lux_listing__non_referred_bookings_pct',
'listing__lux_listing__referred_bookings',
'listing__lux_listing__smallest_listing',
'listing__lux_listing__twice_bookings_fill_nulls_with_0_without_time_spine',
'listing__lux_listing__views',
'listing__lux_listing__views_times_booking_value',
'listing__lux_listings',
'listing__max_booking_value',
'listing__median_booking_value',
Expand Down Expand Up @@ -208,65 +159,6 @@
'user__account__user__total_account_balance_first_day',
'user__active_listings',
'user__company',
'user__company__active_listings',
'user__company__current_account_balance_by_user',
'user__company__identity_verifications',
'user__company__largest_listing',
'user__company__listing__user__company__approximate_continuous_booking_value_p99',
'user__company__listing__user__company__approximate_discrete_booking_value_p99',
'user__company__listing__user__company__average_booking_value',
'user__company__listing__user__company__average_instant_booking_value',
'user__company__listing__user__company__bookers',
'user__company__listing__user__company__booking_fees',
'user__company__listing__user__company__booking_fees_per_booker',
'user__company__listing__user__company__booking_payments',
'user__company__listing__user__company__booking_value',
'user__company__listing__user__company__booking_value_for_non_null_listing_id',
'user__company__listing__user__company__booking_value_p99',
'user__company__listing__user__company__booking_value_per_view',
'user__company__listing__user__company__booking_value_sub_instant',
'user__company__listing__user__company__booking_value_sub_instant_add_10',
'user__company__listing__user__company__bookings',
'user__company__listing__user__company__bookings_fill_nulls_with_0',
'user__company__listing__user__company__bookings_fill_nulls_with_0_without_time_spine',
'user__company__listing__user__company__bookings_join_to_time_spine',
'user__company__listing__user__company__bookings_per_booker',
'user__company__listing__user__company__bookings_per_dollar',
'user__company__listing__user__company__bookings_per_view',
'user__company__listing__user__company__derived_bookings_0',
'user__company__listing__user__company__derived_bookings_1',
'user__company__listing__user__company__discrete_booking_value_p99',
'user__company__listing__user__company__double_counted_delayed_bookings',
'user__company__listing__user__company__instant_booking_fraction_of_max_value',
'user__company__listing__user__company__instant_booking_value',
'user__company__listing__user__company__instant_booking_value_ratio',
'user__company__listing__user__company__instant_bookings',
'user__company__listing__user__company__instant_lux_booking_value_rate',
'user__company__listing__user__company__instant_plus_non_referred_bookings_pct',
'user__company__listing__user__company__lux_booking_fraction_of_max_value',
'user__company__listing__user__company__lux_booking_value_rate_expr',
'user__company__listing__user__company__max_booking_value',
'user__company__listing__user__company__median_booking_value',
'user__company__listing__user__company__min_booking_value',
'user__company__listing__user__company__nested_fill_nulls_without_time_spine',
'user__company__listing__user__company__non_referred_bookings_pct',
'user__company__listing__user__company__referred_bookings',
'user__company__listing__user__company__twice_bookings_fill_nulls_with_0_without_time_spine',
'user__company__listing__user__company__views',
'user__company__listing__user__company__views_times_booking_value',
'user__company__listings',
'user__company__lux_listings',
'user__company__regional_starting_balance_ratios',
'user__company__revenue',
'user__company__revenue_all_time',
'user__company__smallest_listing',
'user__company__total_account_balance_first_day',
'user__company__views',
'user__company__visit_buy_conversion_rate',
'user__company__visit_buy_conversion_rate_7days',
'user__company__visit_buy_conversion_rate_7days_fill_nulls_with_0',
'user__company__visit_buy_conversion_rate_by_session',
'user__company__visit_buy_conversions',
'user__company_name',
'user__created_at__day',
'user__created_at__extract_day',
Expand Down
Loading
Loading