Integrating tquery into 1.65 branch