Пример #1
0
    def _get_window(self):
        if self._window is None:
            groups = self.by
            sorts = self._order_by
            preceding, following = None, None
        else:
            w = self._window
            groups = w.group_by + self.by
            sorts = w.order_by + self._order_by
            preceding, following = w.preceding, w.following

        sorts = [ops.to_sort_key(self.table, k) for k in sorts]

        return _window.window(preceding=preceding, following=following,
                              group_by=groups, order_by=sorts)
Пример #2
0
    def _get_window(self):
        if self._window is None:
            groups = self.by
            sorts = self._order_by
            preceding, following = None, None
        else:
            w = self._window
            groups = w.group_by + self.by
            sorts = w.order_by + self._order_by
            preceding, following = w.preceding, w.following

        sorts = [ops.to_sort_key(self.table, k) for k in sorts]

        return _window.window(preceding=preceding,
                              following=following,
                              group_by=groups,
                              order_by=sorts)
Пример #3
0
 def bind(self, table):
     # Internal API, ensure that any unresolved expr references (as strings,
     # say) are bound to the table being windowed
     groups = table._resolve(self._group_by)
     sorts = [ops.to_sort_key(table, k) for k in self._order_by]
     return self._replace(group_by=groups, order_by=sorts)
Пример #4
0
 def bind(self, table):
     # Internal API, ensure that any unresolved expr references (as strings,
     # say) are bound to the table being windowed
     groups = table._resolve(self._group_by)
     sorts = [ops.to_sort_key(table, k) for k in self._order_by]
     return self._replace(group_by=groups, order_by=sorts)