Skip to content

Commit

Permalink
Update dataflow to SQL plan for FilterElementsNode
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Oct 11, 2023
1 parent a1afcbb commit 4f0d5d2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions metricflow/plan_conversion/dataflow_to_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,18 +797,22 @@ def visit_pass_elements_filter_node(self, node: FilterElementsNode) -> SqlDataSe
# Also, the output columns should always follow the resolver format.
output_instance_set = output_instance_set.transform(ChangeAssociatedColumns(self._column_association_resolver))

# This creates select expressions for all columns referenced in the instance set.
select_columns = output_instance_set.transform(
CreateSelectColumnsForInstances(from_data_set_alias, self._column_association_resolver)
).as_tuple()

# If distinct values requested, group by all select columns.
group_bys = select_columns if node.distinct else ()
return SqlDataSet(
instance_set=output_instance_set,
sql_select_node=SqlSelectStatementNode(
description=node.description,
# This creates select expressions for all columns referenced in the instance set.
select_columns=output_instance_set.transform(
CreateSelectColumnsForInstances(from_data_set_alias, self._column_association_resolver)
).as_tuple(),
select_columns=select_columns,
from_source=from_data_set.sql_select_node,
from_source_alias=from_data_set_alias,
joins_descs=(),
group_bys=(),
group_bys=group_bys,
where=None,
order_bys=(),
),
Expand Down

0 comments on commit 4f0d5d2

Please sign in to comment.