Hello,
Here is a more robust way to do it:
Romain
And the official version https://gethue.com/blog/querying-spark-sql-with-spark-thrift-server-and-hue-editor/