The max filter takes two or more numeric or string arguments enclosed in parentheses. It returns the maximum of the arguments:
  x=max(#Q #R #B)
  y=max("pin" "mate")
  y  "pin"

The max filter matches a position if at least one of 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.