Fix bug for query if the partitioning key is varchar