示例#1
0
    def visit_select(self, statement: AbstractStatement):
        """convertor for select statement

        Arguments:
            statement {AbstractStatement} -- [input select statement]
        """
        # Create a logical get node
        video = statement.from_table
        if video is not None:
            self.visit_table_ref(video)

        # Filter Operator
        predicate = statement.where_clause
        if predicate is not None:
            # Binding the expression
            bind_predicate_expr(predicate)
            filter_opr = LogicalFilter(predicate)
            filter_opr.append_child(self._plan)
            self._plan = filter_opr

        # Projection operator
        select_columns = statement.target_list

        # ToDO
        # add support for SELECT STAR
        if select_columns is not None:
            # Bind the columns using catalog
            bind_columns_expr(select_columns)
            projection_opr = LogicalProject(select_columns)
            projection_opr.append_child(self._plan)
            self._plan = projection_opr
 def _visit_select_predicate(self, predicate: AbstractExpression):
     # Binding the expression
     bind_predicate_expr(predicate, self._column_map)
     filter_opr = LogicalFilter(predicate)
     filter_opr.append_child(self._plan)
     self._plan = filter_opr