'Extend this filter
@param query: a Query or S3ResourceQuery object
@param component: alias of the component the filter shall be
added to (None for master)
@param master: False to filter only component'

def add_filter(self, query, component=None, master=True):

    alias = None
    if (not master):
        if (not component):
            return
        if (component != self.resource.alias):
            alias = component
    if isinstance(query, S3ResourceQuery):
        self.transformed = None
        filters = self.filters
        cfilters = self.cfilters
        self.distinct |= query._joins(self.resource)[1]
    else:
        filters = self.queries
        cfilters = self.cqueries
    self.query = None
    if alias:
        if (alias in self.cfilters):
            cfilters[alias].append(query)
        else:
            cfilters[alias] = [query]
    else:
        filters.append(query)
    return
