def sort_key()

in geneve/kql/optimizer.py [0:0]


    def sort_key(a, b):
        if isinstance(a, Value) and not isinstance(b, Value):
            return -1
        if not isinstance(a, Value) and isinstance(b, Value):
            return +1

        if isinstance(a, Value) and isinstance(b, Value):
            t_a = type(a)
            t_b = type(b)

            if t_a == t_b:
                return (a.value > b.value) - (a.value < b.value)
            else:
                return (t_a.__name__ > t_b.__name__) - (t_a.__name__ < t_b.__name__)

        else:
            # unable to compare
            return 0