Repository: drill Updated Branches: refs/heads/gh-pages d73947b7c -> 5d6b93e22
http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/configure-drill/securing-drill/040-configuring-user-impersonation.md ---------------------------------------------------------------------- diff --git a/_docs/configure-drill/securing-drill/040-configuring-user-impersonation.md b/_docs/configure-drill/securing-drill/040-configuring-user-impersonation.md index de839de..3c6e852 100644 --- a/_docs/configure-drill/securing-drill/040-configuring-user-impersonation.md +++ b/_docs/configure-drill/securing-drill/040-configuring-user-impersonation.md @@ -1,6 +1,6 @@ --- title: "Configuring User Impersonation" -date: 2018-04-05 01:05:13 UTC +date: 2018-04-19 01:45:22 UTC parent: "Securing Drill" --- Impersonation allows a service to act on behalf of a client while performing the action requested by the client. By default, user impersonation is disabled in Drill. You can configure user impersonation in the <DRILLINSTALL_HOME>/conf/drill-override.conf file. @@ -27,7 +27,7 @@ The following table lists the clients, storage plugins, and types of queries tha | Queries | When you enable impersonation, the setting applies to queries on data and metadata. For example, if you issue the SHOW SCHEMAS command, Drill impersonates the user logged into the client to access the requested metadata. If you issue a SELECT query on a workspace, Drill impersonates the user logged in to the client to access the requested data. Drill applies impersonation to queries issued using the following commands: SHOW SCHEMAS, SHOW DATABASES, SHOW TABLES, CTAS, SELECT, CREATE VIEW, DROP VIEW, SHOW FILES. To successfully run the CTAS and CREATE VIEW commands, a user must have write permissions on the directory where the table or view will exist. Running these commands creates artifacts on the file system. | | ## Impersonation and Views -You can use views with impersonation to provide granular access to data and protect sensitive information. When you create a view, Drill stores the view definition in a file and suffixes the file with .drill.view. For example, if you create a view named myview, Drill creates a view file named myview.drill.view and saves it in the current workspace or the workspace specified, such as dfs.views.myview. See [CREATE VIEW]({{site.baseurl}}/docs/create-view) Command. +You can use views with impersonation to provide granular access to data and protect sensitive information. When you create a view, Drill stores the view definition in a file and suffixes the file with view.drill. For example, if you create a view named myview, Drill creates a view file named myview.view.drill and saves it in the current workspace or the workspace specified, such as dfs.views.myview. See [CREATE VIEW]({{site.baseurl}}/docs/create-view) Command. You can create a view and grant read permissions on the view to give other users access to the data that the view references. When a user queries the view, Drill impersonates the view owner to access the underlying data. If the user tries to access the data directory, Drill returns a permission denied error. A user with read access to a view can create new views from the originating view to further restrict access on data. @@ -46,7 +46,7 @@ Use the `chmod` and `chown` commands with the appropriate octal code to change p hadoop fs âchmod <octal code> <file_name> hadoop fs âchown <user>:<group> <file_name> -Example: `hadoop fs âchmod 750 employees.drill.view` +Example: `hadoop fs âchmod 750 employees.view.drill` ### Modifying SYSTEM|SESSION Level View Permissions @@ -124,9 +124,9 @@ emp_id, emp_name, emp_ssn, emp_salary, emp_addr, emp_phone, emp_mgr Frank needs to share a subset of this information with Joe who is an HR manager reporting to Frank. To share the employee data, Frank creates a view called emp_mgr_view that accesses a subset of the data. The emp_mgr_view filters out sensitive employee information, such as the employee social security numbers, and only shows data for the employees that report directly to Joe. Frank and Joe both belong to the mgr group. Managers have read permission on Frankâs directory. -rwxr----- frank:mgr /user/frank/emp_mgr_view.drill.view +rwxr----- frank:mgr /user/frank/emp_mgr_view.view.drill -The emp_mgr_view.drill.view file contains the following view definition: +The emp_mgr_view.view.drill file contains the following view definition: (view definition: SELECT emp_id, emp_name, emp_salary, emp_addr, emp_phone FROM \`/user/frank/employee\` WHERE emp_mgr = 'Joe') @@ -136,9 +136,9 @@ Because Joe has read permissions on the emp_mgr_view, he can create new views fr Joe needs to share employee contact data with his direct reports, so he creates a special view called emp_team_view to share the employee contact information with his team. Joe creates the view and writes it to his home directory. Joe and his reports belong to a group named joeteam. The joeteam group has read permissions on Joeâs home directory so they can query the view and create new views from it. -rwxr----- joe:joeteam /user/joe/emp_team_view.drill.view +rwxr----- joe:joeteam /user/joe/emp_team_view.view.drill -The emp_team_view.drill.view file contains the following view definition: +The emp_team_view.view.drill file contains the following view definition: (view definition: SELECT emp_id, emp_name, emp_phone FROM \`/user/frank/emp_mgr_view.drill\`); http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/data-sources-and-file-formats/010-data-sources-and-file-formats-introduction.md ---------------------------------------------------------------------- diff --git a/_docs/data-sources-and-file-formats/010-data-sources-and-file-formats-introduction.md b/_docs/data-sources-and-file-formats/010-data-sources-and-file-formats-introduction.md index 276eea8..dcfdea3 100644 --- a/_docs/data-sources-and-file-formats/010-data-sources-and-file-formats-introduction.md +++ b/_docs/data-sources-and-file-formats/010-data-sources-and-file-formats-introduction.md @@ -1,14 +1,17 @@ --- title: "Data Sources and File Formats Introduction" -date: 2016-05-05 21:44:33 UTC +date: 2018-04-19 01:45:23 UTC parent: "Data Sources and File Formats" --- -Included in the data sources that Drill supports are these key data sources: +Drill supports the following key data sources: * HBase * Hive * MapR-DB -* File system +* File system +* ... + +See [Connect a Data Source]({{site.baseurl}}/docs/connect-a-data-source/) for a complete list of supported data sources that you can configure in Drill. Drill considers data sources to have either a strong schema or a weak schema. @@ -41,5 +44,23 @@ Drill supports the following input formats for data: You set the input format for data coming from data sources to Drill in the workspace portion of the [storage plugin]({{ site.baseurl }}/docs/storage-plugin-registration) definition. The default input format in Drill is Parquet. -You change one of the `store` property in the [sys.options table]({{ site.baseurl }}/docs/configuration-options-introduction/) to set the output format of Drill data. The default storage format for Drill CREATE TABLE AS (CTAS) statements is Parquet. +You change one of the `store` properties in the [sys.options table]({{ site.baseurl }}/docs/configuration-options-introduction/) to set the output format of Drill data. The default storage format for Drill CREATE TABLE AS (CTAS) statements is Parquet. + +##Schemaless Tables +As of Drill 1.13, Drill supports queries on empty directories. Empty directories are directories that exist, but do not contain files. Currently, an empty directory in Drill is a Drill table without a schema, or a âschemalessâ table. An empty directory with Parquet metadata cache files is also a schemaless table in Drill. + +Drill supports queries with JOIN and UNION [ALL] operators on empty directories. For example, if you issue the following queries with the UNION ALL operator, Drill queries the empty directory (empty_DIR) as a schemaless table and returns results for the query on the right side of the operator: + + 0: jdbc:drill:schema=dfs.tmp> select columns[0] from empty_DIR UNION ALL select cast(columns[0] as int) c1 from `testWindow.csv`; + +###Usage Notes + +- Queries with stars (*) on an empty directory return an empty result set. +- Fields indicated in the SELECT statement are returned as INT-OPTIONAL types. +- An empty directory in a query does not change the results; Drill returns results as if the query does not contain the UNION operator. +- You can use an empty directory in complex queries. +- Queries with joins return an empty result, except when using outer join clauses, when the outer table for "right join" or derived table for "left join" has data. In that case, Drill returns the data from the table with data. + + + http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/install/050-starting-drill-in-distributed-mode.md ---------------------------------------------------------------------- diff --git a/_docs/install/050-starting-drill-in-distributed-mode.md b/_docs/install/050-starting-drill-in-distributed-mode.md index beab40f..f1c3aaf 100644 --- a/_docs/install/050-starting-drill-in-distributed-mode.md +++ b/_docs/install/050-starting-drill-in-distributed-mode.md @@ -1,6 +1,6 @@ --- title: "Starting Drill in Distributed Mode" -date: 2018-03-21 01:38:36 UTC +date: 2018-04-19 01:45:24 UTC parent: "Installing Drill in Distributed Mode" --- @@ -82,48 +82,5 @@ To exit the Drill shell, issue the following command: `!quit` -## Shut Down the Drill Process on a Node - -You can abruptly stop the Drill process on a node, or you can gracefully shut down the Drill process on a node. When you stop the Drill process on a node, active queries cannot complete if they need additional time beyond the default five second wait period. In Drill 1.12 and later, you can use the graceful_stop command to transition a Drillbit into a quiescent state in which the Drillbit can complete in-progress queries before shutting down. - -###Stopping the Drill Process -To stop the Drill process on the node, issue the `drillbit.sh stop` command, as shown: - - bin/drillbit.sh stop - -###Gracefully Shutting Down the Drill Process - -Graceful shutdown is enabled by default. You can gracefully shut down a Drillbit from the command line or the Drill Web Console. When you initiate graceful shutdown from the Drill Web Console, the console posts an alert stating that a graceful shutdown was triggered. You can see the progress of the shut down as the Drillbit completes queries and transitions through the quiescent state. - -**How A Drillbit Shuts Down Gracefully** - -When a Drillbit shuts down gracefully, it transitions through a quiescent state to complete in-progress queries. - -The following list describes the various states that a Drillbit transitions through, including the quiescent state and phases within that state: - -- **Start**: The Drillbit is initializing. For example, when you issue the `drillbit.sh start` or `drillbit.sh restart` command. -- **Online**: The Drillbit has started and registered with the cluster coordinator, such as ZooKeeper. ZooKeeper then shares the state of the Drillbit with other Drillbits in the cluster. Drillbits in the online state can all accept and process queries. -- **Quiescent**: When a Drillbit receives a graceful shutdown request, the Drillbit transitions into the quiescent state and shares its status change with the ZooKeeper. The ZooKeeper notifies the other Drillbits in the cluster of the Drillbitâs status change. Once the other Drillbits get the status update, they do not assign work to the Drillbit. However, if the Foreman assigns work to the Drillbit as the status update occurs, the Drillbit waits to complete work before shutting down. The quiescent state has three phases: grace, draining, and offline. - - **Grace**: A period in which a Drillbit can accept new queries from the Foreman. You can configure (at the system level) the amount of time a Drillbit can remain in this phase using the `drill.exe.grace_period_ms` option. Set this value in milliseconds. The default value is 0. There is no maximum limit. Ideally, you should give as little time as possible or no longer than twice the default heartbeat time of the ZooKeeper. For example, if the heartbeat is 5 seconds, set the value to the equivalent of 10 seconds in milliseconds (10000). - - **Draining**: When the grace period ends, the Drillbit enters the draining phase of the quiescent state. In this phase, the Drillbit cannot accept new queries, but waits for the running queries to complete. You can view the draining queries in the Drill Web Console. The Index page in the Web Console shows the queries and fragments currently running on the node. - - **Offline**: The phase the Drillbit enters after completing all queries. -- **Shutdown**: The final state in which a Drillbit removes itself from the ZooKeeper registry. - -**Shutting Down a Drillbit Gracefully** -You can gracefully shut down a Drillbit from the command line or the Drill Web Console. - -From the command line, run the following command on the node you want to shut down: - - drillbit.sh graceful_stop - -From the Drill Web Console, enter the following URL in your browserâs address bar: - - http://<IP address or host name>:8047 or https://<IP address or host name>:8047 - -In the Drill Web Console, open the Index page, and click Shutdown next to the Drillbit you want to shut down. - - - - http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/install/060-starting-the-web-ui.md ---------------------------------------------------------------------- diff --git a/_docs/install/060-starting-the-web-ui.md b/_docs/install/060-starting-the-web-ui.md index 03320ce..da695b2 100644 --- a/_docs/install/060-starting-the-web-ui.md +++ b/_docs/install/060-starting-the-web-ui.md @@ -1,6 +1,6 @@ --- title: "Starting the Web Console" -date: 2018-04-03 23:37:00 UTC +date: 2018-04-19 01:45:25 UTC parent: Install Drill --- @@ -23,7 +23,7 @@ If [user authentication]({{site.baseurl}}/docs/configuring-user-authentication/) **Note:** As of Drill 1.12, users must enter a username to issue queries through the Query page in the Drill Web Console if user impersonation is enabled and authentication is disabled. To re-run a query from the Profiles page, users must also submit a username. See [REST API]({{site.baseurl}}/docs/submitting-queries-from-the-rest-api-when-impersonation-is-enabled-and-authentication-is-disabled/) for more information. -**Note:** As of Drill 1.13, an administrator can configure FORM and/or SPNEGO authentication mechanisms. The Drill Web Console provides two possible log in options for a user depending on the configuration. If a user selects FORM, he/she must enter their username and password to access restricted pages in the Drill Web Console. The user is authenticated through PAM. If the user selects SPNEGO, the user is automatically logged in if they are an authenticated Kerberos user. If accessing a protected page directly, the user is redirected to the authentication log in page. +**Note:** As of Drill 1.13, an administrator can configure FORM and/or SPNEGO authentication mechanisms. The Drill Web Console provides two possible log in options for a user depending on the configuration. If a user selects FORM, s/he must enter their username and password to access restricted pages in the Drill Web Console. The user is authenticated through PAM. If the user selects SPNEGO, the user is automatically logged in if they are an authenticated Kerberos user. If accessing a protected page directly, the user is redirected to the authentication log in page. If [user authentication]({{site.baseurl}}/docs/configuring-user-authentication/) is enabled, Drill prompts you for a user name/password: http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/install/061-stopping-drill.md ---------------------------------------------------------------------- diff --git a/_docs/install/061-stopping-drill.md b/_docs/install/061-stopping-drill.md new file mode 100644 index 0000000..23609ae --- /dev/null +++ b/_docs/install/061-stopping-drill.md @@ -0,0 +1,53 @@ +--- +title: "Stopping Drill" +date: 2018-04-03 23:37:00 UTC +parent: Install Drill +--- + +You can abruptly stop the Drill process on a node, or you can gracefully shut down the Drill process on a node. When you stop the Drill process on a node, active queries cannot complete if they need additional time beyond the default five second wait period. In Drill 1.12 and later, you can use the `graceful_stop` command to transition a Drillbit into a quiescent state in which the Drillbit can complete in-progress queries before shutting down. + +###Stopping the Drill Process +To stop the Drill process on the node, issue the `drillbit.sh stop` command, as shown: + + bin/drillbit.sh stop + +###Gracefully Shutting Down the Drill Process + +Graceful Shutdown is enabled by default. You can gracefully shut down a Drillbit from the command line or the Drill Web Console. + +You can only use the Graceful Shutdown option in the Drill Web Console to shut down the Drillbit from which you accessed the Drill Web Console. For example, if you accessed the Drill Web Console at `http://drillbit1:8047`, you can only use the Graceful Shutdown option to shut down drillbit1. When you initiate graceful shutdown from the Drill Web Console, the console posts an alert stating that a graceful shutdown was triggered. You can see the progress of the shut down as the Drillbit completes queries and transitions through the quiescent state. + +**Note:** If security ([https]({{site.baseurl}}/docs/configuring-web-console-and-rest-api-security/)) is enabled, only and administrator can perform a graceful shutdown. + +**How A Drillbit Shuts Down Gracefully** + +When a Drillbit shuts down gracefully, it transitions through a quiescent state to complete in-progress queries. + +The following list describes the various states that a Drillbit transitions through, including the quiescent state and phases within that state: + +- **Start**: The Drillbit is initializing. For example, when you issue the `drillbit.sh start` or `drillbit.sh restart` command. +- **Online**: The Drillbit has started and registered with the cluster coordinator, such as ZooKeeper. ZooKeeper then shares the state of the Drillbit with other Drillbits in the cluster. Drillbits in the online state can all accept and process queries. +- **Quiescent**: When a Drillbit receives a graceful shutdown request, the Drillbit transitions into the quiescent state and shares its status change with the ZooKeeper. The ZooKeeper notifies the other Drillbits in the cluster of the Drillbitâs status change. Once the other Drillbits get the status update, they do not assign work to the Drillbit. However, if the Foreman assigns work to the Drillbit as the status update occurs, the Drillbit waits to complete work before shutting down. The quiescent state has three phases: grace, draining, and offline. + - **Grace**: A period in which a Drillbit can accept new queries from the Foreman. You can configure (at the system level) the amount of time a Drillbit can remain in this phase using the `drill.exe.grace_period_ms` option. Set this value in milliseconds. The default value is 0. There is no maximum limit. Ideally, you should give as little time as possible or no longer than twice the default heartbeat time of the ZooKeeper. For example, if the heartbeat is 5 seconds, set the value to the equivalent of 10 seconds in milliseconds (10000). + - **Draining**: When the grace period ends, the Drillbit enters the draining phase of the quiescent state. In this phase, the Drillbit cannot accept new queries, but waits for the running queries to complete. You can view the draining queries in the Drill Web Console. The Index page in the Web Console shows the queries and fragments currently running on the node. + - **Offline**: The phase the Drillbit enters after completing all queries. +- **Shutdown**: The final state in which a Drillbit removes itself from the ZooKeeper registry. + +**Shutting Down a Drillbit Gracefully** +You can gracefully shut down a Drillbit from the command line or the Drill Web Console. + +From the command line, run the following command on the node you want to shut down: + + drillbit.sh graceful_stop + +From the Drill Web Console, enter the following URL in your browserâs address bar: + + http://<IP address or host name>:8047 or https://<IP address or host name>:8047 + +In the Drill Web Console, open the Index page, and click Shutdown next to the Drillbit you want to shut down. + + + + + + http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md ---------------------------------------------------------------------- diff --git a/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md b/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md index fb55815..9e04491 100644 --- a/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md +++ b/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md @@ -1,6 +1,6 @@ --- title: "Using the JDBC Driver" -date: 2017-05-09 01:40:52 UTC +date: 2018-04-19 01:45:25 UTC parent: "ODBC/JDBC Interfaces" --- This section explains how to install and use the JDBC driver for Apache Drill. To use the JDBC driver, you have to: @@ -109,7 +109,9 @@ For definitions of other URL components, see [Using the JDBC URL for a Random Dr ## Using the Drill Driver Class Name -The class name for the JDBC driver is [org.apache.drill.jdbc.Driver]({{site.baseurl}}/api/1.2/jdbc/). For details, see the Apache Drill JDBC Driver version 1.2.0 [Javadoc]({{site.baseurl}}/api/1.2/jdbc/). +The class name for the JDBC driver is [org.apache.drill.jdbc.Driver]({{site.baseurl}}/api/1.2/jdbc/). For details, see the Apache Drill JDBC Driver version 1.2.0 [Javadoc]({{site.baseurl}}/api/1.2/jdbc/). + +As of Drill 1.13, you can use the [setQueryTimeout(int milliseconds)](https://drill.apache.org/api/1.2/jdbc/) method in the interface DrillStatement to limit the amount of time that the JDBC driver allows a query to run before canceling the query. ## Example of Connecting to Drill Programmatically http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_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 eca8ca0..3e4b1b1 100644 --- a/_docs/sql-reference/030-lexical-structure.md +++ b/_docs/sql-reference/030-lexical-structure.md @@ -1,6 +1,6 @@ --- title: "Lexical Structure" -date: 2018-02-09 00:16:05 UTC +date: 2018-04-19 01:45:26 UTC parent: "SQL Reference" --- @@ -80,6 +80,11 @@ An identifier is a letter followed by any sequence of letters, digits, or the un * Keywords * Identifiers that SQL cannot parse +**Note:** The term âuserâ is a reserved keyword, however if you reference a field/column named âuserâ in a query and you enclose the term in back ticks (\`user\`), Drill does not treat \`user\` as an identifier. Instead, Drill treats \`user\` as a special function that calls the current user. To work around this issue, use a table alias when referencing the field/column. The table alias informs the parser that this identifier is not a function call, but a regular identifier. For example, assume a table alias ât.â Use t.\`user\` instead of \`user\` as shown: + + SELECT operation, t.`user`, uid FROM `dfs`.`/drill/student` t; + + For example, enclose the SQL keywords date and time in identifier quotes when referring to column names, but not when referring to data types: CREATE TABLE dfs.tmp.sampleparquet AS http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/sql-reference/080-reserved-keywords.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/080-reserved-keywords.md b/_docs/sql-reference/080-reserved-keywords.md index 288f513..aed99ce 100644 --- a/_docs/sql-reference/080-reserved-keywords.md +++ b/_docs/sql-reference/080-reserved-keywords.md @@ -1,6 +1,6 @@ --- title: "Reserved Keywords" -date: 2016-11-18 21:59:17 UTC +date: 2018-04-19 01:45:26 UTC parent: "SQL Reference" --- When you use a reserved keyword in a Drill query, enclose the word in @@ -13,5 +13,5 @@ keyword: The following table provides the Drill reserved keywords that require back ticks: -<table ><tbody><tr><td valign="top" ><h1 id="ReservedKeywords-A">A</h1><p>ABS<br />ALL<br />ALLOCATE<br />ALLOW<br />ALTER<br />AND<br />ANY<br />ARE<br />ARRAY<br />AS<br />ASENSITIVE<br />ASYMMETRIC<br />AT<br />ATOMIC<br />AUTHORIZATION<br />AVG</p><h1 id="ReservedKeywords-B">B</h1><p>BEGIN<br />BETWEEN<br />BIGINT<br />BINARY<br />BIT<br />BLOB<br />BOOLEAN<br />BOTH<br />BY</p><h1 id="ReservedKeywords-C">C</h1><p>CALL<br />CALLED<br />CARDINALITY<br />CASCADED<br />CASE<br />CAST<br />CEIL<br />CEILING<br />CHAR<br />CHARACTER<br />CHARACTER_LENGTH<br />CHAR_LENGTH<br />CHECK<br />CLOB<br />CLOSE<br />COALESCE<br />COLLATE<br />COLLECT<br />COLUMN<br />COMMIT<br />CONDITION<br />CONNECT<br />CONSTRAINT<br />CONVERT<br />CORR<br />CORRESPONDING<br />COUNT<br />COVAR_POP<br />COVAR_SAMP<br />CREATE<br />CROSS<br />CUBE<br />CUME_DIST<br />CURRENT<br />CURRENT_CATALOG<br />CURRENT_DATE<br />CURRENT_DEFAULT_TRANSFORM_GROUP<br />CURRENT_PATH<br />CURRENT_ROLE<br />CURRENT_SCHEMA<br />CURRENT_TIME<br />CURRENT_TIMESTAMP<br />CURRENT_TRANSFORM_GROUP_FOR_TYPE<br />CURRENT_USER<br />CURSOR<br />CYCLE</p></td><td valign="top" ><h1 id="ReservedKeywords-D">D</h1><p>DATABASES<br />DATE<br />DAY<br />DEALLOCATE<br />DEC<br />DECIMAL<br />DECLARE<br />DEFAULT<br />DEFAULT_KW<br />DELETE<br />DENSE_RANK<br />DEREF<br />DESCRIBE<br />DETERMINISTIC<br />DISALLOW<br />DISCONNECT<br />DISTINCT<br />DOUBLE<br />DROP<br />DYNAMIC</p><h1 id="ReservedKeywords-E">E</h1><p>EACH<br />ELEMENT<br />ELSE<br />END<br />END_EXEC<br />ESCAPE<br />EVERY<br />EXCEPT<br />EXEC<br />EXECUTE<br />EXISTS<br />EXP<br />EXPLAIN<br />EXTERNAL<br />EXTRACT</p><h1 id="ReservedKeywords-F">F</h1><p>FALSE<br />FETCH<br />FILES<br />FILTER<br />FIRST_VALUE<br />FLOAT<br />FLOOR<br />FOR<br />FOREIGN<br />FREE<br />FROM<br />FULL<br />FUNCTION<br />FUSION</p><h1 id="ReservedKeywords-G">G</h1><p>GET<br />GLOBAL<br />GRANT<br />GROUP<br />GROUPING</p><h1 id="ReservedKeywords-H">H</h1><p>HAVING<br />HOLD<b r />HOUR</p></td><td valign="top" ><h1 id="ReservedKeywords-I">I</h1><p>IDENTITY<br />IF<br />IMPORT<br />IN<br />INDICATOR<br />INNER<br />INOUT<br />INSENSITIVE<br />INSERT<br />INT<br />INTEGER<br />INTERSECT<br />INTERSECTION<br />INTERVAL<br />INTO<br />IS</p><h1 id="ReservedKeywords-J">J</h1><p>JAR<br />JOIN</p><h1 id="ReservedKeywords-L">L</h1><p>LANGUAGE<br />LARGE<br />LAST_VALUE<br />LATERAL<br />LEADING<br />LEFT<br />LIKE<br />LIMIT<br />LN<br />LOCAL<br />LOCALTIME<br />LOCALTIMESTAMP<br />LOWER</p><h1 id="ReservedKeywords-M">M</h1><p>MATCH<br />MAX<br />MEMBER<br />MERGE<br />METHOD<br />MIN<br />MINUTE<br />MOD<br />MODIFIES<br />MODULE<br />MONTH<br />MULTISET</p><h1 id="ReservedKeywords-N">N</h1><p>NATIONAL<br />NATURAL<br />NCHAR<br />NCLOB<br />NEW<br />NO<br />NONE<br />NORMALIZE<br />NOT<br />NULL<br />NULLIF<br />NUMERIC</p><h1 id="ReservedKeywords-O">O</h1><p>OCTET_LENGTH<br />OF<br />OFFSET<br />OLD<br />ON<br />ONLY<br />OPEN<br />OR<br />ORDER<br />OUT<br / >OUTER<br />OVER<br />OVERLAPS<br />OVERLAY</p></td><td valign="top" >colspan="1" ><h1 id="ReservedKeywords-P">P</h1><p>PARAMETER<br />PARTITION<br >/>PERCENTILE_CONT<br />PERCENTILE_DISC<br />PERCENT_RANK<br />POSITION<br >/>POWER<br />PRECISION<br />PREPARE<br />PRIMARY<br />PROCEDURE</p><h1 >id="ReservedKeywords-R">R</h1><p>RANGE<br />RANK<br />READS<br />REAL<br >/>RECURSIVE<br />REF<br />REFERENCES<br />REFERENCING<br />REGR_AVGX<br >/>REGR_AVGY<br />REGR_COUNT<br />REGR_INTERCEPT<br />REGR_R2<br >/>REGR_SLOPE<br />REGR_SXX<br />REGR_SXY<br />RELEASE<br />REPLACE<br >/>RESULT<br />RETURN<br />RETURNS<br />REVOKE<br />RIGHT<br />ROLLBACK<br >/>ROLLUP<br />ROW<br />ROWS<br />ROW_NUMBER</p><h1 >id="ReservedKeywords-S">S</h1><p>SAVEPOINT<br />SCHEMAS<br />SCOPE<br >/>SCROLL<br />SEARCH<br />SECOND<br />SELECT<br />SENSITIVE<br >/>SESSION_USER<br />SET<br />SHOW<br />SIMILAR<br />SMALLINT<br />SOME<br >/>SPECIFIC<br />SPECIFICTYPE<br />SQL<br />SQLEXCEPTION<br />SQLSTATE<br >/>SQLWARNING<br />SQR T<br />START<br />STATIC<br />STDDEV_POP<br />STDDEV_SAMP<br />SUBMULTISET<br />SUBSTRING<br />SUM<br />SYMMETRIC<br />SYSTEM<br />SYSTEM_USER</p></td><td valign="top" colspan="1" ><h1 id="ReservedKeywords-T">T</h1><p>TABLE<br />TABLES<br />TABLESAMPLE<br />THEN<br />TIME<br />TIMESTAMP<br />TIMEZONE_HOUR<br />TIMEZONE_MINUTE<br />TINYINT<br />TO<br />TRAILING<br />TRANSLATE<br />TRANSLATION<br />TREAT<br />TRIGGER<br />TRIM<br />TRUE</p><h1 id="ReservedKeywords-U">U</h1><p>UESCAPE<br />UNION<br />UNIQUE<br />UNKNOWN<br />UNNEST<br />UPDATE<br />UPPER<br />USE<br />USER<br />USING</p><h1 id="ReservedKeywords-V">V</h1><p>VALUE<br />VALUES<br />VARBINARY<br />VARCHAR<br />VARYING<br />VAR_POP<br />VAR_SAMP</p><h1 id="ReservedKeywords-W">W</h1><p>WHEN<br />WHENEVER<br />WHERE<br />WIDTH_BUCKET<br />WINDOW<br />WITH<br />WITHIN<br />WITHOUT</p><h1 id="ReservedKeywords-Y">Y</h1><p>YEAR</p></td></tr></tbody></table></div> +<table ><tbody><tr><td valign="top" ><h1 id="ReservedKeywords-A">A</h1><p>ABS<br />ALL<br />ALLOCATE<br />ALLOW<br />ALTER<br />AND<br />ANY<br />ARE<br />ARRAY<br />AS<br />ASENSITIVE<br />ASYMMETRIC<br />AT<br />ATOMIC<br />AUTHORIZATION<br />AVG</p><h1 id="ReservedKeywords-B">B</h1><p>BEGIN<br />BETWEEN<br />BIGINT<br />BINARY<br />BIT<br />BLOB<br />BOOLEAN<br />BOTH<br />BY</p><h1 id="ReservedKeywords-C">C</h1><p>CALL<br />CALLED<br />CARDINALITY<br />CASCADED<br />CASE<br />CAST<br />CEIL<br />CEILING<br />CHAR<br />CHARACTER<br />CHARACTER_LENGTH<br />CHAR_LENGTH<br />CHECK<br />CLOB<br />CLOSE<br />COALESCE<br />COLLATE<br />COLLECT<br />COLUMN<br />COMMIT<br />CONDITION<br />CONNECT<br />CONSTRAINT<br />CONVERT<br />CORR<br />CORRESPONDING<br />COUNT<br />COVAR_POP<br />COVAR_SAMP<br />CREATE<br />CROSS<br />CUBE<br />CUME_DIST<br />CURRENT<br />CURRENT_CATALOG<br />CURRENT_DATE<br />CURRENT_DEFAULT_TRANSFORM_GROUP<br />CURRENT_PATH<br />CURRENT_ROLE<br />CURRENT_SCHEMA<br />CURRENT_TIME<br />CURRENT_TIMESTAMP<br />CURRENT_TRANSFORM_GROUP_FOR_TYPE<br />CURRENT_USER<br />CURSOR<br />CYCLE</p></td><td valign="top" ><h1 id="ReservedKeywords-D">D</h1><p>DATABASES<br />DATE<br />DAY<br />DEALLOCATE<br />DEC<br />DECIMAL<br />DECLARE<br />DEFAULT<br />DEFAULT_KW<br />DELETE<br />DENSE_RANK<br />DEREF<br />DESCRIBE<br />DETERMINISTIC<br />DISALLOW<br />DISCONNECT<br />DISTINCT<br />DOUBLE<br />DROP<br />DYNAMIC</p><h1 id="ReservedKeywords-E">E</h1><p>EACH<br />ELEMENT<br />ELSE<br />END<br />END_EXEC<br />ESCAPE<br />EVERY<br />EXCEPT<br />EXEC<br />EXECUTE<br />EXISTS<br />EXP<br />EXPLAIN<br />EXTERNAL<br />EXTRACT</p><h1 id="ReservedKeywords-F">F</h1><p>FALSE<br />FETCH<br />FILES<br />FILTER<br />FIRST_VALUE<br />FLOAT<br />FLOOR<br />FOR<br />FOREIGN<br />FREE<br />FROM<br />FULL<br />FUNCTION<br />FUSION</p><h1 id="ReservedKeywords-G">G</h1><p>GET<br />GLOBAL<br />GRANT<br />GROUP<br />GROUPING</p><h1 id="ReservedKeywords-H">H</h1><p>HAVING<br />HOLD<b r />HOUR</p></td><td valign="top" ><h1 id="ReservedKeywords-I">I</h1><p>IDENTITY<br />IF<br />IMPORT<br />IN<br />INDICATOR<br />INNER<br />INOUT<br />INSENSITIVE<br />INSERT<br />INT<br />INTEGER<br />INTERSECT<br />INTERSECTION<br />INTERVAL<br />INTO<br />IS</p><h1 id="ReservedKeywords-J">J</h1><p>JAR<br />JOIN</p><h1 id="ReservedKeywords-L">L</h1><p>LANGUAGE<br />LARGE<br />LAST_VALUE<br />LATERAL<br />LEADING<br />LEFT<br />LIKE<br />LIMIT<br />LN<br />LOCAL<br />LOCALTIME<br />LOCALTIMESTAMP<br />LOWER</p><h1 id="ReservedKeywords-M">M</h1><p>MATCH<br />MAX<br />MEMBER<br />MERGE<br />METHOD<br />MIN<br />MINUTE<br />MOD<br />MODIFIES<br />MODULE<br />MONTH<br />MULTISET</p><h1 id="ReservedKeywords-N">N</h1><p>NATIONAL<br />NATURAL<br />NCHAR<br />NCLOB<br />NEW<br />NO<br />NONE<br />NORMALIZE<br />NOT<br />NULL<br />NULLIF<br />NUMERIC</p><h1 id="ReservedKeywords-O">O</h1><p>OCTET_LENGTH<br />OF<br />OFFSET<br />OLD<br />ON<br />ONLY<br />OPEN<br />OR<br />ORDER<br />OUT<br / >OUTER<br />OVER<br />OVERLAPS<br />OVERLAY</p></td><td valign="top" >colspan="1" ><h1 id="ReservedKeywords-P">P</h1><p>PARAMETER<br />PARTITION<br >/>PERCENTILE_CONT<br />PERCENTILE_DISC<br />PERCENT_RANK<br />POSITION<br >/>POWER<br />PRECISION<br />PREPARE<br />PRIMARY<br />PROCEDURE</p><h1 >id="ReservedKeywords-R">R</h1><p>RANGE<br />RANK<br />READS<br />REAL<br >/>RECURSIVE<br />REF<br />REFERENCES<br />REFERENCING<br />REGR_AVGX<br >/>REGR_AVGY<br />REGR_COUNT<br />REGR_INTERCEPT<br />REGR_R2<br >/>REGR_SLOPE<br />REGR_SXX<br />REGR_SXY<br />RELEASE<br />REPLACE<br >/>RESULT<br />RETURN<br />RETURNS<br />REVOKE<br />RIGHT<br />ROLLBACK<br >/>ROLLUP<br />ROW<br />ROWS<br />ROW_NUMBER</p><h1 >id="ReservedKeywords-S">S</h1><p>SAVEPOINT<br />SCHEMAS<br />SCOPE<br >/>SCROLL<br />SEARCH<br />SECOND<br />SELECT<br />SENSITIVE<br >/>SESSION_USER<br />SET<br />SHOW<br />SIMILAR<br />SMALLINT<br />SOME<br >/>SPECIFIC<br />SPECIFICTYPE<br />SQL<br />SQLEXCEPTION<br />SQLSTATE<br >/>SQLWARNING<br />SQR T<br />START<br />STATIC<br />STDDEV_POP<br />STDDEV_SAMP<br />SUBMULTISET<br />SUBSTRING<br />SUM<br />SYMMETRIC<br />SYSTEM<br />SYSTEM_USER</p></td><td valign="top" colspan="1" ><h1 id="ReservedKeywords-T">T</h1><p>TABLE<br />TABLES<br />TABLESAMPLE<br />THEN<br />TIME<br />TIMESTAMP<br />TIMEZONE_HOUR<br />TIMEZONE_MINUTE<br />TINYINT<br />TO<br />TRAILING<br />TRANSLATE<br />TRANSLATION<br />TREAT<br />TRIGGER<br />TRIM<br />TRUE</p><h1 id="ReservedKeywords-U">U</h1><p>UESCAPE<br />UNION<br />UNIQUE<br />UNKNOWN<br />UNNEST<br />UPDATE<br />UPPER<br />USE<br />[USER]({{site.baseurl}}/docs/lexical-structure/#identifiers)<br />USING</p><h1 id="ReservedKeywords-V">V</h1><p>VALUE<br />VALUES<br />VARBINARY<br />VARCHAR<br />VARYING<br />VAR_POP<br />VAR_SAMP</p><h1 id="ReservedKeywords-W">W</h1><p>WHEN<br />WHENEVER<br />WHERE<br />WIDTH_BUCKET<br />WINDOW<br />WITH<br />WITHIN<br />WITHOUT</p><h1 id="ReservedKeywords-Y">Y</h1><p>YEAR</p></td></tr></tbody></table></div> http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/sql-reference/sql-commands/053-describe.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/sql-commands/053-describe.md b/_docs/sql-reference/sql-commands/053-describe.md index 1bd347e..c92e5fd 100644 --- a/_docs/sql-reference/sql-commands/053-describe.md +++ b/_docs/sql-reference/sql-commands/053-describe.md @@ -1,16 +1,18 @@ --- title: "DESCRIBE" -date: 2016-08-04 00:23:09 UTC +date: 2018-04-19 01:45:27 UTC parent: "SQL Commands" --- The DESCRIBE command returns information about columns in a table, view, or schema. ## Syntax -The DESCRIBE command supports the following syntax: +The DESCRIBE command supports the following syntax: + + DESCRIBE [workspace.]table_name|view_name [column_name | expression] + DESCRIBE SCHEMA|DATABASE <name>[.workspace] + DESCRIBE (query) - DESCRIBE [workspace.]table_name|view_name - DESCRIBE SCHEMA|DATABASE <name>[.workspace] ##Parameters @@ -23,8 +25,18 @@ The unique name of a view. *table_name* The unique name of a table. +*column_name* +Optional list of column names in a table or view. + *schema/database* -A configured storage plugin instance with or without a configured workspace. +A configured storage plugin instance with or without a configured workspace. + +*query* +A SELECT statement that defines the columns and rows in the table or view. + +*expression* +An expression formed from one or more columns that exist in the tables or views referenced by the query. + ## Usage Notes http://git-wip-us.apache.org/repos/asf/drill/blob/5d6b93e2/_docs/sql-reference/sql-commands/087-union-set-operator.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/sql-commands/087-union-set-operator.md b/_docs/sql-reference/sql-commands/087-union-set-operator.md index 0de27a7..98087d7 100644 --- a/_docs/sql-reference/sql-commands/087-union-set-operator.md +++ b/_docs/sql-reference/sql-commands/087-union-set-operator.md @@ -1,6 +1,6 @@ --- title: "UNION Set Operator" -date: +date: 2018-04-19 01:45:27 UTC parent: "SQL Commands" --- The UNION set operator combines the result sets of two separate query expressions. The result set of each query must have the same number of columns and compatible data types. UNION automatically removes duplicate records from the result set. UNION ALL returns all duplicate records. @@ -24,8 +24,9 @@ Any SELECT query that Drill supports. See [SELECT]({{site.baseurl}}/docs/select/ * Multiple UNION operators in the same SELECT statement are evaluated left to right, unless otherwise indicated by parentheses. * You can only use * on either side of UNION when the data source has a defined schema, such as data in Hive or views. * You must explicitly specify columns. + * Drill 1.13 and later supports queries on empty directories. An empty directory in a query does not change the results; Drill returns results as if the query does not contain the UNION operator. See [Schemaless Tables]({{site.baseurl}}/docs/data-sources-and-file-formats-introduction/#schemaless-tables) for more information. -## Example +## Examples The following example uses the UNION ALL set operator to combine click activity data before and after a marketing campaign. The data in the example exists in the `dfs.clicks workspace`. 0: jdbc:drill:> SELECT t.trans_id transaction, t.user_info.cust_id customer @@ -42,4 +43,13 @@ The following example uses the UNION ALL set operator to combine click activity | 37838 | 18737 | +-------------+------------+ -This UNION ALL query returns rows that exist in two files (and includes any duplicate rows from those files): `clicks.campaign.json` and `clicks.json` +This UNION ALL query returns rows that exist in two files (and includes any duplicate rows from those files): `clicks.campaign.json` and `clicks.json` + +If a query on either side of the UNION operator queries an empty directory, as shown in the following example where empty_DIR is an empty directory: + + 0: jdbc:drill:schema=dfs.tmp> select columns[0] from empty_DIR UNION ALL select cast(columns[0] as int) c1 from `testWindow.csv`; + + Drill treats the empty directory as a schemaless table and returns results as if the UNION operator is not included in the query. + + +
