techdocsmith commented on code in PR #13565: URL: https://github.com/apache/druid/pull/13565#discussion_r1062928731
########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: + +  + +3. Click the **Demo 1** tab. This query ingests sample data into a datasource called **kttm_simple**. Click the **Demo 1** tab heading again and note the options—you can rename, copy and duplicate tabs. + +4. Click **Run** to ingest the data. + +5. When ingestion is complete, Druid displays the time it took to complete the insert query, and the new datasource **kttm_simple** displays in the left pane. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see example queries that ingest, transform, and query sample data. + +## View and filter query results + +In this section you run some queries against the new datasource and perform some operations on the query results. + +1. Click **+** to the right of the existing tabs to open a new query tab. + +2. Click the name of the datasource **kttm_simple** in the left pane to display some automatically generated queries: + +  + +3. Click **SELECT * FROM kttm_simple** and run the query. + +4. In the query results pane, click **Chrome** anywhere it appears in the **browser** column then click **Filter on: browser = 'Chrome'** to filter the results. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see examples of queries that ingest, transform, and query sample data. + +## Run aggregate queries + +In this section you run some aggregate queries and perform some operations on the query results. + +1. Open a new query tab. + +2. Click **kttm_simple** in the left pane to display the generated queries. + +3. Click **SELECT COUNT(*) AS "Count" FROM kttm_simple** and run the query. + +4. After you run a query that contains an aggregate function, additional options become available in the Query view. + + Click the arrow to the left of the **kttm_simple** datasource to display the columns, then click the **country** column. Several options appear to apply country-based filters and aggregate functions to the query: + +  + +5. Click **Aggregate > COUNT(DISTINCT country)** to add this clause to the query, then run the updated query: + +  + +6. Click **Engine: auto (sql-native)**. From the menu that appears you can edit the query context and turn off some query defaults. + + Uncheck **Use approximate COUNT(DISTINCT)** and rerun the query. The country count in the results decreases because the computation has become more exact. + +7. The Query view can provide information about a function, in case you aren't sure exactly what it does. + + Replace the query line `COUNT(DISTINCT country) AS dist_country` with `COUNT(DISTINCT)`. + <br>A help dialog for the function displays: + +  + + Click outside the help window to close it. + +8. You can also perform actions on calculated columns in the results pane. + + Click the results column heading **dist_country COUNT(DISTINCT country)** to see the available options: + +  + +9. Select **Edit column** and change the **Output name** to **Distinct countries**. + +## Generate an explain plan + +In this section you generate an explain plan for a query. An explain plan shows the full query details and all of the operations Druid will perform to execute it. Review Comment: It might be helpful to add a little more detail here. I would talk about Druid queries being optimized for certain query types: - Scan, - Timeseries - TopN - GroupBy And how the explain plan will tell you about that with a link out to more info ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: Review Comment: ```suggestion 2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several tabs: ``` ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. Review Comment: The `micro-quickstart` is no more. See https://druid.apache.org/docs/latest/tutorials/index.html#start-up-druid-services ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. Review Comment: ```suggestion This tutorial demonstrates some useful features built into Query view in Apache Druid. ``` ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: + +  + +3. Click the **Demo 1** tab. This query ingests sample data into a datasource called **kttm_simple**. Click the **Demo 1** tab heading again and note the options—you can rename, copy and duplicate tabs. + +4. Click **Run** to ingest the data. + +5. When ingestion is complete, Druid displays the time it took to complete the insert query, and the new datasource **kttm_simple** displays in the left pane. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see example queries that ingest, transform, and query sample data. + +## View and filter query results + +In this section you run some queries against the new datasource and perform some operations on the query results. + +1. Click **+** to the right of the existing tabs to open a new query tab. + +2. Click the name of the datasource **kttm_simple** in the left pane to display some automatically generated queries: + +  + +3. Click **SELECT * FROM kttm_simple** and run the query. + +4. In the query results pane, click **Chrome** anywhere it appears in the **browser** column then click **Filter on: browser = 'Chrome'** to filter the results. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see examples of queries that ingest, transform, and query sample data. + +## Run aggregate queries + +In this section you run some aggregate queries and perform some operations on the query results. + +1. Open a new query tab. + +2. Click **kttm_simple** in the left pane to display the generated queries. + +3. Click **SELECT COUNT(*) AS "Count" FROM kttm_simple** and run the query. + +4. After you run a query that contains an aggregate function, additional options become available in the Query view. + + Click the arrow to the left of the **kttm_simple** datasource to display the columns, then click the **country** column. Several options appear to apply country-based filters and aggregate functions to the query: + +  + +5. Click **Aggregate > COUNT(DISTINCT country)** to add this clause to the query, then run the updated query: + +  + +6. Click **Engine: auto (sql-native)**. From the menu that appears you can edit the query context and turn off some query defaults. + + Uncheck **Use approximate COUNT(DISTINCT)** and rerun the query. The country count in the results decreases because the computation has become more exact. + +7. The Query view can provide information about a function, in case you aren't sure exactly what it does. + + Replace the query line `COUNT(DISTINCT country) AS dist_country` with `COUNT(DISTINCT)`. + <br>A help dialog for the function displays: + +  + + Click outside the help window to close it. + +8. You can also perform actions on calculated columns in the results pane. + + Click the results column heading **dist_country COUNT(DISTINCT country)** to see the available options: + +  + +9. Select **Edit column** and change the **Output name** to **Distinct countries**. + +## Generate an explain plan + +In this section you generate an explain plan for a query. An explain plan shows the full query details and all of the operations Druid will perform to execute it. + +1. Open a new query tab. + +2. Click **kttm_simple** in the left pane to display the generated queries. + +3. Click **SELECT * FROM kttm_simple** and run the query. + +4. Click the ellipsis icon at the bottom of the query window and select **Explain SQL query**. The query plan opens in a new window: + +  + +5. Click **Open in new tab**. You can review the query details and modify it as required. + +6. Change the limit from 1001 to 2001: + <br>`"Limit": 2001,` + <br>and run the query to confirm that 2,001 results are returned. + +## Try out a few more features + +In this section you try out a few more useful Query view features. + +### Use calculator mode + +Queries without a FROM clause run in calculator mode—this can be useful to help you understand how functions work. Review Comment: Link out to SQL functions? ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. Review Comment: Maybe a link out to learning Druid SQL? Because folks may see "Query" and expect some SQL stuff. ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: + +  + +3. Click the **Demo 1** tab. This query ingests sample data into a datasource called **kttm_simple**. Click the **Demo 1** tab heading again and note the options—you can rename, copy and duplicate tabs. + +4. Click **Run** to ingest the data. + +5. When ingestion is complete, Druid displays the time it took to complete the insert query, and the new datasource **kttm_simple** displays in the left pane. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see example queries that ingest, transform, and query sample data. + +## View and filter query results + +In this section you run some queries against the new datasource and perform some operations on the query results. + +1. Click **+** to the right of the existing tabs to open a new query tab. + +2. Click the name of the datasource **kttm_simple** in the left pane to display some automatically generated queries: + +  + +3. Click **SELECT * FROM kttm_simple** and run the query. + +4. In the query results pane, click **Chrome** anywhere it appears in the **browser** column then click **Filter on: browser = 'Chrome'** to filter the results. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see examples of queries that ingest, transform, and query sample data. + +## Run aggregate queries + +In this section you run some aggregate queries and perform some operations on the query results. + +1. Open a new query tab. + +2. Click **kttm_simple** in the left pane to display the generated queries. + +3. Click **SELECT COUNT(*) AS "Count" FROM kttm_simple** and run the query. + +4. After you run a query that contains an aggregate function, additional options become available in the Query view. + + Click the arrow to the left of the **kttm_simple** datasource to display the columns, then click the **country** column. Several options appear to apply country-based filters and aggregate functions to the query: + +  + +5. Click **Aggregate > COUNT(DISTINCT country)** to add this clause to the query, then run the updated query: + +  + +6. Click **Engine: auto (sql-native)**. From the menu that appears you can edit the query context and turn off some query defaults. + + Uncheck **Use approximate COUNT(DISTINCT)** and rerun the query. The country count in the results decreases because the computation has become more exact. Review Comment: link out to detailed explanation for this? ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: + +  + +3. Click the **Demo 1** tab. This query ingests sample data into a datasource called **kttm_simple**. Click the **Demo 1** tab heading again and note the options—you can rename, copy and duplicate tabs. + +4. Click **Run** to ingest the data. + +5. When ingestion is complete, Druid displays the time it took to complete the insert query, and the new datasource **kttm_simple** displays in the left pane. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see example queries that ingest, transform, and query sample data. + +## View and filter query results + +In this section you run some queries against the new datasource and perform some operations on the query results. + +1. Click **+** to the right of the existing tabs to open a new query tab. + +2. Click the name of the datasource **kttm_simple** in the left pane to display some automatically generated queries: + +  + +3. Click **SELECT * FROM kttm_simple** and run the query. + +4. In the query results pane, click **Chrome** anywhere it appears in the **browser** column then click **Filter on: browser = 'Chrome'** to filter the results. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see examples of queries that ingest, transform, and query sample data. + +## Run aggregate queries + +In this section you run some aggregate queries and perform some operations on the query results. + +1. Open a new query tab. + +2. Click **kttm_simple** in the left pane to display the generated queries. + +3. Click **SELECT COUNT(*) AS "Count" FROM kttm_simple** and run the query. + +4. After you run a query that contains an aggregate function, additional options become available in the Query view. Review Comment: This seems like it could be a cool shortcut to help you write queries. You may want to say something in the intro to this section about features to help you write queries. It might be cool to mention that you can use the column names as shortcuts to build your query or something. ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: + +  + +3. Click the **Demo 1** tab. This query ingests sample data into a datasource called **kttm_simple**. Click the **Demo 1** tab heading again and note the options—you can rename, copy and duplicate tabs. + +4. Click **Run** to ingest the data. + +5. When ingestion is complete, Druid displays the time it took to complete the insert query, and the new datasource **kttm_simple** displays in the left pane. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see example queries that ingest, transform, and query sample data. + +## View and filter query results + +In this section you run some queries against the new datasource and perform some operations on the query results. + +1. Click **+** to the right of the existing tabs to open a new query tab. + +2. Click the name of the datasource **kttm_simple** in the left pane to display some automatically generated queries: + +  + +3. Click **SELECT * FROM kttm_simple** and run the query. + +4. In the query results pane, click **Chrome** anywhere it appears in the **browser** column then click **Filter on: browser = 'Chrome'** to filter the results. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see examples of queries that ingest, transform, and query sample data. Review Comment: This repreats line 53. Is it necessary? ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: + +  + +3. Click the **Demo 1** tab. This query ingests sample data into a datasource called **kttm_simple**. Click the **Demo 1** tab heading again and note the options—you can rename, copy and duplicate tabs. + +4. Click **Run** to ingest the data. + +5. When ingestion is complete, Druid displays the time it took to complete the insert query, and the new datasource **kttm_simple** displays in the left pane. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see example queries that ingest, transform, and query sample data. + +## View and filter query results + +In this section you run some queries against the new datasource and perform some operations on the query results. + +1. Click **+** to the right of the existing tabs to open a new query tab. + +2. Click the name of the datasource **kttm_simple** in the left pane to display some automatically generated queries: + +  + +3. Click **SELECT * FROM kttm_simple** and run the query. + +4. In the query results pane, click **Chrome** anywhere it appears in the **browser** column then click **Filter on: browser = 'Chrome'** to filter the results. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see examples of queries that ingest, transform, and query sample data. + +## Run aggregate queries + +In this section you run some aggregate queries and perform some operations on the query results. Review Comment: Do we need some context about why aggregation is good in Druid? A link out aggregation functions? ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: + +  + +3. Click the **Demo 1** tab. This query ingests sample data into a datasource called **kttm_simple**. Click the **Demo 1** tab heading again and note the options—you can rename, copy and duplicate tabs. Review Comment: link out to learn more about datasources? Maybe you could even say this is a "table"datasource. ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" Review Comment: We can get rid of the convention of "Tutorial:" in the title. We can do this for the other tutorials later. Also wondering if we can find a better title than "Use" This is about making the most of some of the built in features of the query view. "Get to know the query view"? "Query view tips and tricks"? "Get the most out of the Query view?" ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. Review Comment: CAn we add a little more context here? Something along the lines: Each of the Sample Queries demonstrates a different aspect/feature, for exmple x and y. Each query has detailed comments to help you learn more. ########## docs/tutorials/tutorial-sql-query-view.md: ########## @@ -0,0 +1,168 @@ +--- +id: tutorial-sql-query-view +title: "Tutorial: Use Query view" +sidebar_label: "Use Query view" +--- + +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +This tutorial demonstrates some useful features of the Query view in Apache Druid. + +You can use the Query view to ingest and query data. You can also use it to test and tune queries before you use them in API requests—for example, to perform [SQL-based ingestion](../multi-stage-query/api.md). + +The tutorial guides you through the steps to ingest sample data, and query the ingested data using some Query view features. + +## Prerequisites + +Before you follow the steps in this tutorial, download Druid as described in the [quickstart](./index.md) using the [micro-quickstart](../operations/single-server.md#micro-quickstart-4-cpu-16gib-ram) single-machine configuration and have it running on your local machine. You don't need to have loaded any data. + +## Run a demo query to ingest data + +In this section you load the demo queries that are included in Druid, and run a SQL task to ingest sample data into a datasource. + +1. Navigate to the Druid console at [http://localhost:8888](http://localhost:8888) and click **Query**. + +2. Click the ellipsis icon at the bottom of the query window and select **Load demo queries**. Note that loading the demo queries replaces all of your current query tabs. The demo queries load in several query tabs: + +  + +3. Click the **Demo 1** tab. This query ingests sample data into a datasource called **kttm_simple**. Click the **Demo 1** tab heading again and note the options—you can rename, copy and duplicate tabs. + +4. Click **Run** to ingest the data. + +5. When ingestion is complete, Druid displays the time it took to complete the insert query, and the new datasource **kttm_simple** displays in the left pane. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see example queries that ingest, transform, and query sample data. + +## View and filter query results + +In this section you run some queries against the new datasource and perform some operations on the query results. + +1. Click **+** to the right of the existing tabs to open a new query tab. + +2. Click the name of the datasource **kttm_simple** in the left pane to display some automatically generated queries: + +  + +3. Click **SELECT * FROM kttm_simple** and run the query. + +4. In the query results pane, click **Chrome** anywhere it appears in the **browser** column then click **Filter on: browser = 'Chrome'** to filter the results. + +In this tutorial you only use the **Demo 1** query. You can explore the other tabs to see examples of queries that ingest, transform, and query sample data. + +## Run aggregate queries + +In this section you run some aggregate queries and perform some operations on the query results. + +1. Open a new query tab. + +2. Click **kttm_simple** in the left pane to display the generated queries. + +3. Click **SELECT COUNT(*) AS "Count" FROM kttm_simple** and run the query. + +4. After you run a query that contains an aggregate function, additional options become available in the Query view. + + Click the arrow to the left of the **kttm_simple** datasource to display the columns, then click the **country** column. Several options appear to apply country-based filters and aggregate functions to the query: + +  + +5. Click **Aggregate > COUNT(DISTINCT country)** to add this clause to the query, then run the updated query: + +  + +6. Click **Engine: auto (sql-native)**. From the menu that appears you can edit the query context and turn off some query defaults. Review Comment: Can we add some context about what the different engines are and what to use them for? For example: SQL native for queries. MSQ for insrert/replace into. Normally is it OK to use `auto` and let the Query view chose? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
