Brand new autocompleter for Hive and Impala

Brand new autocompleter for Hive and Impala

Greetings SQL experts!

To make your SQL editing experience better we’ve created a brand new autocompleter for Hue 3.11. The old one had some limitations and was only aware of parts of the statement being edited. The new autocompleter knows all the ins and outs of the Hive and Impala SQL dialects and will suggest keywords, functions, columns, tables, databases, etc. based on the structure of the statement and the position of the cursor.

The result is improved completion throughout. We now have completion for more than just SELECT statements, it will help you with the other DDL and DML statements too, INSERT, CREATE, ALTER, DROP etc.

Smart column suggestions

If multiple tables appear in the FROM clause, including derived and joined tables, it will merge the columns from all the tables and add the proper prefixes where needed. It also knows about your aliases, lateral views and complex types and will include those. It will now automatically backtick any reserved words or exotic column names where needed to prevent any mistakes.

Smart keyword completion

The new autocompleter suggests keywords based on where the cursor is positioned in the statement. Where possible it will even suggest more than one word at at time, like in the case of IF NOT EXISTS, no one likes to type too much right? In the parts where order matters but the keywords are optional, for instance after FROM tbl, it will list the keyword suggestions in the order they are expected with the first expected one on top. So after FROM tbl the WHERE keyword is listed above GROUP BY etc.

UDFs, what are the arguments for find_in_set?

The improved autocompleter will now suggest functions, for each function suggestion an additional panel is added in the autocomplete dropdown showing the documentation and the signature of the function. The autocompleter know about the expected types for the arguments and will only suggest the columns or functions that match the argument at the cursor position in the argument list.

Sub-queries, correlated or not

When editing subqueries it will only make suggestions within the scope of the subquery. For correlated subqueries the outside tables are also taken into account.

All about quality!

We’ve fine-tuned the live autocompletion for a better experience and we’ve introduced some options under the editor settings where you can turn off live autocompletion or disable the autocompleter altogether (if you’re adventurous). To access these settings open the editor and focus on the code area, press CTRL + , (or on Mac CMD + ,) and the settings will appear.

The autocompleter talks to the backend to get data for tables and databases etc. by default it will timeout after 5 seconds but once it has been fetched it’s cached for the next time around. The timeout can be adjusted in the Hue server configuration.

We’ve got an extensive test suite but not every possible statement is covered, if the autocompleter can’t interpret a statement it will be silent and no drop-down will appear. If you encounter a case where you think it should suggest something but doesn’t or if it gives incorrect suggestions then please let us know.

 

As usual you can send feedback and participate on the hue-user list or @gethue!

 

9 Comments

  1. 诸葛云峰 9 months ago

    Click on the search button in a short time, the button will be restored to the state of the query, rather than the state, and then the results will be in a very long time after the

  2. Ben Sullins 8 months ago

    What setting do you use to disable the autocomplete? I’m running into this bug and need to turn it off entirely – https://issues.cloudera.org/browse/HUE-4209

  3. Alex 7 months ago

    Hi,
    when i try to retrieve Hive tables and databases metadata from “Metastore Tablese” the connection to Hive Metastore hangs and i receive a timeout error and a “Problem accessing table metadata” error. I tried to increase the connection timeout in hue.ini but it don’t resolves the problem. Instead if i run Hive queries from Hive, Hive CLI or beeline or i try to retrieve metadata launching “show tables” and “show databases” commands from these tools all works fine. Any help?

    • Author
      Hue Team 7 months ago

      What do you see in the Hive logs?
      How many databases do you have? Is Hue pointing to the correct HiveServer2?
      Are you using some type of security?

      • Alex 7 months ago

        I have only one HiveServer2 on the same machine of Hue installation and I use Ranger as type of security.
        I think there’s a compatibility problem between Hue and HDP 2.5. Please see this thread:
        https://groups.google.com/a/cloudera.org/forum/#!topic/hue-user/r0GYwZbmlrY

        Thank you

        • Author
          Hue Team 7 months ago

          Something might be configured differently in Hive in HDP.

          To help restricting the possibilities, could you check if Hue 3.10 just works or not there?

  4. Yuvakumar 1 month ago

    Hi

    I am facing the same problem, and getting an error message “Problem accessing table metadata”, if I try to list tables in metastore. For all other users in the cluster, however it seems to work. Only for me it is not working? What could go wrong? Kindly suggest.

    Thanks

    • Author
      Hue Team 1 month ago

      What do you see in the /logs page of Hue after the error?

Leave a reply

Your email address will not be published. Required fields are marked *

*