Repository: drill Updated Branches: refs/heads/gh-pages 2740b7a7f -> 825546b95
make subsection links work on safari safari link fix Neeraja's blog > tutorial minor edit align table fix tut intro Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/c902b0b3 Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/c902b0b3 Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/c902b0b3 Branch: refs/heads/gh-pages Commit: c902b0b3501ff20f00e9867281bdebe4c77a6f74 Parents: 2740b7a Author: Kristine Hahn <[email protected]> Authored: Thu Nov 12 16:15:58 2015 -0800 Committer: Kristine Hahn <[email protected]> Committed: Thu Nov 12 17:04:59 2015 -0800 ---------------------------------------------------------------------- _data/docs.json | 71 +++++- ...guring-a-multitenant-cluster-introduction.md | 6 +- ...-configuring-web-ui-and-rest-api-security.md | 2 +- .../120-configuring-the-drill-shell.md | 2 +- .../035-plugin-configuration-basics.md | 2 +- .../020-hive-to-drill-data-type-mapping.md | 2 +- .../030-deploying-and-using-a-hive-udf.md | 2 +- .../050-json-data-model.md | 4 +- .../025-tutorial-develop-a-simple-function.md | 2 +- .../design-docs/040-useful-research.md | 2 +- .../design-docs/050-value-vectors.md | 4 +- .../020-drill-patch-review-tool.md | 4 +- .../050-starting-drill-on-windows.md | 2 +- .../010-interfaces-introduction.md | 8 +- .../020-tableau-examples.md | 2 +- _docs/sql-reference/030-lexical-structure.md | 12 +- _docs/sql-reference/040-operators.md | 2 +- _docs/sql-reference/090-sql-extensions.md | 2 +- .../data-types/010-supported-data-types.md | 14 +- .../data-types/020-date-time-and-timestamp.md | 2 +- .../sql-functions/020-data-type-conversion.md | 10 +- .../030-date-time-functions-and-arithmetic.md | 10 +- .../sql-functions/040-string-manipulation.md | 34 +-- _docs/tutorials/010-tutorials-introduction.md | 4 +- _docs/tutorials/020-drill-in-10-minutes.md | 4 +- ...070-analyzing-data-using-window-functions.md | 242 +++++++++++++++++++ 26 files changed, 373 insertions(+), 78 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_data/docs.json ---------------------------------------------------------------------- diff --git a/_data/docs.json b/_data/docs.json index dda4fcc..3f2fc11 100644 --- a/_data/docs.json +++ b/_data/docs.json @@ -160,6 +160,23 @@ "title": "Aggregate and Aggregate Statistical", "url": "/docs/aggregate-and-aggregate-statistical/" }, + "Analyzing Data Using Window Functions": { + "breadcrumbs": [ + { + "title": "Tutorials", + "url": "/docs/tutorials/" + } + ], + "children": [], + "next_title": "Install Drill", + "next_url": "/docs/install-drill/", + "parent": "Tutorials", + "previous_title": "Analyzing Social Media", + "previous_url": "/docs/analyzing-social-media/", + "relative_path": "_docs/tutorials/070-analyzing-data-using-window-functions.md", + "title": "Analyzing Data Using Window Functions", + "url": "/docs/analyzing-data-using-window-functions/" + }, "Analyzing Highly Dynamic Datasets": { "breadcrumbs": [ { @@ -185,8 +202,8 @@ } ], "children": [], - "next_title": "Install Drill", - "next_url": "/docs/install-drill/", + "next_title": "Analyzing Data Using Window Functions", + "next_url": "/docs/analyzing-data-using-window-functions/", "parent": "Tutorials", "previous_title": "Analyzing Highly Dynamic Datasets", "previous_url": "/docs/analyzing-highly-dynamic-datasets/", @@ -3791,8 +3808,8 @@ "next_title": "Install Drill Introduction", "next_url": "/docs/install-drill-introduction/", "parent": "", - "previous_title": "Analyzing Social Media", - "previous_url": "/docs/analyzing-social-media/", + "previous_title": "Analyzing Data Using Window Functions", + "previous_url": "/docs/analyzing-data-using-window-functions/", "relative_path": "_docs/040-install-drill.md", "title": "Install Drill", "url": "/docs/install-drill/" @@ -10824,14 +10841,31 @@ } ], "children": [], - "next_title": "Install Drill", - "next_url": "/docs/install-drill/", + "next_title": "Analyzing Data Using Window Functions", + "next_url": "/docs/analyzing-data-using-window-functions/", "parent": "Tutorials", "previous_title": "Analyzing Highly Dynamic Datasets", "previous_url": "/docs/analyzing-highly-dynamic-datasets/", "relative_path": "_docs/tutorials/060-analyzing-social-media.md", "title": "Analyzing Social Media", "url": "/docs/analyzing-social-media/" + }, + { + "breadcrumbs": [ + { + "title": "Tutorials", + "url": "/docs/tutorials/" + } + ], + "children": [], + "next_title": "Install Drill", + "next_url": "/docs/install-drill/", + "parent": "Tutorials", + "previous_title": "Analyzing Social Media", + "previous_url": "/docs/analyzing-social-media/", + "relative_path": "_docs/tutorials/070-analyzing-data-using-window-functions.md", + "title": "Analyzing Data Using Window Functions", + "url": "/docs/analyzing-data-using-window-functions/" } ], "next_title": "Tutorials Introduction", @@ -11922,14 +11956,31 @@ } ], "children": [], - "next_title": "Install Drill", - "next_url": "/docs/install-drill/", + "next_title": "Analyzing Data Using Window Functions", + "next_url": "/docs/analyzing-data-using-window-functions/", "parent": "Tutorials", "previous_title": "Analyzing Highly Dynamic Datasets", "previous_url": "/docs/analyzing-highly-dynamic-datasets/", "relative_path": "_docs/tutorials/060-analyzing-social-media.md", "title": "Analyzing Social Media", "url": "/docs/analyzing-social-media/" + }, + { + "breadcrumbs": [ + { + "title": "Tutorials", + "url": "/docs/tutorials/" + } + ], + "children": [], + "next_title": "Install Drill", + "next_url": "/docs/install-drill/", + "parent": "Tutorials", + "previous_title": "Analyzing Social Media", + "previous_url": "/docs/analyzing-social-media/", + "relative_path": "_docs/tutorials/070-analyzing-data-using-window-functions.md", + "title": "Analyzing Data Using Window Functions", + "url": "/docs/analyzing-data-using-window-functions/" } ], "next_title": "Tutorials Introduction", @@ -12186,8 +12237,8 @@ "next_title": "Install Drill Introduction", "next_url": "/docs/install-drill-introduction/", "parent": "", - "previous_title": "Analyzing Social Media", - "previous_url": "/docs/analyzing-social-media/", + "previous_title": "Analyzing Data Using Window Functions", + "previous_url": "/docs/analyzing-data-using-window-functions/", "relative_path": "_docs/040-install-drill.md", "title": "Install Drill", "url": "/docs/install-drill/" http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/configure-drill/030-configuring-a-multitenant-cluster-introduction.md ---------------------------------------------------------------------- diff --git a/_docs/configure-drill/030-configuring-a-multitenant-cluster-introduction.md b/_docs/configure-drill/030-configuring-a-multitenant-cluster-introduction.md index c6a272f..b63fa73 100644 --- a/_docs/configure-drill/030-configuring-a-multitenant-cluster-introduction.md +++ b/_docs/configure-drill/030-configuring-a-multitenant-cluster-introduction.md @@ -14,7 +14,7 @@ Drill supports multiple users sharing a Drillbit and running separate Drillbits You need to plan and configure the following resources for use with Drill and other workloads: * [Memory]({{site.baseurl}}/docs/configuring-multitenant-resources) -* [CPU]({{site.baseurl}}/docs/configuring-multitenant-resources#how-to-manage-drill-cpu-resources) -* [Disk]({{site.baseurl}}/docs/configuring-multitenant-resources#how-to-manage-drill-disk-resources) +* [CPU]({{site.baseurl}}/docs/configuring-multitenant-resources/#how-to-manage-drill-cpu-resources) +* [Disk]({{site.baseurl}}/docs/configuring-multitenant-resources/#how-to-manage-drill-disk-resources) -When users share a Drillbit, [configure queues]({{site.baseurl}}/docs/configuring-resources-for-a-shared-drillbit#configuring-query-queuing) and [parallelization]({{site.baseurl}}/docs/configuring-resources-for-a-shared-drillbit#configuring-parallelization) in addition to memory. \ No newline at end of file +When users share a Drillbit, [configure queues]({{site.baseurl}}/docs/configuring-resources-for-a-shared-drillbit/#configuring-query-queuing) and [parallelization]({{site.baseurl}}/docs/configuring-resources-for-a-shared-drillbit/#configuring-parallelization) in addition to memory. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/configure-drill/078-configuring-web-ui-and-rest-api-security.md ---------------------------------------------------------------------- diff --git a/_docs/configure-drill/078-configuring-web-ui-and-rest-api-security.md b/_docs/configure-drill/078-configuring-web-ui-and-rest-api-security.md index 7819302..76ed2f1 100644 --- a/_docs/configure-drill/078-configuring-web-ui-and-rest-api-security.md +++ b/_docs/configure-drill/078-configuring-web-ui-and-rest-api-security.md @@ -18,7 +18,7 @@ Drill generates a self-signed certificate that works with SSL for HTTPS access t ## Setting Up a Custom SSL Configuration -As cluster administrator, you can set the following SSL configuration parameters in the `conf/drill-override.conf` file, as described in the [Java product documentation](http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html#Customization): +As cluster administrator, you can set the following SSL configuration parameters in the `conf/drill-override.conf` file, as described in the [Java product documentation](http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html/#Customization): * javax.net.ssl.keyStore Path to the application's certificate and private key in the Java keystore file. http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/configure-drill/120-configuring-the-drill-shell.md ---------------------------------------------------------------------- diff --git a/_docs/configure-drill/120-configuring-the-drill-shell.md b/_docs/configure-drill/120-configuring-the-drill-shell.md index 935325b..0a67b59 100644 --- a/_docs/configure-drill/120-configuring-the-drill-shell.md +++ b/_docs/configure-drill/120-configuring-the-drill-shell.md @@ -28,7 +28,7 @@ The following table lists the commands that you can run on the Drill command lin | !run | Run a script from the specified file. | | !save | Save the current variables and aliases. | | !script | Start saving a script to a file. | -| !set | Set the given variable. See [The Set Command Variables]({{site.baseurl}}/docs/configuring-the-drill-shell#the-set-command-variables). | +| !set | Set the given variable. See [Set Command Variables]({{site.baseurl}}/docs/configuring-the-drill-shell/#the-set-command-variables). | | !tables | List all the tables in the database. | | !verbose | Show unabbreviated error messages. | http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/connect-a-data-source/035-plugin-configuration-basics.md ---------------------------------------------------------------------- diff --git a/_docs/connect-a-data-source/035-plugin-configuration-basics.md b/_docs/connect-a-data-source/035-plugin-configuration-basics.md index 073b4a9..743ca71 100644 --- a/_docs/connect-a-data-source/035-plugin-configuration-basics.md +++ b/_docs/connect-a-data-source/035-plugin-configuration-basics.md @@ -177,4 +177,4 @@ After cluster startup, you have to use the REST API or Drill Web Console to add can modify the entry in ZooKeeper by uploading the json file for that plugin to the /drill directory of the zookeeper installation, or by just deleting the /drill directory if you do not have configuration properties to preserve. -If you load an HBase storage plugin configuration using bootstrap-storage-plugins.json file and HBase is not installed, you might experience a delay when executing the queries. Configure the [HBase client timeout](http://hbase.apache.org/book.html#config.files) and retry settings in the config block of the HBase plugin configuration. +If you load an HBase storage plugin configuration using bootstrap-storage-plugins.json file and HBase is not installed, you might experience a delay when executing the queries. Configure the [HBase client timeout](http://hbase.apache.org/book.html/#config.files) and retry settings in the config block of the HBase plugin configuration. http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/data-sources-and-file-formats/020-hive-to-drill-data-type-mapping.md ---------------------------------------------------------------------- diff --git a/_docs/data-sources-and-file-formats/020-hive-to-drill-data-type-mapping.md b/_docs/data-sources-and-file-formats/020-hive-to-drill-data-type-mapping.md index 251f29d..842b667 100644 --- a/_docs/data-sources-and-file-formats/020-hive-to-drill-data-type-mapping.md +++ b/_docs/data-sources-and-file-formats/020-hive-to-drill-data-type-mapping.md @@ -50,7 +50,7 @@ This example demonstrates the mapping of Hive data types to Drill data types. Us The example makes the following assumptions: * The CSV resides in the following location in the Drill sandbox: `/mapr/demo.mapr.com/data/` -* You [enabled the DECIMAL data type]({{site.baseurl}}/docs/supported-data-types#enabling-the-decimal-type) in Drill. +* You [enabled the DECIMAL data type]({{site.baseurl}}/docs/supported-data-types/#enabling-the-decimal-type) in Drill. ### Define an External Table in Hive http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/data-sources-and-file-formats/030-deploying-and-using-a-hive-udf.md ---------------------------------------------------------------------- diff --git a/_docs/data-sources-and-file-formats/030-deploying-and-using-a-hive-udf.md b/_docs/data-sources-and-file-formats/030-deploying-and-using-a-hive-udf.md index e1d7706..2cd0d99 100644 --- a/_docs/data-sources-and-file-formats/030-deploying-and-using-a-hive-udf.md +++ b/_docs/data-sources-and-file-formats/030-deploying-and-using-a-hive-udf.md @@ -32,7 +32,7 @@ You create the JAR for a UDF to use in Drill in a conventional manner with a few # jar tf target/MyUDF-1.0.0.jar |grep -i drill drill-module.conf -6. Test the UDF in Hive as shown in the [Github readme](https://github.com/viadea/HiveUDF#c-test-udf). +6. Test the UDF in Hive as shown in the [Github readme](https://github.com/viadea/HiveUDF/#c-test-udf). The `drill-module.conf` file defines [startup options]({{ site.baseurl }}/docs/start-up-options/) and makes the JAR functions available to use in queries throughout the Hadoop cluster. After exporting the UDF logic to a JAR file, set up the UDF in Drill. Drill users can access the custom UDF for use in Hive queries. http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/data-sources-and-file-formats/050-json-data-model.md ---------------------------------------------------------------------- diff --git a/_docs/data-sources-and-file-formats/050-json-data-model.md b/_docs/data-sources-and-file-formats/050-json-data-model.md index 5d7a669..4cd5281 100644 --- a/_docs/data-sources-and-file-formats/050-json-data-model.md +++ b/_docs/data-sources-and-file-formats/050-json-data-model.md @@ -70,7 +70,7 @@ Drill reads tuples defined in single objects, having no comma between objects. A { name: "Apples", desc: "Delicious" } { name: "Oranges", desc: "Florida Navel" } -To read and [analyze complex JSON]({{ site.baseurl }}/docs/json-data-model#analyzing-json) files, use the FLATTEN and KVGEN functions. For example, you need to flatten the data to read all the names in this JSON file: +To read and [analyze complex JSON]({{ site.baseurl }}/docs/json-data-model/#analyzing-json) files, use the FLATTEN and KVGEN functions. For example, you need to flatten the data to read all the names in this JSON file: {"Fruits: [{"name":"Apples", "quantity":115}, {"name":"Oranges","quantity":199}, @@ -497,7 +497,7 @@ Complex arrays and maps can be difficult or impossible to query. Workaround: Separate lengthy objects into objects delimited by curly braces using the following functions: -* [FLATTEN]({{ site.baseurl }}/docs/json-data-model#flatten-json-data) separates a set of nested JSON objects into individual rows in a DRILL table. +* [FLATTEN]({{ site.baseurl }}/docs/json-data-model/#flatten-json-data) separates a set of nested JSON objects into individual rows in a DRILL table. * [KVGEN]({{ site.baseurl }}/docs/kvgen/) separates objects having more elements than optimal for querying. http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/develop-custom-functions/025-tutorial-develop-a-simple-function.md ---------------------------------------------------------------------- diff --git a/_docs/develop-custom-functions/025-tutorial-develop-a-simple-function.md b/_docs/develop-custom-functions/025-tutorial-develop-a-simple-function.md index d754413..fd4261b 100644 --- a/_docs/develop-custom-functions/025-tutorial-develop-a-simple-function.md +++ b/_docs/develop-custom-functions/025-tutorial-develop-a-simple-function.md @@ -84,7 +84,7 @@ public class SimpleMaskFunc implements DrillSimpleFunc{ ## Step 3: Declare input parameters -The function will be generated dynamically, as you can see in the [DrillSimpleFuncHolder](https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillSimpleFuncHolder.java#L42), and the input parameters and output holders are defined using holders by annotations. Define the parameters using the @Param annotation. +The function will be generated dynamically, as you can see in the [DrillSimpleFuncHolder](https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillSimpleFuncHolder.java/#L42), and the input parameters and output holders are defined using holders by annotations. Define the parameters using the @Param annotation. * A nullable string * The mask char or string http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/developer-information/design-docs/040-useful-research.md ---------------------------------------------------------------------- diff --git a/_docs/developer-information/design-docs/040-useful-research.md b/_docs/developer-information/design-docs/040-useful-research.md index 77be828..03b104a 100644 --- a/_docs/developer-information/design-docs/040-useful-research.md +++ b/_docs/developer-information/design-docs/040-useful-research.md @@ -22,7 +22,7 @@ parent: "Design Docs" * <http://pdf.aminer.org/000/094/728/database_cracking.pdf> * <http://homepages.cwi.nl/~idreos/NoDBsigmod2012.pdf> * <http://db.csail.mit.edu/projects/cstore/abadiicde2007.pdf> - * Hive Architecture: <https://cwiki.apache.org/confluence/display/Hive/Design#Design-HiveArchitecture> + * Hive Architecture: <https://cwiki.apache.org/confluence/display/Hive/Design/#Design-HiveArchitecture> * Fast Response in an unreliable world: <http://research.google.com/people/jeff/latency.html> * Column-Oriented Database Systems: <http://www.vldb.org/pvldb/2/vldb09-tutorial6.pdf> (SLIDES: <http://phdopen.mimuw.edu.pl/lato10/boncz_mimuw.pdf>) http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/developer-information/design-docs/050-value-vectors.md ---------------------------------------------------------------------- diff --git a/_docs/developer-information/design-docs/050-value-vectors.md b/_docs/developer-information/design-docs/050-value-vectors.md index 87bc82d..ebd1ea3 100644 --- a/_docs/developer-information/design-docs/050-value-vectors.md +++ b/_docs/developer-information/design-docs/050-value-vectors.md @@ -3,7 +3,7 @@ title: "Value Vectors" parent: "Design Docs" --- This document defines the data structures required for passing sequences of -columnar data between [Operators](https://docs.google.com/a/maprtech.com/document/d/1zaxkcrK9mYyfpGwX1kAV80z0PCi8abefL45zOzb97dI/edit#bookmark=id.iip15ful18mm). +columnar data between [Operators](https://docs.google.com/a/maprtech.com/document/d/1zaxkcrK9mYyfpGwX1kAV80z0PCi8abefL45zOzb97dI). ## Goals @@ -39,7 +39,7 @@ schema changes during the course of record iteration. ### Homogenous Value Types -Each value in a Value Vector is of the same type. The [Record Batch](https://docs.google.com/a/maprtech.com/document/d/1zaxkcrK9mYyfpGwX1kAV80z0PCi8abefL45zOzb97dI/edit#bookmark=kix.s2xuoqnr8obe) implementation is responsible for +Each value in a Value Vector is of the same type. The [Record Batch](https://docs.google.com/a/maprtech.com/document/d/1zaxkcrK9mYyfpGwX1kAV80z0PCi8abefL45zOzb97dI/) implementation is responsible for creating a new Value Vector any time there is a change in schema. ## Definitions http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/developer-information/develop-drill/020-drill-patch-review-tool.md ---------------------------------------------------------------------- diff --git a/_docs/developer-information/develop-drill/020-drill-patch-review-tool.md b/_docs/developer-information/develop-drill/020-drill-patch-review-tool.md index 8edf2bf..e2302f7 100644 --- a/_docs/developer-information/develop-drill/020-drill-patch-review-tool.md +++ b/_docs/developer-information/develop-drill/020-drill-patch-review-tool.md @@ -21,8 +21,8 @@ parent: "Develop Drill" #### 1\. Setup - 1. Follow instructions [here]({{ site.baseurl }}/docs/drill-patch-review-tool#jira-command-line-tool) to setup the jira-python package - 2. Follow instructions [here]({{ site.baseurl }}/docs/drill-patch-review-tool#reviewboard) to setup the reviewboard python tools + 1. Follow instructions [here]({{ site.baseurl }}/docs/drill-patch-review-tool/#jira-command-line-tool) to setup the jira-python package + 2. Follow instructions [here]({{ site.baseurl }}/docs/drill-patch-review-tool/#reviewboard) to setup the reviewboard python tools 3. Install the argparse module On Linux -> sudo yum install python-argparse http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/install/installing-drill-in-embedded-mode/050-starting-drill-on-windows.md ---------------------------------------------------------------------- diff --git a/_docs/install/installing-drill-in-embedded-mode/050-starting-drill-on-windows.md b/_docs/install/installing-drill-in-embedded-mode/050-starting-drill-on-windows.md index da015ea..ef934a3 100644 --- a/_docs/install/installing-drill-in-embedded-mode/050-starting-drill-on-windows.md +++ b/_docs/install/installing-drill-in-embedded-mode/050-starting-drill-on-windows.md @@ -12,7 +12,7 @@ Start the Drill shell using the **sqlline command**. Complete the following step ``sqlline.bat -u "jdbc:drill:zk=local"``  -The [Drill prompt]({{site.baseurl}}/docs/starting-drill-on-linux-and-mac-os-x/#about-the-drill-prompt) appears. You can [submit queries]({{ site.baseurl }}/docs/drill-in-10-minutes#query-sample-data) to Drill. +The [Drill prompt]({{site.baseurl}}/docs/starting-drill-on-linux-and-mac-os-x/#about-the-drill-prompt) appears. You can [submit queries]({{ site.baseurl }}/docs/drill-in-10-minutes/#query-sample-data) to Drill. You can use the schema option in the **sqlline** command to specify a storage plugin. Specifying the storage plugin when you start up eliminates the need to specify the storage plugin in the query. For example, this command specifies the `dfs` storage plugin: http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/odbc-jdbc-interfaces/010-interfaces-introduction.md ---------------------------------------------------------------------- diff --git a/_docs/odbc-jdbc-interfaces/010-interfaces-introduction.md b/_docs/odbc-jdbc-interfaces/010-interfaces-introduction.md index 917642f..025490c 100644 --- a/_docs/odbc-jdbc-interfaces/010-interfaces-introduction.md +++ b/_docs/odbc-jdbc-interfaces/010-interfaces-introduction.md @@ -32,10 +32,10 @@ SQuirreL on Windows. To use the Drill JDBC driver with SQuirreL on Windows, complete the following steps: - * [Step 1: Getting the Drill JDBC Driver]({{ site.baseurl }}/docs/using-jdbc#step-1:-getting-the-drill-jdbc-driver) - * [Step 2: Installing and Starting SQuirreL]({{ site.baseurl }}/docs/using-jdbc#step-2:-installing-and-starting-squirrel) - * [Step 3: Adding the Drill JDBC Driver to SQuirreL]({{ site.baseurl }}/docs/using-jdbc#step-3:-adding-the-drill-jdbc-driver-to-squirrel) - * [Step 4: Running a Drill Query from SQuirreL]({{ site.baseurl }}/docs/using-jdbc#step-4:-running-a-drill-query-from-squirrel) + * [Step 1: Getting the Drill JDBC Driver]({{ site.baseurl }}/docs/using-jdbc/#step-1:-getting-the-drill-jdbc-driver) + * [Step 2: Installing and Starting SQuirreL]({{ site.baseurl }}/docs/using-jdbc/#step-2:-installing-and-starting-squirrel) + * [Step 3: Adding the Drill JDBC Driver to SQuirreL]({{ site.baseurl }}/docs/using-jdbc/#step-3:-adding-the-drill-jdbc-driver-to-squirrel) + * [Step 4: Running a Drill Query from SQuirreL]({{ site.baseurl }}/docs/using-jdbc/#step-4:-running-a-drill-query-from-squirrel) For information about how to use SQuirreL, refer to the [SQuirreL Quick Start](http://squirrel-sql.sourceforge.net/user-manual/quick_start.html) http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/odbc-jdbc-interfaces/using-drill-with-bi-tools/020-tableau-examples.md ---------------------------------------------------------------------- diff --git a/_docs/odbc-jdbc-interfaces/using-drill-with-bi-tools/020-tableau-examples.md b/_docs/odbc-jdbc-interfaces/using-drill-with-bi-tools/020-tableau-examples.md index df96d37..0da0a7c 100755 --- a/_docs/odbc-jdbc-interfaces/using-drill-with-bi-tools/020-tableau-examples.md +++ b/_docs/odbc-jdbc-interfaces/using-drill-with-bi-tools/020-tableau-examples.md @@ -14,7 +14,7 @@ This section includes the following examples: The steps and results of these examples assume pre-configured schemas and source data. You define schemas by configuring storage plugins on the Storage -tab of the [Drill Web Console]({{ site.baseurl }}/docs/getting-to-know-the-drill-sandbox#storage-plugin-overview). Also, the examples assume you [enabled the DECIMAL data type]({{site.baseurl}}/docs/supported-data-types#enabling-the-decimal-type) in Drill. +tab of the [Drill Web Console]({{ site.baseurl }}/docs/getting-to-know-the-drill-sandbox/#storage-plugin-overview). Also, the examples assume you [enabled the DECIMAL data type]({{site.baseurl}}/docs/supported-data-types/#enabling-the-decimal-type) in Drill. ## Example: Connect to a Hive Table in Tableau http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/sql-reference/030-lexical-structure.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/030-lexical-structure.md b/_docs/sql-reference/030-lexical-structure.md index 0ae49f8..36fca8a 100644 --- a/_docs/sql-reference/030-lexical-structure.md +++ b/_docs/sql-reference/030-lexical-structure.md @@ -11,15 +11,15 @@ A SQL statement used in Drill can include one or more of the following parts: * Function, scalar and aggregate, such as sum * Literal value - * [Boolean]({{ site.baseurl }}/docs/lexical-structure#boolean) - * [Identifier]({{ site.baseurl }}/docs/lexical-structure#identifier) - * [Integer]({{ site.baseurl }}/docs/lexical-structure#integer) - * [Numeric constant]({{ site.baseurl }}/docs/lexical-structure#numeric-constant) - * [String]({{ site.baseurl }}/docs/lexical-structure#string) + * [Boolean]({{ site.baseurl }}/docs/lexical-structure/#boolean) + * [Identifier]({{ site.baseurl }}/docs/lexical-structure/#identifier) + * [Integer]({{ site.baseurl }}/docs/lexical-structure/#integer) + * [Numeric constant]({{ site.baseurl }}/docs/lexical-structure/#numeric-constant) + * [String]({{ site.baseurl }}/docs/lexical-structure/#string) * Operator, such as [NOT] IN, LIKE, and AND * Predicate, such as a > b in `SELECT * FROM myfile WHERE a > b`. -* [Storage plugin and workspace reference]({{ site.baseurl }}/docs/lexical-structure#storage-plugin-and-workspace-references) +* [Storage plugin and workspace reference]({{ site.baseurl }}/docs/lexical-structure/#storage-plugin-and-workspace-references) * Whitespace * Comment in the following format: http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/sql-reference/040-operators.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/040-operators.md b/_docs/sql-reference/040-operators.md index 6ee5cde..68366ee 100644 --- a/_docs/sql-reference/040-operators.md +++ b/_docs/sql-reference/040-operators.md @@ -70,7 +70,7 @@ You can use the following string operator in your Drill queries to concatenate s * string || string -The concatenate operator is an alternative to the [concat function]({{ site.baseurl }}/docs/string-manipulation#concat) and will concatenate input if Drill can implicitly convert the input to a string. +The concatenate operator is an alternative to the [concat function]({{ site.baseurl }}/docs/string-manipulation/#concat) and will concatenate input if Drill can implicitly convert the input to a string. The concat function treats NULL as an empty string. The concatenate operator (||) returns NULL if any input is NULL. http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/sql-reference/090-sql-extensions.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/090-sql-extensions.md b/_docs/sql-reference/090-sql-extensions.md index de8d989..2a4d801 100644 --- a/_docs/sql-reference/090-sql-extensions.md +++ b/_docs/sql-reference/090-sql-extensions.md @@ -13,7 +13,7 @@ Drill extends the SELECT statement for reading complex, multi-structured data. T Drill supports Hive and HBase as a plug-and-play data source. Drill can read tables created in Hive that use [data types compatible]({{ site.baseurl }}/docs/hive-to-drill-data-type-mapping) with Drill. You can query Hive tables without modifications. You can query self-describing data without requiring metadata definitions in the Hive metastore. Primitives, such as JOIN, support columnar operation. ## Extensions for JSON-related Data Sources -For reading JSON numbers as DOUBLE or reading all JSON data as VARCHAR, use a [store.json option]({{site.baseurl}}/docs/handling-different-data-types/#reading-numbers-of-different-types-from-json). Drill extends SQL to provide access to repeating values in arrays and arrays within arrays (array indexes). You can use these extensions to reach into deeply nested data. Drill extensions use standard JavaScript notation for referencing data elements in a hierarchy, as shown in ["Analyzing JSON."]({{ site.baseurl }}/docs/json-data-model#analyzing-json) +For reading JSON numbers as DOUBLE or reading all JSON data as VARCHAR, use a [store.json option]({{site.baseurl}}/docs/handling-different-data-types/#reading-numbers-of-different-types-from-json). Drill extends SQL to provide access to repeating values in arrays and arrays within arrays (array indexes). You can use these extensions to reach into deeply nested data. Drill extensions use standard JavaScript notation for referencing data elements in a hierarchy, as shown in ["Analyzing JSON."]({{ site.baseurl }}/docs/json-data-model/#analyzing-json) ## Extensions for Parquet Data Sources SQL does not support all Parquet data types, so Drill infers data types in many instances. Users [cast] ({{ site.baseurl }}/docs/sql-functions) data types to ensure getting a particular data type. Drill offers more liberal casting capabilities than SQL for Parquet conversions if the Parquet data is of a logical type. You can use the default dfs storage plugin installed with Drill for reading and writing Parquet files as shown in the section, [âParquet Format.â]({{ site.baseurl }}/docs/parquet-format) http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/sql-reference/data-types/010-supported-data-types.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/data-types/010-supported-data-types.md b/_docs/sql-reference/data-types/010-supported-data-types.md index 6f07a62..9bc0c23 100644 --- a/_docs/sql-reference/data-types/010-supported-data-types.md +++ b/_docs/sql-reference/data-types/010-supported-data-types.md @@ -79,23 +79,23 @@ changes in the data processing, Drill regenerates the code as necessary. In Drill, you cast or convert data to the required type for moving data from one data source to another. You do not assign a data type to every column name in a CREATE TABLE statement to define the table as you do in database software. Instead, you use the CREATE TABLE AS (CTAS) statement with one or more of the following functions to define the table: -* [CAST]({{ site.baseurl }}/docs/data-type-conversion#cast) -* [CONVERT TO/FROM]({{ site.baseurl }}/docs/data-type-conversion#convert_to-and-convert_from) +* [CAST]({{ site.baseurl }}/docs/data-type-conversion/#cast) +* [CONVERT TO/FROM]({{ site.baseurl }}/docs/data-type-conversion/#convert_to-and-convert_from) Use the [CONVERT TO AND CONVERT FROM data types]({{ site.baseurl }}/docs/supported-data-types/#data-types-for-convert_to-and-convert_from-functions) -* Other [data conversion functions]({{ site.baseurl }}/docs/data-type-conversion#other-data-type-conversions) +* Other [data conversion functions]({{ site.baseurl }}/docs/data-type-conversion/#other-data-type-conversions) In some cases, Drill converts schema-less data to correctly-typed data implicitly. In this case, you do not need to cast the data. The file format of the data and the nature of your query determines the requirement for casting or converting. Differences in casting depend on the data source. The following list describes how Drill treats data types from various data sources: * HBase Does not implicitly cast input to SQL types. Convert data to appropriate types as as described in the section ["Querying HBase"]({{ site.baseurl}}/docs/querying-hbase/). Use [CONVERT_TO or CONVERT_FROM data types]({{ site.baseurl }}/docs//data-type-conversion/#convert_to-and-convert_from). * Hive - Implicitly casts Hive types to SQL types as shown in the Hive [type mapping example]({{ site.baseurl }}/docs/hive-to-drill-data-type-mapping#type-mapping-example) + Implicitly casts Hive types to SQL types as shown in the Hive [type mapping example]({{ site.baseurl }}/docs/hive-to-drill-data-type-mapping/#type-mapping-example) * JSON - Implicitly casts JSON data to its [corresponding SQL types]({{ site.baseurl }}/docs/json-data-model#data-type-mapping) or to VARCHAR if Drill is in all text mode. + Implicitly casts JSON data to its [corresponding SQL types]({{ site.baseurl }}/docs/json-data-model/#data-type-mapping) or to VARCHAR if Drill is in all text mode. * MapR-DB Implicitly casts MapR-DB data to SQL types when you use [the maprdb format]({{ site.baseurl }}/docs/mapr-db-format) for reading MapR-DB data. The dfs storage plugin defines the format when you install Drill from the mapr-drill package on a MapR node. * Parquet - Implicitly casts Parquet data to the SQL types shown in [SQL Data Types to Parquet]({{ site.baseurl }}/docs/parquet-format#sql-data-types-to-parquet). + Implicitly casts Parquet data to the SQL types shown in [SQL Data Types to Parquet]({{ site.baseurl }}/docs/parquet-format/#sql-data-types-to-parquet). * Text: CSV, TSV, and other text Implicitly casts all textual data to VARCHAR. @@ -129,7 +129,7 @@ As shown in the table, Drill can cast a NULL value, which has the lowest precede In a textual file, such as CSV, Drill interprets every field as a VARCHAR, as previously mentioned. To handle textual data, you can use the following functions to cast and convert compatible data types: -* [CAST]({{ site.baseurl }}/docs/data-type-conversion#cast) +* [CAST]({{ site.baseurl }}/docs/data-type-conversion/#cast) Casts data from one data type to another. * CONVERT_TO and CONVERT_FROM functions Converts data, including binary data, from one data type to another using ["CONVERT_TO and CONVERT_FROM data types"]({{ site.baseurl }}/docs/supported-data-types/#data-types-for-convert_to-and-convert_from-functions) http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/sql-reference/data-types/020-date-time-and-timestamp.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/data-types/020-date-time-and-timestamp.md b/_docs/sql-reference/data-types/020-date-time-and-timestamp.md index e0e9eb1..0def79c 100644 --- a/_docs/sql-reference/data-types/020-date-time-and-timestamp.md +++ b/_docs/sql-reference/data-types/020-date-time-and-timestamp.md @@ -114,7 +114,7 @@ The following examples show the input and output format of INTERVALYEAR (Year, M DATE, TIME, and TIMESTAMP literals. Drill stores values in Coordinated Universal Time (UTC). Drill supports time functions in the range 1971 to 2037. -Drill does not support TIMESTAMP with time zone; however, if your data includes the time zone, use the [TO_TIMESTAMP function]({{ site.baseurl }}/docs/casting/converting-data-types#to_timestamp) and [Joda format specifiers]({{site.baseurl}}/docs/data-type-conversion/#format-specifiers-for-date/time-conversions) as shown the examples in section, ["Time Zone Limitation"]({{site.baseurl}}/docs/data-type-conversion/#time-zone-limitation). +Drill does not support TIMESTAMP with time zone; however, if your data includes the time zone, use the [TO_TIMESTAMP function]({{ site.baseurl }}/docs/casting/converting-data-types/#to_timestamp) and [Joda format specifiers]({{site.baseurl}}/docs/data-type-conversion/#format-specifiers-for-date/time-conversions) as shown the examples in section, ["Time Zone Limitation"]({{site.baseurl}}/docs/data-type-conversion/#time-zone-limitation). Next, use the following literals in a SELECT statement. http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/sql-reference/sql-functions/020-data-type-conversion.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/sql-functions/020-data-type-conversion.md b/_docs/sql-reference/sql-functions/020-data-type-conversion.md index 2cac018..e2d918d 100644 --- a/_docs/sql-reference/sql-functions/020-data-type-conversion.md +++ b/_docs/sql-reference/sql-functions/020-data-type-conversion.md @@ -4,10 +4,10 @@ parent: "SQL Functions" --- Drill supports the following functions for casting and converting data types: -* [CAST]({{ site.baseurl }}/docs/data-type-conversion#cast) -* [CONVERT_TO and CONVERT_FROM]({{ site.baseurl }}/docs/data-type-conversion#convert_to-and-convert_from) -* [STRING_BINARY]({{ site.baseurl }}/docs/data-type-conversion#string_binary-function) and [BINARY_STRING]({{ site.baseurl }}/docs/data-type-conversion#binary_string-function) -* [Other Data Type Conversions]({{ site.baseurl }}/docs/data-type-conversion#other-data-type-conversions) +* [CAST]({{ site.baseurl }}/docs/data-type-conversion/#cast) +* [CONVERT_TO and CONVERT_FROM]({{ site.baseurl }}/docs/data-type-conversion/#convert_to-and-convert_from) +* [STRING_BINARY]({{ site.baseurl }}/docs/data-type-conversion/#string_binary-function) and [BINARY_STRING]({{ site.baseurl }}/docs/data-type-conversion#binary_string-function) +* [Other Data Type Conversions]({{ site.baseurl }}/docs/data-type-conversion/#other-data-type-conversions) ## CAST @@ -158,7 +158,7 @@ Drill can optimize scans of HBase tables when you use the \*\_BE encoded types s CONVERT_TO also converts an SQL data type to complex types, including HBase byte arrays, JSON and Parquet arrays, and maps. CONVERT_FROM converts from complex types, including HBase arrays, JSON and Parquet arrays and maps to an SQL data type. -You can use [STRING_BINARY]({{ site.baseurl }}/docs/data-type-conversion#string_binary-function) and [BINARY_STRING]({{ site.baseurl }}/docs/data-type-conversion#binary_string-function) custom Drill functions with CONVERT_TO and CONVERT_FROM to get meaningful results. +You can use [STRING_BINARY]({{ site.baseurl }}/docs/data-type-conversion/#string_binary-function) and [BINARY_STRING]({{ site.baseurl }}/docs/data-type-conversion/#binary_string-function) custom Drill functions with CONVERT_TO and CONVERT_FROM to get meaningful results. ### Conversion of Data Types Examples http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/sql-reference/sql-functions/030-date-time-functions-and-arithmetic.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/sql-functions/030-date-time-functions-and-arithmetic.md b/_docs/sql-reference/sql-functions/030-date-time-functions-and-arithmetic.md index 36e65cd..6269182 100644 --- a/_docs/sql-reference/sql-functions/030-date-time-functions-and-arithmetic.md +++ b/_docs/sql-reference/sql-functions/030-date-time-functions-and-arithmetic.md @@ -9,14 +9,14 @@ This section covers the Drill [time zone limitation]({{site.baseurl}}/docs/data- **Function**| **Return Type** ---|--- -[AGE(TIMESTAMP)]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic#age) | INTERVALDAY or INTERVALYEAR -[EXTRACT(field from time_expression)]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic#extract) | DOUBLE +[AGE(TIMESTAMP)]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#age) | INTERVALDAY or INTERVALYEAR +[EXTRACT(field from time_expression)]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#extract) | DOUBLE [CURRENT_DATE]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#other-date-and-time-functions) | DATE [CURRENT_TIME]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#other-date-and-time-functions) | TIME [CURRENT_TIMESTAMP]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#other-date-and-time-functions) | TIMESTAMP -[DATE_ADD]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic#date_add) | DATE, TIMESTAMP -[DATE_PART]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic#date_part) | DOUBLE -[DATE_SUB]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic#date_sub) | DATE, TIMESTAMP +[DATE_ADD]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#date_add) | DATE, TIMESTAMP +[DATE_PART]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#date_part) | DOUBLE +[DATE_SUB]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#date_sub) | DATE, TIMESTAMP [LOCALTIME]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#other-date-and-time-functions) | TIME [LOCALTIMESTAMP]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#other-date-and-time-functions) | TIMESTAMP [NOW]({{ site.baseurl }}/docs/date-time-functions-and-arithmetic/#other-date-and-time-functions) | TIMESTAMP http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/sql-reference/sql-functions/040-string-manipulation.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/sql-functions/040-string-manipulation.md b/_docs/sql-reference/sql-functions/040-string-manipulation.md index 3993824..5540cc3 100644 --- a/_docs/sql-reference/sql-functions/040-string-manipulation.md +++ b/_docs/sql-reference/sql-functions/040-string-manipulation.md @@ -7,22 +7,22 @@ You can use the following string functions in Drill queries: Function| Return Type --------|--- -[BYTE_SUBSTR]({{ site.baseurl }}/docs/string-manipulation#byte_substr)|BINARY or VARCHAR -[CHAR_LENGTH]({{ site.baseurl }}/docs/string-manipulation#char_length)| INTEGER -[CONCAT]({{ site.baseurl }}/docs/string-manipulation#concat)| VARCHAR -[INITCAP]({{ site.baseurl }}/docs/string-manipulation#initcap)| VARCHAR -[LENGTH]({{ site.baseurl }}/docs/string-manipulation#length)| INTEGER -[LOWER]({{ site.baseurl }}/docs/string-manipulation#lower)| VARCHAR -[LPAD]({{ site.baseurl }}/docs/string-manipulation#lpad)| VARCHAR -[LTRIM]({{ site.baseurl }}/docs/string-manipulation#ltrim)| VARCHAR -[POSITION]({{ site.baseurl }}/docs/string-manipulation#position)| INTEGER -[REGEXP_REPLACE]({{ site.baseurl }}/docs/string-manipulation#regexp_replace)|VARCHAR -[RPAD]({{ site.baseurl }}/docs/string-manipulation#rpad)| VARCHAR -[RTRIM]({{ site.baseurl }}/docs/string-manipulation#rtrim)| VARCHAR -[STRPOS]({{ site.baseurl }}/docs/string-manipulation#strpos)| INTEGER -[SUBSTR]({{ site.baseurl }}/docs/string-manipulation#substr)| VARCHAR -[TRIM]({{ site.baseurl }}/docs/string-manipulation#trim)| VARCHAR -[UPPER]({{ site.baseurl }}/docs/string-manipulation#upper)| VARCHAR +[BYTE_SUBSTR]({{ site.baseurl }}/docs/string-manipulation/#byte_substr)|BINARY or VARCHAR +[CHAR_LENGTH]({{ site.baseurl }}/docs/string-manipulation/#char_length)| INTEGER +[CONCAT]({{ site.baseurl }}/docs/string-manipulation/#concat)| VARCHAR +[INITCAP]({{ site.baseurl }}/docs/string-manipulation/#initcap)| VARCHAR +[LENGTH]({{ site.baseurl }}/docs/string-manipulation/#length)| INTEGER +[LOWER]({{ site.baseurl }}/docs/string-manipulation/#lower)| VARCHAR +[LPAD]({{ site.baseurl }}/docs/string-manipulation/#lpad)| VARCHAR +[LTRIM]({{ site.baseurl }}/docs/string-manipulation/#ltrim)| VARCHAR +[POSITION]({{ site.baseurl }}/docs/string-manipulation/#position)| INTEGER +[REGEXP_REPLACE]({{ site.baseurl }}/docs/string-manipulation/#regexp_replace)|VARCHAR +[RPAD]({{ site.baseurl }}/docs/string-manipulation/#rpad)| VARCHAR +[RTRIM]({{ site.baseurl }}/docs/string-manipulation/#rtrim)| VARCHAR +[STRPOS]({{ site.baseurl }}/docs/string-manipulation/#strpos)| INTEGER +[SUBSTR]({{ site.baseurl }}/docs/string-manipulation/#substr)| VARCHAR +[TRIM]({{ site.baseurl }}/docs/string-manipulation/#trim)| VARCHAR +[UPPER]({{ site.baseurl }}/docs/string-manipulation/#upper)| VARCHAR ## BYTE_SUBSTR Returns in binary format a substring of a string. @@ -99,7 +99,7 @@ Concatenates arguments. +--------------------+ 1 row selected (0.134 seconds) -Alternatively, you can use the [string concatenation operation]({{ site.baseurl }}/docs/operators#string-concatenate-operator) to concatenate strings. +Alternatively, you can use the [string concatenation operation]({{ site.baseurl }}/docs/operators/#string-concatenate-operator) to concatenate strings. ## INITCAP Returns the string using initial caps. http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/tutorials/010-tutorials-introduction.md ---------------------------------------------------------------------- diff --git a/_docs/tutorials/010-tutorials-introduction.md b/_docs/tutorials/010-tutorials-introduction.md index cadc147..0771ec9 100644 --- a/_docs/tutorials/010-tutorials-introduction.md +++ b/_docs/tutorials/010-tutorials-introduction.md @@ -14,6 +14,8 @@ If you've never used Drill, use these tutorials to download, install, and start Learn how to handle dynamic data without changing a schema or going through an ETL phase. * [Analyzing Social Media]({{site.baseurl}}/docs/analyzing-social-media) Analyze Twitter data in its native JSON format using Drill. +* [Analyzing Data Using Window Functions]({{site.baseurl}}/docs/analyzing-data-using-window-functions) + Learn how to use analytic/window functions. * [Tableau Examples]({{site.baseurl}}/docs/tableau-examples) Access Hive tables using Drill and Tableau. * [Using MicroStrategy Analytics with Apache Drill]({{site.baseurl}}/docs/using-microstrategy-analytics-with-apache-drill/) @@ -26,7 +28,7 @@ If you've never used Drill, use these tutorials to download, install, and start Connect Tableau 9 Desktop to Apache Drill, explore multiple data formats on Hadoop, and access semi-structured data. * [Using Apache Drill with Tableau 9 Server]({{site.baseurl}}/docs/using-apache-drill-with-tableau-9-server) Connect Tableau 9 Server to Apache Drill, explore multiple data formats on Hadoop, access semi-structured data, and share Tableau visualizations with others. -* [Using Drill to Analyze Amazon Spot Prices](https://github.com/vicenteg/spot-price-history#drill-workshop---amazon-spot-prices) +* [Using Drill to Analyze Amazon Spot Prices](https://github.com/vicenteg/spot-price-history/#drill-workshop---amazon-spot-prices) Use a Drill workshop on github to create views of JSON and Parquet data. * [Running Drill Queries on S3 Data](http://drill.apache.org/blog/2014/12/09/running-sql-queries-on-amazon-s3/) Step through querying files using Drill and Amazon Simple Storage Service (S3). http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/tutorials/020-drill-in-10-minutes.md ---------------------------------------------------------------------- diff --git a/_docs/tutorials/020-drill-in-10-minutes.md b/_docs/tutorials/020-drill-in-10-minutes.md index 5039375..dcdcedf 100755 --- a/_docs/tutorials/020-drill-in-10-minutes.md +++ b/_docs/tutorials/020-drill-in-10-minutes.md @@ -73,7 +73,7 @@ Start Drill in embedded mode using the `drill-embedded` command: The message of the day followed by the [`0: jdbc:drill:zk=local>` prompt]({{site.baseurl}}/docs/starting-drill-on-linux-and-mac-os-x/#about-the-drill-prompt) appears. - At this point, you can [submit queries]({{site.baseurl}}/docs/drill-in-10-minutes#query-sample-data) to Drill. + At this point, you can [submit queries]({{site.baseurl}}/docs/drill-in-10-minutes/#query-sample-data) to Drill. ### Install Drill on Windows @@ -98,7 +98,7 @@ Start the Drill shell using the **sqlline command**. Complete the following step ``sqlline.bat -u "jdbc:drill:zk=local"``  -The `zk=local` means the local node is the ZooKeeper node. At this point, you can [run queries]({{ site.baseurl }}/docs/drill-in-10-minutes#query-sample-data). +The `zk=local` means the local node is the ZooKeeper node. At this point, you can [run queries]({{ site.baseurl }}/docs/drill-in-10-minutes/#query-sample-data). ## Stopping Drill http://git-wip-us.apache.org/repos/asf/drill/blob/c902b0b3/_docs/tutorials/070-analyzing-data-using-window-functions.md ---------------------------------------------------------------------- diff --git a/_docs/tutorials/070-analyzing-data-using-window-functions.md b/_docs/tutorials/070-analyzing-data-using-window-functions.md new file mode 100644 index 0000000..9200a6f --- /dev/null +++ b/_docs/tutorials/070-analyzing-data-using-window-functions.md @@ -0,0 +1,242 @@ +--- +title: "Analyzing Data Using Window Functions" +parent: "Tutorials" +--- + +This tutorial briefly introduces the analytics in Drill 1.2, namely ANSI SQL-compliant Analytic and Window functions. Drill supports the following SQL window functions: + +* PARTITION BY and OVER clauses +* A variety of aggregated window functions for Sum, Max, Min, Count, Avg +* Analytic functions such as First_Value, Last_Value, Lead, Lag, NTile, Row_Number, and Rank + +Window functions are highly versatile. You can reduce the joins, subqueries, and explicit cursors that you need to write. Window functions solve a variety of use cases with minimal coding effort. + +This tutorial builds on previous tutorials, [Analyzing the Yelp Academic Dataset]({{site.baseurl}}/docs/analyzing-the-yelp-academic-dataset/) and [Analyzing Highly Dynamic Datasets]({{site.baseurl}}/docs/analyzing-highly-dynamic-datasets/), and uses the same Yelp dataset. + +---------- + +## Getting Started + +1. To get started, download the [Yelp](http://www.yelp.com/dataset_challenge) (business reviews) now. + +2. [Install and start Drill]({{site.baseurl}}/docs/analyzing-the-yelp-academic-dataset/#installing-and-starting-drill). + +3. List the available schemas in Drill. + + SHOW schemas; + +---------------------+ + | SCHEMA_NAME | + +---------------------+ + | INFORMATION_SCHEMA | + | cp.default | + | dfs.default | + | dfs.root | + | dfs.tmp | + | dfs.yelp | + | sys | + +---------------------+ + + 7 rows selected (1.755 seconds) + +4. Switch to using the workspace in which Yelp data is loaded. + + USE dfs.yelp; + + +-------+---------------------------------------+ + | ok | summary | + +-------+---------------------------------------+ + | true | Default schema changed to [dfs.yelp] | + +-------+---------------------------------------+ + + 1 row selected (0.129 seconds) + +5. Start with exploring one of the datasets available in Yelp dataset - the business information. + + SELECT * FROM `business.json` LIMIT 1; + + +------------------------+-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+--------------------------------+---------+--------------+-------------------+-------------+-------+-------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------------+ + | business_id | full_address | hours | open | categories | city | review_count | name | longitude | state | stars | latitude | attributes | type | neighborhoods | + +------------------------+--------------+------+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+--------------------------------+---------+--------------+-------------------+-------------+-------+-------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------------+ + | vcNAWiLM4dR7D2nwwJ7nCA | 4840 E Indian School Rd Ste 101 Phoenix, AZ 85018 | {"Tuesday":{"close":"17:00","open":"08:00"},"Friday":{"close":"17:00","open":"08:00"},"Monday":{"close":"17:00","open":"08:00"},"Wednesday":{"close":"17:00","open":"08:00"},"Thursday":{"close":"17:00","open":"08:00"},"Sunday":{},"Saturday":{}} | true | ["Doctors","Health & Medical"] | Phoenix | 7 | Eric Goldberg, MD | -111.983758 | AZ | 3.5 | 33.499313 | {"By Appointment Only":true,"Good Ambience":{},"Parking":{},"Music":{},"Hair Types Specialized In":{},"Payment Types":{},"Dietary Restrictions":{}} | business | [] | + +-------------+--------------+-------+------+------------+------+--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+--------------------------------+---------+--------------+-------------------+-------------+-------+-------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------------+ + 1 row selected (0.514 seconds) + +---------- + +## Use Window Functions for Simple Queries + +1. Get the top Yelp businesses based on the number reviews in each city and the row number of the business. + + SELECT name, city, review_count, row_number() + OVER (PARTITION BY city ORDER BY review_count DESC) AS rownum + FROM `business.json` LIMIT 15; + + +----------------------------------------+------------+---------------+---------+ + | name | city | review_count | rownum | + +----------------------------------------+------------+---------------+---------+ + | Cupz N' Crepes | Ahwatukee | 124 | 1 | + | My Wine Cellar | Ahwatukee | 98 | 2 | + | Kathy's Alterations | Ahwatukee | 12 | 3 | + | McDonald's | Ahwatukee | 7 | 4 | + | U-Haul | Ahwatukee | 5 | 5 | + | Hi-Health | Ahwatukee | 4 | 6 | + | Healthy and Clean Living Environments | Ahwatukee | 4 | 7 | + | Active Kids Pediatrics | Ahwatukee | 4 | 8 | + | Roberto's Authentic Mexican Food | Anthem | 117 | 1 | + | Q to U BBQ | Anthem | 74 | 2 | + | Outlets At Anthem | Anthem | 64 | 3 | + | Dara Thai | Anthem | 56 | 4 | + | Cafe Provence | Anthem | 53 | 5 | + | Shanghai Club | Anthem | 50 | 6 | + | Two Brothers Kitchen | Anthem | 43 | 7 | + +----------------------------------------+------------+---------------+---------+ + 15 rows selected (0.67 seconds) + +2. Check the number reviews for each business compared to the average number of reviews across all business in the city. + + SELECT name, city,review_count, + Avg(review_count) OVER (PARTITION BY City) AS city_reviews_avg + FROM `business.json` LIMIT 15; + + +----------------------------------------+------------+---------------+---------------------+ + | name | city | review_count | city_reviews_avg | + +----------------------------------------+------------+---------------+---------------------+ + | Hi-Health | Ahwatukee | 4 | 32.25 | + | My Wine Cellar | Ahwatukee | 98 | 32.25 | + | U-Haul | Ahwatukee | 5 | 32.25 | + | Cupz N' Crepes | Ahwatukee | 124 | 32.25 | + | McDonald's | Ahwatukee | 7 | 32.25 | + | Kathy's Alterations | Ahwatukee | 12 | 32.25 | + | Healthy and Clean Living Environments | Ahwatukee | 4 | 32.25 | + | Active Kids Pediatrics | Ahwatukee | 4 | 32.25 | + | Anthem Community Center | Anthem | 4 | 14.492063492063492 | + | Scrapbooks To Remember | Anthem | 4 | 14.492063492063492 | + | Hungry Howie's Pizza | Anthem | 7 | 14.492063492063492 | + | Pinata Nueva | Anthem | 3 | 14.492063492063492 | + | Starbucks Coffee Company | Anthem | 13 | 14.492063492063492 | + | Pizza Hut | Anthem | 6 | 14.492063492063492 | + | Rays Pizza | Anthem | 19 | 14.492063492063492 | + +----------------------------------------+------------+---------------+---------------------+ + 15 rows selected (0.395 seconds) + +3. Check how the number of reviews for each business contribute to the total number of reviews for all businesses in the city. + + SELECT name, city,review_count, + Sum(review_count) OVER (PARTITION BY City) AS city_reviews_sum + FROM `business.json`limit 15; + + +----------------------------------------+------------+---------------+-------------------+ + | name | city | review_count | city_reviews_sum | + +----------------------------------------+------------+---------------+-------------------+ + | Hi-Health | Ahwatukee | 4 | 258 | + | My Wine Cellar | Ahwatukee | 98 | 258 | + | U-Haul | Ahwatukee | 5 | 258 | + | Cupz N' Crepes | Ahwatukee | 124 | 258 | + | McDonald's | Ahwatukee | 7 | 258 | + | Kathy's Alterations | Ahwatukee | 12 | 258 | + | Healthy and Clean Living Environments | Ahwatukee | 4 | 258 | + | Active Kids Pediatrics | Ahwatukee | 4 | 258 | + | Anthem Community Center | Anthem | 4 | 913 | + | Scrapbooks To Remember | Anthem | 4 | 913 | + | Hungry Howie's Pizza | Anthem | 7 | 913 | + | Pinata Nueva | Anthem | 3 | 913 | + | Starbucks Coffee Company | Anthem | 13 | 913 | + | Pizza Hut | Anthem | 6 | 913 | + | Rays Pizza | Anthem | 19 | 913 | + +----------------------------------------+------------+---------------+-------------------+ + 15 rows selected (0.543 seconds) + + +---------- + +## Use Window Functions for Complex Queries + +1. List Top 10 cities and their highest ranked businesses in terms of number of reviews. Use Drill window functions such as rank, dense_rank in these queries. + + WITH X + AS + (SELECT name, city, review_count, + RANK() + OVER (PARTITION BY city + ORDER BY review_count DESC) AS review_rank + FROM `business.json`) + SELECT X.name, X.city, X.review_count + FROM X + WHERE X.review_rank =1 ORDER BY review_count DESC LIMIT 10; + + +-------------------------------------------+-------------+---------------+ + | name | city | review_count | + +-------------------------------------------+-------------+---------------+ + | Mon Ami Gabi | Las Vegas | 4084 | + | Studio B | Henderson | 1336 | + | Phoenix Sky Harbor International Airport | Phoenix | 1325 | + | Four Peaks Brewing Co | Tempe | 1110 | + | The Mission | Scottsdale | 783 | + | Joe's Farm Grill | Gilbert | 770 | + | The Old Fashioned | Madison | 619 | + | Cornish Pasty Company | Mesa | 578 | + | SanTan Brewing Company | Chandler | 469 | + | Yard House | Glendale | 321 | + +-------------------------------------------+-------------+---------------+ + 10 rows selected (0.49 seconds) + +2. Compare the number of reviews for each business with the top and bottom review counts in the city. + + SELECT name, city, review_count, + FIRST_VALUE(review_count) + OVER(PARTITION BY city ORDER BY review_count DESC) AS top_review_count, + LAST_VALUE(review_count) + OVER(PARTITION BY city ORDER BY review_count DESC) AS bottom_review_count + FROM `business.json` limit 15; + + +----------------------------------------+------------+---------------+-------------------+----------------------+ + | name | city | review_count | top_review_count | bottom_review_count | + +----------------------------------------+------------+---------------+-------------------+----------------------+ + | My Wine Cellar | Ahwatukee | 98 | 124 | 12 | + | McDonald's | Ahwatukee | 7 | 124 | 12 | + | U-Haul | Ahwatukee | 5 | 124 | 12 | + | Hi-Health | Ahwatukee | 4 | 124 | 12 | + | Healthy and Clean Living Environments | Ahwatukee | 4 | 124 | 12 | + | Active Kids Pediatrics | Ahwatukee | 4 | 124 | 12 | + | Cupz N' Crepes | Ahwatukee | 124 | 124 | 12 | + | Kathy's Alterations | Ahwatukee | 12 | 124 | 12 | + | Q to U BBQ | Anthem | 74 | 117 | 117 | + | Dara Thai | Anthem | 56 | 117 | 117 | + | Cafe Provence | Anthem | 53 | 117 | 117 | + | Shanghai Club | Anthem | 50 | 117 | 117 | + | Two Brothers Kitchen | Anthem | 43 | 117 | 117 | + | The Tennessee Grill | Anthem | 32 | 117 | 117 | + | Dollyrockers Boutique and Salon | Anthem | 30 | 117 | 117 | + +----------------------------------------+------------+---------------+-------------------+----------------------+ + 15 rows selected (0.516 seconds) + + +3. Compare the number of reviews with the number of reviews for the previous and following businesses. + + SELECT city, review_count, name, + LAG(review_count, 1) OVER(PARTITION BY city ORDER BY review_count DESC) + AS preceding_count, + LEAD(review_count, 1) OVER(PARTITION BY city ORDER BY review_count DESC) + AS following_count + FROM `business.json` limit 15; + + +------------+---------------+----------------------------------------+------------------+------------------+ + | city | review_count | name | preceding_count | following_count | + +------------+---------------+----------------------------------------+------------------+------------------+ + | Ahwatukee | 124 | Cupz N' Crepes | null | 98 | + | Ahwatukee | 98 | My Wine Cellar | 124 | 12 | + | Ahwatukee | 12 | Kathy's Alterations | 98 | 7 | + | Ahwatukee | 7 | McDonald's | 12 | 5 | + | Ahwatukee | 5 | U-Haul | 7 | 4 | + | Ahwatukee | 4 | Hi-Health | 5 | 4 | + | Ahwatukee | 4 | Healthy and Clean Living Environments | 4 | 4 | + | Ahwatukee | 4 | Active Kids Pediatrics | 4 | null | + | Anthem | 117 | Roberto's Authentic Mexican Food | null | 74 | + | Anthem | 74 | Q to U BBQ | 117 | 64 | + | Anthem | 64 | Outlets At Anthem | 74 | 56 | + | Anthem | 56 | Dara Thai | 64 | 53 | + | Anthem | 53 | Cafe Provence | 56 | 50 | + | Anthem | 50 | Shanghai Club | 53 | 43 | + | Anthem | 43 | Two Brothers Kitchen | 50 | 32 | + +------------+---------------+----------------------------------------+------------------+------------------+ + 15 rows selected (0.518 seconds) \ No newline at end of file
