Corrected compiler warnings
MODE-1738 Corrected query processing that involves ORDER BY

Queries that selected a subset of columns and that used ORDER BY
clauses on those columns produced IndexOutOfBoundsException. The
QueryResultColumn code was corrected to eliminate this error.

Several tests were first added to replicate the problem and to then
verify the change does fix the problem.