class_docstr: Visits the SQL query plan to see if table aliases can be omitted when rendering column references.
class_docstr_tok: ["Visits","the","SQL","query","plan","to","see","if","table","aliases","can","be","omitted","when","rendering","column","references","."]
code: def visit_select_statement_node(
      self, node: SqlSelectStatementNode
  ) -> SqlQueryPlanNode:  # noqa: D
      # If there is only a single parent, no table aliases are required since there's no ambiguity.
      should_simplify_table_aliases = len(node.parent_nodes) <= 1
  
      if should_simplify_table_aliases:
          return SqlSelectStatementNode(
              description=node.description,
              select_columns=tuple(
                  SqlSelectColumn(
                      expr=x.expr.rewrite(
                          should_render_table_alias=False
                      ),
                      column_alias=x.column_alias,
                  )
                  for x in node.select_columns
              ),
              from_source=node.from_source.accept(self),
              from_source_alias=node.from_source_alias,
              joins_descs=(),
              group_bys=tuple(
                  SqlSelectColumn(
                      expr=x.expr.rewrite(
                          should_render_table_alias=False
                      ),
                      column_alias=x.column_alias,
                  )
                  for x in node.group_bys
              ),
              order_bys=tuple(
                  SqlOrderByDescription(
                      expr=x.expr.rewrite(
                          should_render_table_alias=False
                      ),
                      desc=x.desc,
                  )
                  for x in node.order_bys
              ),
              where=node.where.rewrite(should_render_table_alias=False)
              if node.where
              else None,
              limit=node.limit,
              distinct=node.distinct,
          )
  
      return SqlSelectStatementNode(
          description=node.description,
          select_columns=node.select_columns,
          from_source=node.from_source.accept(self),
          from_source_alias=node.from_source_alias,
          joins_descs=tuple(
              SqlJoinDescription(
                  right_source=x.right_source.accept(self),
                  right_source_alias=x.right_source_alias,
                  on_condition=x.on_condition,
                  join_type=x.join_type,
              )
              for x in node.join_descs
          ),
          group_bys=node.group_bys,
          order_bys=node.order_bys,
          where=node.where,
          limit=node.limit,
          distinct=node.distinct,
      )
  
file_path: metricflow/metricflow/sql/optimizer/table_alias_simplifier.py
imports: from __future__ import annotations
  import logging
  from metricflow.sql.optimizer.sql_query_plan_optimizer import SqlQueryPlanOptimizer
  from metricflow.sql.sql_plan import SqlJoinDescription, SqlOrderByDescription, SqlQueryPlanNode, SqlQueryPlanNodeVisitor, SqlSelectColumn, SqlSelectQueryFromClauseNode, SqlSelectStatementNode, SqlTableFromClauseNode
label_desc: Use image node_id 1 for calling the SqlTableAliasSimplifierVisitor obj's underlying member method code with example usage: obj.visit_select_statement_node(node) and returns: SqlSelectStatementNode, SqlSelectStatementNode