'Order of the columns in Apache Zeppelin when selecting the data from the temprorary table is wrong, how to put specific column first?

Currently we have the scala DataFrame output with id value shown first (but it is chronologically added to the DataFrame last). Other columns appears dynamically based on .pivot() function and the data.

When I call for the data in %sql interpreter, the order is changing, thus making CSV file that I download also have id column as the last one, that doesn't work for me. I can't just write the selection script at once with putting the id column at the first point manually, as I can't control other columns because of pivot. Is there any other way to make specific column go first?

enter image description here

The Scala paragraph is:

resultMean.registerTempTable("mean")  

The sql paragraph is:

%sql
select  *
from mean


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source