DRILL-3078 odbc on mac fixes Bridget's editorial change
Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/68e3ac5c Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/68e3ac5c Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/68e3ac5c Branch: refs/heads/gh-pages Commit: 68e3ac5cc968791740c452bb0a541921a237b198 Parents: 4964f81 Author: Kristine Hahn <[email protected]> Authored: Wed Jun 3 16:56:47 2015 -0700 Committer: Kristine Hahn <[email protected]> Committed: Wed Jun 3 16:58:00 2015 -0700 ---------------------------------------------------------------------- .../020-installing-the-driver-on-mac-os-x.md | 4 +- ...iguring-connections-on-linux-and-mac-os-x.md | 126 +++++++------------ .../sql-commands/081-from-clause.md | 30 ++++- 3 files changed, 74 insertions(+), 86 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/68e3ac5c/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/020-installing-the-driver-on-mac-os-x.md ---------------------------------------------------------------------- diff --git a/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/020-installing-the-driver-on-mac-os-x.md b/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/020-installing-the-driver-on-mac-os-x.md index 40c4205..39442b7 100755 --- a/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/020-installing-the-driver-on-mac-os-x.md +++ b/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/020-installing-the-driver-on-mac-os-x.md @@ -64,8 +64,8 @@ libraries: * Installed iODBC driver manager libraries: libiodbc.dylib and libiodbcinst.dylib * Installed MapR Drill ODBC Driver for Drill shared libraries -For example, if the iODBC driver manager using the DMG provided on the iODBC web site, libraries are installed in -`/usr/local/iODBC/lib`, then set `DYLD_LIBRARY_PATH` to include that path and the path to the MapR Drill ODBC Driver. For example, use the following command to set the environment variable to both paths: +If you installed the iODBC driver manager using the DMG, libraries are installed in +`/usr/local/iODBC/lib`, set the `DYLD_LIBRARY_PATH` to include that path and the path to the MapR Drill ODBC Driver. For example, use the following command to set the environment variable to both paths: `export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/iODBC/lib:/opt/mapr/drillodbc/lib/universal` http://git-wip-us.apache.org/repos/asf/drill/blob/68e3ac5c/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/030-configuring-connections-on-linux-and-mac-os-x.md ---------------------------------------------------------------------- diff --git a/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/030-configuring-connections-on-linux-and-mac-os-x.md b/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/030-configuring-connections-on-linux-and-mac-os-x.md index 128af31..0f39dbf 100644 --- a/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/030-configuring-connections-on-linux-and-mac-os-x.md +++ b/_docs/odbc-jdbc-interfaces/using-odbc-on-linux-and-mac-os-x/030-configuring-connections-on-linux-and-mac-os-x.md @@ -3,38 +3,30 @@ title: "Configuring Connections on Linux and Mac OS X" parent: "Using ODBC on Linux and Mac OS X" --- ODBC driver managers use configuration files to define and configure ODBC data -sources and drivers. Before you connect to Drill through an ODBC client tool -on Linux or Mac OS X, you must update the following configuration files: - - * `odbc.ini` - * `odbcinst.ini` - * `mapr.drillodbc.ini` - -You can locate the configuration in `/opt/mapr/drillobdc/Setup`. - -{% include startnote.html %}The installer for the Mac OS X version of the driver creates a sample User DSN that some driver managers use in ~/Library/ODBC/odbc.ini and ~/.odbc.ini.{% include endnote.html %} - -To configure an ODBC connection for Linux or Mac OS X, complete the following +sources and drivers. To configure an ODBC connection for Linux or Mac OS X, complete the following steps: - * Step 1: Set Environment Variables (Linux only) - * Step 2: Define the ODBC Data Sources in odbc.ini - * Step 3: (Optional) Define the ODBC Driver in odbcinst.ini - * Step 4: Configure the MapR Drill ODBC Driver +* Step 1: Set Environment Variables (Linux only) +* Step 2: Define the ODBC Data Sources in odbc.ini +* Step 3: (Optional) Define the ODBC Driver in odbcinst.ini +* Step 4: Configure the MapR Drill ODBC Driver ## Sample Configuration Files -The driver installation contains sample configuration files in the ~/`Setup` -directory that you can use as a reference. +Before you connect to Drill through an ODBC client tool +on Linux or Mac OS X, copy the following configuration files in `/opt/mapr/drillobdc/Setup` to your home directory unless the files already exist in your home directory: + +* `mapr.drillodbc.ini` +* `odbc.ini` +* `odbcinst.ini` -If the configuration files do not already exist in your home directory, copy -the sample configuration files to that directory and rename them as hidden files: +In your home directory, use sudo to rename the files as hidden files: * .mapr.drillodbc.ini * .odbc.ini * .odbcinst.ini -If the configuration files already exist in your home directory, you can use the sample configuration files as a guide for modifying the existing configuration files. +If the configuration files already exist in your home directory, you can use the sample configuration files as a guide for modifying the existing configuration files as described in Steps 2-4. ---------- @@ -53,20 +45,9 @@ default install directory, set the environment variables as follows: ---------- -## Step 2: Define the ODBC Data Sources in `odbc.ini` - -Define the ODBC data sources in the `odbc.ini` configuration file. This file -is divided into sections. +## Step 2: Define the ODBC Data Sources in .odbc.ini -The following table provides information about each of the sections: - -Section| Description ----|--- -[ODBC]| (Optional) Controls the global ODBC configuration. -[ODBC Data Sources]| (Required) Lists DSNs and associates them with a driver. -User Defined|(Required) A section that you create. It must have the same name as the data source specified in the `[ODBC Data Sources]` section. This is required to configure the data source. - -You can see the required sections in the following example `odbc.ini` file: +Define the ODBC data sources in the `odbc.ini` configuration file for your environment. The following sample shows a possible configuration for using Drill in embedded mode. Get the ZKQuorum and ZKClusterID values from the `drill-override.conf` file. **Example** @@ -74,12 +55,12 @@ You can see the required sections in the following example `odbc.ini` file: # Specify any global ODBC configuration here such as ODBC tracing. [ODBC Data Sources] - Sample MapR Drill DSN=MapR Drill ODBC Driver + My MapR Drill DSN=MapR Drill ODBC Driver [Sample MapR Drill DSN] # Description: DSN Description. # This key is not necessary and is only to give a description of the data source. - Description=MapR Drill ODBC Driver DSN + Description=My MapR Drill ODBC Driver DSN # Driver: The location where the ODBC driver is installed to. Driver=/opt/mapr/drillodbc/lib/universal/libmaprdrillodbc.dylib @@ -87,48 +68,27 @@ You can see the required sections in the following example `odbc.ini` file: # If ConnectionType is Direct, include Host and Port. If ConnectionType is ZooKeeper, include ZKQuorum and ZKClusterID # They can also be specified in the connection string. ConnectionType=Zookeeper - HOST=[HOST] - PORT=[PORT] - ZKQuorum= - ZKClusterID= + HOST=localhost + PORT=31010 + ZKQuorum=localhost:2181 + ZKClusterID=drillbits1 AdvancedProperties={HandshakeTimeout=5;QueryTimeout=180;TimestampTZDisplayTimeout=utc;ExcludedSchemas=sys,INFORMATION_SCHEMA} Catalog=DRILL Schema= -### Configuring odbc.ini - -To create a data source in the `odbc.ini` configuration file, complete the -following steps: - - 1. Open the `.odbc.ini` configuration file in a text editor. - 2. Add a new entry to the `[ODBC Data Sources]` section, and type the data source name (DSN) and the driver name. - 3. To set configuration options, add a new section with a name that matches the data source name (DSN) that you specified in step 2. Specify configuration options as key-value pairs. - 4. Save the `.odbc.ini` configuration file. - -For details on the configuration options available for controlling the -behavior of DSNs using Simba ODBC Driver for Apache Drill, see [Driver +[Driver Configuration -Options]({{ site.baseurl }}/docs/driver-configuration-options). +Options]({{ site.baseurl }}/docs/driver-configuration-options) describes configuration options available for controlling the +behavior of DSNs using the MapR Drill ODBC Driver. ---------- -## Step 3: (Optional) Define the ODBC Driver in `odbcinst.ini` +## Step 3: (Optional) Define the ODBC Driver in .odbcinst.ini -The `odbcinst.ini` is an optional configuration file that defines the ODBC +The `.odbcinst.ini` is an optional configuration file that defines the ODBC Drivers. This configuration file is optional because you can specify drivers -directly in the` odbc.ini` configuration file. - -The `odbcinst.ini` file is divided into sections. - -The following table provides information about each of the sections: - -Section| Description ----|--- -[ODBC Drivers]| This section lists the names of all the installed ODBC drivers. -User Defined| A section having the same name as the driver name specified in the [ODBC Drivers] section lists driver attributes and values. +directly in the` .odbc.ini` configuration file. The following sample shows a possible configuration. -You can see the sections in the following example `odbcinst.ini` file: - **Example** [ODBC Drivers] @@ -138,30 +98,34 @@ You can see the sections in the following example `odbcinst.ini` file: Description=MapR Drill ODBC Driver Driver=/opt/mapr/drillodbc/lib/universal/libmaprdrillodbc.dylib -### Configuring odbcinst.ini +---------- + +## Step 4: Configure the MapR Drill ODBC Driver -To define a driver in the `odbcinst.ini` configuration file, complete the -following steps: +Configure the MapR Drill ODBC Driver for your environment by modifying the `.mapr.drillodbc.ini` configuration +file. This configures the driver to work with your ODBC driver manager. The following sample shows a possible configuration. - 1. Open the `odbcinst.ini` configuration file in a text editor. - 2. Add a new entry to the [ODBC Drivers] section. Type the driver name, and then type `=Installed`. Assign the driver name as the value of the Driver attribute in the data source definition instead of the driver shared library name. - 3. In `odbcinst.ini,` add a new section with a name that matches the driver name you typed in step 2, and add configuration options to the section based on the sample `odbcinst.ini` file provided with MapR Drill ODBC Driver in the Setup directory. Specify configuration options as key-value pairs. - 4. Save the `.odbcinst.ini` configuration file. +**Example** ----------- + [Driver] + ## - Note that this default DriverManagerEncoding of UTF-32 is for iODBC. + DriverManagerEncoding=UTF-32 + ErrorMessagesPath=/opt/mapr/drillodbc/ErrorMessages -## Step 4: Configure the MapR Drill ODBC Driver + LogLevel=0 + LogPath= + SwapFilePath=/tmp -Configure the MapR Drill ODBC Driver in the `mapr.drillodbc.ini` configuration -file. This configures the driver so it works with your ODBC driver manager. + # iODBC + ODBCInstLib=libiodbcinst.dylib -### Configuring mapr.drillodbc.ini +### Configuring .mapr.drillodbc.ini To configure the MapR Drill ODBC Driver in the `mapr.drillodbc.ini` configuration file, complete the following steps: 1. Open the `mapr.drillodbc.ini` configuration file in a text editor. - 2. Edit the DriverManagerEncoding setting. The value is typically UTF-16 or UTF-32, but depends on the driver manger used. iODBC uses UTF-32 and unixODBC uses UTF-16. Review your ODBC Driver Manager documentation for the correct setting. - 3. Edit the `ODBCInstLib` setting. The value is the name of the `ODBCInst` shared library for the ODBC driver manager that you use. The configuration file defaults to the shared library for`iODBC`. In Linux, the shared library name for iODBC is `libiodbcinst.so`. In Mac OS X, the shared library name for `iODBC` is `libiodbcinst.dylib`. + 2. Edit the DriverManagerEncoding setting if necessary. The value is typically UTF-16 or UTF-32, but depends on the driver manger used. iODBC uses UTF-32 and unixODBC uses UTF-16. Review your ODBC Driver Manager documentation for the correct setting. + 3. Edit the `ODBCInstLib` setting. The value is the name of the `ODBCInst` shared library for the ODBC driver manager that you use. The configuration file defaults to the shared library for `iODBC`. In Linux, the shared library name for iODBC is `libiodbcinst.so`. In Mac OS X, the shared library name for `iODBC` is `libiodbcinst.dylib`. {% include startnote.html %}Review your ODBC Driver Manager documentation for the correct setting.{% include endnote.html %} Specify an absolute or relative filename for the library. If you use http://git-wip-us.apache.org/repos/asf/drill/blob/68e3ac5c/_docs/sql-reference/sql-commands/081-from-clause.md ---------------------------------------------------------------------- diff --git a/_docs/sql-reference/sql-commands/081-from-clause.md b/_docs/sql-reference/sql-commands/081-from-clause.md index d38cccd..8e0cec9 100755 --- a/_docs/sql-reference/sql-commands/081-from-clause.md +++ b/_docs/sql-reference/sql-commands/081-from-clause.md @@ -39,7 +39,14 @@ Includes one or more *table_references* and is typically followed by the WHERE, Because Drill works with schema-less data sources, you cannot use positional aliases (1, 2, etc.) to refer to SELECT list columns, except in the ORDER BY clause. * *subquery* - A query expression that evaluates to a table. The table exists only for the duration of the query and is typically given a name or alias, though an alias is not required. You can also define column names for tables that derive from subqueries. Naming column aliases is important when you want to join the results of subqueries to other tables and when you want to select or constrain those columns elsewhere in the query. A subquery may contain an ORDER BY clause, but this clause may have no effect if a LIMIT or OFFSET clause is not also specified. + A query expression that evaluates to a table. The table exists only for the duration of the query and is typically given a name or alias, though an alias is not required. You can also define column names for tables that derive from subqueries. Naming column aliases is important when you want to join the results of subqueries to other tables and when you want to select or constrain those columns elsewhere in the query. A subquery may contain an ORDER BY clause, but this clause may have no effect if a LIMIT or OFFSET clause is not also specified. You can use the following subquery operators in Drill queries. These operators all return Boolean results. + * ALL + * ANY + * EXISTS + * IN + * SOME + + In general, correlated subqueries are supported. EXISTS and NOT EXISTS subqueries that do not contain a correlation join are not yet supported. * *join_type* Specifies one of the following join types: @@ -61,6 +68,23 @@ Return all of the rows that the equivalent inner join would return plus non-matc ## Usage Notes * Joined columns must have comparable data types. - * A join with the ON syntax retains both joining columns in its intermediate result set. - + * A join with the ON syntax retains both joining columns in its intermediate result set. + +## Example + + 0: jdbc:drill:zk=local> SELECT tbl1.id, tbl1.type + FROM dfs.`/Users/brumsby/drill/donuts.json` + AS tbl1 + JOIN + dfs.`/Users/brumsby/drill/moredonuts.json` as tbl2 + ON tbl1.id=tbl2.id; + + +------------+------------+ + | id | type | + +------------+------------+ + | 0001 | donut | + +------------+------------+ + + 1 row selected (0.395 seconds) +
