Skip to content

Commit 0ee5371

Browse files
hddongyaooqinn
authored andcommitted
[KYUUBI #2243][DOCS] Add quick start for trino engine
### _Why are the changes needed?_ Add quick start for trino engine ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2265 from hddong/trino-quick-start. Closes #2243 fc4c274 [hongdongdong] [KYUUBI #2243] Add quick start for trino engine Authored-by: hongdongdong <hongdongdong@cmss.chinamobile.com> Signed-off-by: Kent Yao <yao@apache.org>
1 parent 6bd9edf commit 0ee5371

File tree

2 files changed

+73
-5
lines changed

2 files changed

+73
-5
lines changed

docs/imgs/trino/trino-query-page.png

130 KB
Loading

docs/quick_start/quick_start.md

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ Components| Role | Optional | Version | Remarks
4444
Java | Java<br>Runtime<br>Environment | Required | Java 8/11 | Kyuubi is pre-built with Java 8
4545
Spark | Distributed<br>SQL<br>Engine | Optional | 3.0.0 and above | By default Kyuubi binary release is delivered without<br> a Spark tarball.
4646
Flink | Distributed<br>SQL<br>Engine | Optional | 1.14.0 and above | By default Kyuubi binary release is delivered without<br> a Flink tarball.
47+
Trino | Distributed<br>SQL<br>Engine | Optional | 363 and above | By default Kyuubi binary release is delivered without<br> a Trino tarball.
4748
HDFS | Distributed<br>File<br>System | Optional | referenced<br>by<br>Spark | Hadoop Distributed File System is a <br>part of Hadoop framework, used to<br> store and process the datasets.<br> You can interact with any<br> Spark-compatible versions of HDFS.
4849
Hive | Metastore | Optional | referenced<br>by<br>Spark | Hive Metastore for Spark SQL to connect
4950
Zookeeper | Service<br>Discovery | Optional | Any<br>zookeeper<br>ensemble<br>compatible<br>with<br>curator(2.12.0) | By default, Kyuubi provides a<br> embedded Zookeeper server inside for<br> non-production use.
5051

51-
Additionally, if you want to work with other Spark/Flink compatible systems or plugins, you only need to take care of them as using them with regular Spark/Flink applications.
52-
For example, you can run Spark/Flink SQL engines created by the Kyuubi on any cluster manager, including YARN, Kubernetes, Mesos, e.t.c...
52+
Additionally, if you want to work with other Spark/Flink/Trino compatible systems or plugins, you only need to take care of them as using them with regular Spark/Flink/Trino applications.
53+
For example, you can run Spark/Flink/Trino SQL engines created by the Kyuubi on any cluster manager, including YARN, Kubernetes, Mesos, e.t.c...
5354
Or, you can manipulate data from different data sources with the Spark Datasource/Flink Table API, e.g. Delta Lake, Apache Hudi, Apache Iceberg, Apache Kudu and e.t.c...
5455

5556
## Installation
@@ -99,7 +100,7 @@ From top to bottom are:
99100
- bin: the entry of the Kyuubi server with `kyuubi` as the startup script.
100101
- conf: all the defaults used by Kyuubi Server itself or creating a session with Spark applications.
101102
- externals
102-
- engines: contains all kinds of SQL engines that we support, e.g. Apache Spark, Apache Flink, Trino(coming soon).
103+
- engines: contains all kinds of SQL engines that we support, e.g. Apache Spark, Apache Flink, Trino.
103104
- licenses: a bunch of licenses included.
104105
- jars: packages needed by the Kyuubi server.
105106
- logs: where the logs of the Kyuubi server locates.
@@ -113,6 +114,7 @@ As mentioned above, for a quick start deployment, then only you need to be sure
113114
- Java runtime environment
114115
- `SPARK_HOME` for the Spark engine
115116
- `FLINK_HOME` and `kyuubi.engine.type` in `$KYUUBI_HOME/conf/kyuubi-defaults.conf` for the Flink engine.
117+
- `kyuubi.engine.type` `session.engine.trino.connection.url` and `session.engine.trino.connection.catalog` in `$KYUUBI_HOME/conf/kyuubi-defaults.conf` for the Trino engine
116118

117119
### Setup JAVA
118120

@@ -170,6 +172,21 @@ To enable the Flink SQL engine, the `kyuubi.engine.type` in `$KYUUBI_HOME/conf/k
170172
kyuubi.engine.type FLINK_SQL
171173
```
172174

175+
### Trino Engine
176+
177+
#### Setup Trino
178+
Different from Spark/Flink, you must have a Trino cluster first. Trino client stored in `$KYUUBI_HOME/externals/engines/trino`.
179+
180+
#### Setup Kyuubi Trino Configration
181+
182+
To enable the Trino engine, the `kyuubi.engine.type` need to be set as `TRINO`. And `session.engine.trino.connection.url` and `session.engine.trino.connection.catalog` are also necessary. You can set all those configs in `$KYUUBI_HOME/conf/kyuubi-defaults.conf`, or set them in your connection parameters.
183+
184+
```bash
185+
kyuubi.engine.type TRINO
186+
session.engine.trino.connection.url http://localhost:8080 # Your trino cluster server url
187+
session.engine.trino.connection.catalog hive # The default catalog connect to.
188+
```
189+
173190
### Starting Kyuubi
174191

175192
```bash
@@ -241,7 +258,7 @@ Beeline version 2.3.7 by Apache Hive
241258

242259
In this case, the session will create for the user named 'anonymous'.
243260

244-
Kyuubi will create a Spark/Flink SQL engine application using `kyuubi-<engine>-sql-engine_2.12-<version>.jar`.
261+
Kyuubi will create a Spark/Flink/Trino SQL engine application using `kyuubi-<engine>-sql-engine_2.12-<version>.jar`.
245262
It will cost awhile for the application to be ready before fully establishing the session.
246263
Otherwise, an existing application will be reused, and the time cost here is negligible.
247264

@@ -253,7 +270,7 @@ bin/beeline -u 'jdbc:hive2://localhost:10009/' -n kentyao
253270

254271
The formerly created Spark application for user 'anonymous' will not be reused in this case, while a brand new application will be submitted for user 'kentyao' instead.
255272

256-
Then, you can see two processes running in your local environment, including one `KyuubiServer` instance, one `SparkSubmit` or `FlinkSQLEngine` instances as the SQL engines.
273+
Then, you can see two processes running in your local environment, including one `KyuubiServer` instance, one `SparkSubmit` `FlinkSQLEngine` or `TrinoSqlEngine` instances as the SQL engines.
257274

258275
- Spark
259276

@@ -271,6 +288,14 @@ Then, you can see two processes running in your local environment, including one
271288
43260 FlinkSQLEngine
272289
```
273290

291+
- Trino
292+
293+
```
294+
63483 Jps
295+
63693 KyuubiServer
296+
63266 TrinoSqlEngine
297+
```
298+
274299
### Execute Statements
275300

276301
#### Execute Spark SQL Statements
@@ -425,6 +450,49 @@ For example, you can get the Flink web UI from the log for debugging or tuning.
425450

426451
![](../imgs/flink/flink_jobs_page.png)
427452

453+
#### Execute Trino Statements
454+
455+
If the beeline session is successfully connected, then you can run any query supported by Trino now. For example,
456+
457+
```logtalk
458+
0: jdbc:hive2://127.0.0.1:10009/default> select timestamp '2018-11-17';
459+
10:33:37.663 INFO org.apache.kyuubi.operation.ExecuteStatement: Processing yizhifeidie123's query[d059bc77-f2b6-4f95-b72b-859dbc07aacb]: INITIALIZED_STATE -> PENDING_STATE, statement: select timestamp '2018-11-17'
460+
10:33:37.694 INFO org.apache.kyuubi.operation.ExecuteStatement: Processing yizhifeidie123's query[d059bc77-f2b6-4f95-b72b-859dbc07aacb]: PENDING_STATE -> RUNNING_STATE, statement: select timestamp '2018-11-17'
461+
10:33:37.669 INFO org.apache.kyuubi.engine.trino.operation.ExecuteStatement: Processing yizhifeidie123's query[6353e64f-94ba-4770-989b-7186d267d8be]: INITIALIZED_STATE -> PENDING_STATE, statement: select timestamp '2018-11-17'10:33:37.693 INFO org.apache.kyuubi.engine.trino.operation.ExecuteStatement: Processing yizhifeidie123's query[6353e64f-94ba-4770-989b-7186d267d8be]: PENDING_STATE -> RUNNING_STATE, statement: select timestamp '2018-11-17'10:33:37.997 INFO org.apache.kyuubi.engine.trino.operation.ExecuteStatement: Execute in full collect mode10:33:37.999 INFO org.apache.kyuubi.engine.trino.operation.ExecuteStatement: Processing yizhifeidie123's query[6353e64f-94ba-4770-989b-7186d267d8be]: RUNNING_STATE -> FINISHED_STATE, statement: select timestamp '2018-11-17', time taken: 0.305 seconds
462+
10:33:38.003 INFO org.apache.kyuubi.operation.ExecuteStatement: Query[d059bc77-f2b6-4f95-b72b-859dbc07aacb] in FINISHED_STATE
463+
10:33:38.004 INFO org.apache.kyuubi.operation.ExecuteStatement: Processing yizhifeidie123's query[d059bc77-f2b6-4f95-b72b-859dbc07aacb]: RUNNING_STATE -> FINISHED_STATE, statement: select timestamp '2018-11-17', time taken: 0.31 seconds
464+
+------------------------+
465+
| _col0 |
466+
+------------------------+
467+
| 2018-11-17 00:00:00.0 |
468+
+------------------------+
469+
1 row selected (0.422 seconds)
470+
0: jdbc:hive2://localhost:10009/default> select * from tpch.tiny.customer limit 6;
471+
11:10:07.869 INFO org.apache.kyuubi.operation.ExecuteStatement: Processing kyuubi's query[8b96ccd1-d1e2-4068-b250-c5a66950e629]: INITIALIZED_STATE -> PENDING_STATE, statement: select * from tpch.tiny.customer limit 6
472+
11:10:07.878 INFO org.apache.kyuubi.operation.ExecuteStatement: Processing kyuubi's query[8b96ccd1-d1e2-4068-b250-c5a66950e629]: PENDING_STATE -> RUNNING_STATE, statement: select * from tpch.tiny.customer limit 6
473+
11:10:07.871 INFO org.apache.kyuubi.engine.trino.operation.ExecuteStatement: Processing kyuubi's query[d66faea0-fac8-4d3c-a38a-c84fba57d8a7]: INITIALIZED_STATE -> PENDING_STATE, statement: select * from tpch.tiny.customer limit 611:10:07.877 INFO org.apache.kyuubi.engine.trino.operation.ExecuteStatement: Processing kyuubi's query[d66faea0-fac8-4d3c-a38a-c84fba57d8a7]: PENDING_STATE -> RUNNING_STATE, statement: select * from tpch.tiny.customer limit 611:10:08.063 INFO org.apache.kyuubi.engine.trino.operation.ExecuteStatement: Execute in full collect mode11:10:08.064 INFO org.apache.kyuubi.engine.trino.operation.ExecuteStatement: Processing kyuubi's query[d66faea0-fac8-4d3c-a38a-c84fba57d8a7]: RUNNING_STATE -> FINISHED_STATE, statement: select * from tpch.tiny.customer limit 6, time taken: 0.186 seconds
474+
11:10:08.066 INFO org.apache.kyuubi.operation.ExecuteStatement: Query[8b96ccd1-d1e2-4068-b250-c5a66950e629] in FINISHED_STATE
475+
11:10:08.066 INFO org.apache.kyuubi.operation.ExecuteStatement: Processing kyuubi's query[8b96ccd1-d1e2-4068-b250-c5a66950e629]: RUNNING_STATE -> FINISHED_STATE, statement: select * from tpch.tiny.customer limit 6, time taken: 0.188 seconds
476+
+----------+---------------------+----------------------------------+------------+------------------+----------+-------------+----------------------------------------------------+
477+
| custkey | name | address | nationkey | phone | acctbal | mktsegment | comment |
478+
+----------+---------------------+----------------------------------+------------+------------------+----------+-------------+----------------------------------------------------+
479+
| 749 | Customer#000000749 | U1Dvu0r793a | 24 | 34-158-697-9591 | 7491.42 | MACHINERY | accounts was. final, final requests wake. theodolites was slyly. blithely even foxes wake carefully ac |
480+
| 750 | Customer#000000750 | 5OyNRajjgjjbaXtI rkxvB2lX4c6u | 8 | 18-235-587-1274 | 269.9 | BUILDING | s. regular, regular deposits sleep carefully blithely bol |
481+
| 751 | Customer#000000751 | e OSrreG6sx7l1t3wAg8u11DWk D 9 | 0 | 10-658-550-2257 | 2130.98 | FURNITURE | ges sleep furiously bold deposits. furiously regular requests cajole slyly. unusual accounts nag unusual ide |
482+
| 752 | Customer#000000752 | KtdEacPUecPdPLt99kwZrnH9oIxUxpw | 8 | 18-924-993-6038 | 8363.66 | MACHINERY | mong the ironic, final waters. regular deposits above the fluffily ironic instructions |
483+
| 753 | Customer#000000753 | 9k2PLlDRbMq4oSvW5Hh7Ak5iRDH | 17 | 27-817-126-3646 | 8114.44 | HOUSEHOLD | cies. deposits snooze. final, regular excuses wake furiously about the furiously final foxes. dependencies |
484+
| 754 | Customer#000000754 | 8r5wwhhlL9MkAxOhRK | 0 | 10-646-595-5871 | -566.86 | BUILDING | er regular accounts against the furiously unusual somas sleep carefull |
485+
+----------+---------------------+----------------------------------+------------+------------------+----------+-------------+----------------------------------------------------+
486+
6 rows selected (0.21 seconds)
487+
```
488+
489+
As shown in the above case, you can retrieve all the operation logs, the result schema, and the result to your client-side in the beeline console.
490+
491+
Additionally, some useful information about the background Trino application associated with this connection is also printed in the operation log.
492+
Add, you get the Trino web UI for debugging or tuning.
493+
494+
![](../imgs/trino/trino-query-page.png)
495+
428496
### Closing a Connection
429497

430498
Close the session between beeline and Kyuubi server by executing `!quit`, for example,

0 commit comments

Comments
 (0)