The Trino CLI provides a terminal-based, interactive shell for running queries. We can use it to connect Kyuubi server now.

Start Kyuubi Trino Server

First we should configure the trino protocol and the service port in the kyuubi-defaults.conf

  1. kyuubi.frontend.protocols TRINO
  2. kyuubi.frontend.trino.bind.port 10999 #default port

Install

Download trino-cli-411-executable.jar, rename it to trino, make it executable with chmod +x, and run it to show the version of the CLI:

  1. wget https://repo1.maven.org/maven2/io/trino/trino-jdbc/411/trino-jdbc-411.jar
  2. mv trino-jdbc-411.jar trino
  3. chmod +x trino
  4. ./trino --version

Running the CLI

The minimal command to start the CLI in interactive mode specifies the URL of the kyuubi server with the Trino protocol:

  1. ./trino --server http://localhost:10999

If successful, you will get a prompt to execute commands. Use the help command to see a list of supported commands. Use the clear command to clear the terminal. To stop and exit the CLI, run exit or quit.:

  1. trino> help
  2. Supported commands:
  3. QUIT
  4. EXIT
  5. CLEAR
  6. EXPLAIN [ ( option [, ...] ) ] <query>
  7. options: FORMAT { TEXT | GRAPHVIZ | JSON }
  8. TYPE { LOGICAL | DISTRIBUTED | VALIDATE | IO }
  9. DESCRIBE <table>
  10. SHOW COLUMNS FROM <table>
  11. SHOW FUNCTIONS
  12. SHOW CATALOGS [LIKE <pattern>]
  13. SHOW SCHEMAS [FROM <catalog>] [LIKE <pattern>]
  14. SHOW TABLES [FROM <schema>] [LIKE <pattern>]
  15. USE [<catalog>.]<schema>

You can now run SQL statements. After processing, the CLI will show results and statistics.

  1. trino> select 1;
  2. _col0
  3. -------
  4. 1
  5. (1 row)
  6. Query 20230216_125233_00806_examine_6hxus, FINISHED, 1 node
  7. Splits: 1 total, 1 done (100.00%)
  8. 0.29 [0 rows, 0B] [0 rows/s, 0B/s]
  9. trino>

Many other options are available to further configure the CLI in interactive mode to refer https://trino.io/docs/current/client/cli.html#running-the-cli