The max filter takes two numeric arguments enclosed in parentheses. It returns the maximum of the two arguments:
  x=max(#Q #R)

The max filter matches a position if both its arguments match the position.


The max filter is used in queenpawnpinecho.cql. The filters there:
  L=lca(source target)
  max(distance(source L)
      distance(target L))>= 4
is used to make sure that either the position named source or the position named target are a distance of at least 4 from their latest common ancestor.