[MONDRIAN-1512] Correcting the inline SQL used by Impala.

 (cherry picked from commit 2d37427)