From 8b25b11e9dbe53462361c776722cbd5340bdfcf3 Mon Sep 17 00:00:00 2001 From: Yuhui Date: Tue, 30 Apr 2024 15:55:54 +0800 Subject: [PATCH] [#3234] improve (doc): Update playground docs for using simple catalog (#3235) ### What changes were proposed in this pull request? Update playground docs for using simple catalog ### Why are the changes needed? Fix: #3234 ### Does this PR introduce _any_ user-facing change? NO ### How was this patch tested? NO --- docs/how-to-use-the-playground.md | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/how-to-use-the-playground.md b/docs/how-to-use-the-playground.md index 03e0f8623ec..9245928c7f7 100644 --- a/docs/how-to-use-the-playground.md +++ b/docs/how-to-use-the-playground.md @@ -59,12 +59,12 @@ You can use simple queries to test in the Trino CLI. ```SQL SHOW CATALOGS; -CREATE SCHEMA "metalake_demo.catalog_hive".company +CREATE SCHEMA catalog_hive.company WITH (location = 'hdfs://hive:9000/user/hive/warehouse/company.db'); -SHOW CREATE SCHEMA "metalake_demo.catalog_hive".company; +SHOW CREATE SCHEMA catalog_hive.company; -CREATE TABLE "metalake_demo.catalog_hive".company.employees +CREATE TABLE catalog_hive.company.employees ( name varchar, salary decimal(10,2) @@ -73,15 +73,15 @@ WITH ( format = 'TEXTFILE' ); -INSERT INTO "metalake_demo.catalog_hive".company.employees (name, salary) VALUES ('Sam Evans', 55000); +INSERT INTO catalog_hive.company.employees (name, salary) VALUES ('Sam Evans', 55000); -SELECT * FROM "metalake_demo.catalog_hive".company.employees; +SELECT * FROM catalog_hive.company.employees; -SHOW SCHEMAS from "metalake_demo.catalog_hive"; +SHOW SCHEMAS from catalog_hive; -DESCRIBE "metalake_demo.catalog_hive".company.employees; +DESCRIBE catalog_hive.company.employees; -SHOW TABLES from "metalake_demo.catalog_hive".company; +SHOW TABLES from catalog_hive.company; ``` ### Cross-catalog queries @@ -92,8 +92,8 @@ To know which employee has the largest sales amount, run this SQL: ```SQL SELECT given_name, family_name, job_title, sum(total_amount) AS total_sales -FROM "metalake_demo.catalog_hive".sales.sales as s, - "metalake_demo.catalog_postgres".hr.employees AS e +FROM catalog_hive.sales.sales as s, + catalog_postgres.hr.employees AS e where s.employee_id = e.employee_id GROUP BY given_name, family_name, job_title ORDER BY total_sales DESC @@ -104,9 +104,9 @@ To know the top customers who bought the most by state, run this SQL: ```SQL SELECT customer_name, location, SUM(total_amount) AS total_spent -FROM "metalake_demo.catalog_hive".sales.sales AS s, - "metalake_demo.catalog_hive".sales.stores AS l, - "metalake_demo.catalog_hive".sales.customers AS c +FROM catalog_hive.sales.sales AS s, + catalog_hive.sales.stores AS l, + catalog_hive.sales.customers AS c WHERE s.store_id = l.store_id AND s.customer_id = c.customer_id GROUP BY location, customer_name ORDER BY location, SUM(total_amount) DESC; @@ -116,9 +116,9 @@ To know the employee's average performance rating and total sales, run this SQL: ```SQL SELECT e.employee_id, given_name, family_name, AVG(rating) AS average_rating, SUM(total_amount) AS total_sales -FROM "metalake_demo.catalog_postgres".hr.employees AS e, - "metalake_demo.catalog_postgres".hr.employee_performance AS p, - "metalake_demo.catalog_hive".sales.sales AS s +FROM catalog_postgres.hr.employees AS e, + catalog_postgres.hr.employee_performance AS p, + catalog_hive.sales.sales AS s WHERE e.employee_id = p.employee_id AND p.employee_id = s.employee_id GROUP BY e.employee_id, given_name, family_name; ``` @@ -171,7 +171,7 @@ trino@d2bbfccc7432:/$ trino ``` ```SQL -select * from "metalake_demo.catalog_hive".sales.customers +select * from catalog_hive.sales.customers union -select * from "metalake_demo.catalog_iceberg".sales.customers; +select * from catalog_iceberg.sales.customers; ```