Пример #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
Пример #2
0
 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
Пример #3
0
 def test_bind_predicate_calls_bind_func_expr_if_type_functional(
         self, mock_bind):
     func_expr = FunctionExpression(None, name='temp')
     bind_predicate_expr(func_expr, {})
     mock_bind.assert_called_with(func_expr, {})