code: def test_rewrite_order_by_with_a_join_in_parent(
      request: FixtureRequest,
      mf_test_session_state: MetricFlowTestSessionState,
      rewrite_order_by_statement: SqlSelectStatementNode,
  ) -> None:
      """Tests rewriting an order by when the parent has a join."""
      assert_default_rendered_sql_equal(
          request=request,
          mf_test_session_state=mf_test_session_state,
          sql_plan_node=rewrite_order_by_statement,
          plan_id="before_reducing",
      )
  
      sub_query_reducer = SqlSubQueryReducer()
  
      assert_default_rendered_sql_equal(
          request=request,
          mf_test_session_state=mf_test_session_state,
          sql_plan_node=sub_query_reducer.optimize(
              rewrite_order_by_statement
          ),
          plan_id="after_reducing",
      )
  
file_path: metricflow/metricflow/test/sql/optimizer/test_sub_query_reducer.py
imports: from __future__ import annotations
  import pytest
  from _pytest.fixtures import FixtureRequest
  from metricflow.dataflow.sql_table import SqlTable
  from metricflow.sql.optimizer.sub_query_reducer import SqlSubQueryReducer
  from metricflow.sql.sql_exprs import SqlColumnReference, SqlColumnReferenceExpression, SqlComparison, SqlComparisonExpression
  from metricflow.sql.sql_plan import SqlJoinDescription, SqlJoinType, SqlOrderByDescription, SqlSelectColumn, SqlSelectStatementNode, SqlTableFromClauseNode
  from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState
  from metricflow.test.sql.compare_sql_plan import assert_default_rendered_sql_equal
label_desc: Use image node_id 4 for calling a global function with example usage: test_rewrite_order_by_with_a_join_in_parent(request, mf_test_session_state, rewrite_order_by_statement) without return types