drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bridg...@apache.org
Subject drill git commit: DRILL-2667
Date Fri, 03 Apr 2015 23:56:05 GMT
Repository: drill
Updated Branches:
  refs/heads/gh-pages ae5c73563 -> 703732604


DRILL-2667


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/70373260
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/70373260
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/70373260

Branch: refs/heads/gh-pages
Commit: 7037326040cee61be9647955675bf8ab0e4fad00
Parents: ae5c735
Author: Kristine Hahn <khahn@maprtech.com>
Authored: Fri Apr 3 16:00:23 2015 -0700
Committer: Bridget Bevens <bbevens@maprtech.com>
Committed: Fri Apr 3 16:55:15 2015 -0700

----------------------------------------------------------------------
 _docs/develop/contribute/001-guidelines.md    |   3 +-
 _docs/sql-ref/data-types/001-date.md          |  24 +-
 _docs/sql-ref/functions/001-math.md           |  22 +-
 _docs/sql-ref/functions/002-data-type-fmt.md  | 192 ++++++++----
 _docs/sql-ref/functions/003-date-time-fcns.md | 325 +++++++++++++++++++++
 _docs/tutorial/001-install-sandbox.md         |   3 +-
 6 files changed, 478 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/70373260/_docs/develop/contribute/001-guidelines.md
----------------------------------------------------------------------
diff --git a/_docs/develop/contribute/001-guidelines.md b/_docs/develop/contribute/001-guidelines.md
index 7361e5c..7782f90 100644
--- a/_docs/develop/contribute/001-guidelines.md
+++ b/_docs/develop/contribute/001-guidelines.md
@@ -29,8 +29,7 @@ These guidelines include the following topics:
 
 First, you need the Drill source code.
 
-Get the source code on your local drive using [Git](https://git-wip-
-us.apache.org/repos/asf/incubator-drill.git). Most development is done on
+Get the source code on your local drive using [Git](git clone https://git-wip-us.apache.org/repos/asf/incubator-drill.git).
Most development is done on
 "master":
 
     git clone https://git-wip-us.apache.org/repos/asf/drill.git

http://git-wip-us.apache.org/repos/asf/drill/blob/70373260/_docs/sql-ref/data-types/001-date.md
----------------------------------------------------------------------
diff --git a/_docs/sql-ref/data-types/001-date.md b/_docs/sql-ref/data-types/001-date.md
index 12dc8c2..e08873b 100644
--- a/_docs/sql-ref/data-types/001-date.md
+++ b/_docs/sql-ref/data-types/001-date.md
@@ -2,13 +2,9 @@
 title: "Date, Time, and Timestamp"
 parent: "Data Types"
 ---
-Using familiar date and time formats, listed in the [SQL data types table](/docs/data-types),
you can construct query date and time data. You need to cast textual data to date and time
data types. The format of date, time, and timestamp text in a textual data source needs to
match the SQL query format for successful casting. 
+Using familiar date and time formats, listed in the [SQL data types table](/docs/data-types/supported-data-types),
you can construct query date and time data. You need to cast textual data to date and time
data types. The format of date, time, and timestamp text in a textual data source needs to
match the SQL query format for successful casting. 
 
-DATE, TIME, and TIMESTAMP store values in Coordinated Universal Time (UTC). Currently, Drill
does not support casting a TIMESTAMP with time zone, but you can use the TO_TIMESTAMP function
(link to example) in a query to use time stamp data having a time zone.
-
-Before running a query, you can check the formatting of your dates and times as shown in
the following examples. The examples refer to a dummy JSON file in the FROM clause. The dummy
JSON file has following contents.
-
-    {"dummy" : "data"}
+DATE, TIME, and TIMESTAMP store values in Coordinated Universal Time (UTC). Currently, Drill
does not support casting a TIMESTAMP with time zone, but you can use the [TO_TIMESTAMP function](/docs/casting/converting-data-types#to_timestamp)
in a query to use time stamp data having a time zone.
 
 Next, use the following literals in a SELECT statement. 
 
@@ -16,7 +12,7 @@ Next, use the following literals in a SELECT statement.
 * `time`
 * `timestamp`
 
-        SELECT date '2010-2-15' FROM dfs.`/Users/drilluser/apache-drill-0.8.0/dummy.json`;
+        SELECT date '2010-2-15' FROM sys.drillbits;
         +------------+
         |   EXPR$0   |
         +------------+
@@ -24,7 +20,7 @@ Next, use the following literals in a SELECT statement.
         +------------+
         1 row selected (0.083 seconds)
 
-        SELECT time '15:20:30' from dfs.`/Users/drilluser/apache-drill-0.8.0/dummy.json`;
+        SELECT time '15:20:30' from sys.drillbits;
         +------------+
         |   EXPR$0   |
         +------------+
@@ -32,7 +28,7 @@ Next, use the following literals in a SELECT statement.
         +------------+
         1 row selected (0.067 seconds)
 
-        SELECT timestamp '2015-03-11 6:50:08' FROM dfs.`/Users/drilluser/apache-drill-0.8.0/dummy.json`;
+        SELECT timestamp '2015-03-11 6:50:08' FROM sys.drillbits;
         +------------+
         |   EXPR$0   |
         +------------+
@@ -65,9 +61,9 @@ INTERVALYEAR (Year, Month) and INTERVALDAY (Day, Hours, Minutes, Seconds,
Millis
 
 The format of INTERVAL data in the data source differs from the query format. 
 
-You can run the dummy query described earlier to check the formatting of the fields. The
input to the following SELECT statements show how to format INTERVAL data in the query. The
output shows how to format the data in the data source.
+You can run the query described earlier to check the formatting of the fields. The input
to the following SELECT statements show how to format INTERVAL data in the query. The output
shows how to format the data in the data source.
 
-    SELECT INTERVAL '1 10:20:30.123' day to second FROM dfs.`/Users/drilluser/apache-drill-0.8.0/dummy.json`;
+    SELECT INTERVAL '1 10:20:30.123' day to second FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -75,7 +71,7 @@ You can run the dummy query described earlier to check the formatting of
the fie
     +------------+
     1 row selected (0.054 seconds)
 
-    SELECT INTERVAL '1-2' year to month FROM dfs.`/Users/drill/dummy.json`;
+    SELECT INTERVAL '1-2' year to month FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -83,7 +79,7 @@ You can run the dummy query described earlier to check the formatting of
the fie
     +------------+
     1 row selected (0.927 seconds)
 
-    SELECT INTERVAL '1' year FROM dfs.`/Users/drill/dummy.json`;
+    SELECT INTERVAL '1' year FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -91,7 +87,7 @@ You can run the dummy query described earlier to check the formatting of
the fie
     +------------+
     1 row selected (0.088 seconds)
 
-    SELECT INTERVAL '13' month FROM dfs.`/Users/drill/dummy.json`;
+    SELECT INTERVAL '13' month FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+

http://git-wip-us.apache.org/repos/asf/drill/blob/70373260/_docs/sql-ref/functions/001-math.md
----------------------------------------------------------------------
diff --git a/_docs/sql-ref/functions/001-math.md b/_docs/sql-ref/functions/001-math.md
index d077016..ec1f023 100644
--- a/_docs/sql-ref/functions/001-math.md
+++ b/_docs/sql-ref/functions/001-math.md
@@ -156,17 +156,11 @@ Exceptions are the LSHIFT and RSHIFT functions, which take all types
except the
 
 ## Math Function Examples
 
-Examples in this section use the following files:
+Examples in this section use the `input2.json` file
 
-* The `input2.json` file
-* A dummy JSON file
 
 Download the `input2.json` file from the [Drill source code](https://github.com/apache/drill/tree/master/exec/java-exec/src/test/resources/jsoninput)
page. On the Mac, for example, right-click input2.json and choose Save Link As, and then click
Save.
 
-The following examples refer to a dummy JSON file in the FROM clause. The dummy JSON file
has following contents.
-
-    {"dummy" : "data"}
-
 #### ABS Example
 Get the absolute value of the integer key in `input2.json`. The following snippet of input2.json
shows the relevant integer content:
 
@@ -259,7 +253,7 @@ Open input2.json and change the first float value from 17.4 to 3.14159.
Get valu
         +------------+
         4 rows selected (0.061 seconds)
 
-        SELECT ROUND(`float`, 4) FROM dfs.`/Users/khahn/Documents/test_files_source/input2.json`;
+        SELECT ROUND(`float`, 4) FROM dfs.`/Users/drill/input2.json`;
 
         +------------+
         |   EXPR$0   |
@@ -275,7 +269,7 @@ Open input2.json and change the first float value from 17.4 to 3.14159.
Get valu
 
 Get the base 2 log of 64.
 
-    SELECT log(2, 64) FROM dfs.`/Users/drill/dummy.json`;
+    SELECT log(2, 64) FROM sys.drillbits;
 
     +------------+
     |   EXPR$0   |
@@ -286,7 +280,7 @@ Get the base 2 log of 64.
 
 Get the common log of 100.
 
-    SELECT log10(100) FROM dfs.`/Users/drill/dummy.json`;
+    SELECT log10(100) FROM sys.drillbits;
 
     +------------+
     |   EXPR$0   |
@@ -297,7 +291,7 @@ Get the common log of 100.
 
 Get the natural log of 7.5.
 
-    SELECT log(7.5) FROM dfs.`/Users/drill/sample-data/dummy.json`;
+    SELECT log(7.5) FROM sys.drillbits;
 
     +------------+
     |   EXPR$0   |
@@ -341,7 +335,7 @@ Drill supports the following trig functions, which return a FLOAT8 result.
 
 Find the sine and tangent of a 45 degree angle. First convert degrees to radians for use
in the SIN() function.
 
-    SELECT RADIANS(30) AS Degrees FROM dfs.`/Users/drill/dummy.json`;
+    SELECT RADIANS(30) AS Degrees FROM sys.drillbits;
 
     +------------+
     |  Degrees   |
@@ -350,7 +344,7 @@ Find the sine and tangent of a 45 degree angle. First convert degrees
to radians
     +------------+
     1 row selected (0.045 seconds)
 
-    SELECT SIN(0.7853981633974483) AS `Sine of 30 degrees` FROM dfs.`/Users/drill/dummy.json`;
+    SELECT SIN(0.7853981633974483) AS `Sine of 30 degrees` FROM sys.drillbits;
 
     +-----------------------+
     |  Sine of 45 degrees   |
@@ -359,7 +353,7 @@ Find the sine and tangent of a 45 degree angle. First convert degrees
to radians
     +-----------------------+
     1 row selected (0.059 seconds)
 
-    SELECT TAN(0.7853981633974483) AS `Tangent of 30 degrees` from dfs.`/Users/drill/dummy.json`;
+    SELECT TAN(0.7853981633974483) AS `Tangent of 30 degrees` from sys.drillbits;
 
     +-----------------------+
     | Tangent of 45 degrees |

http://git-wip-us.apache.org/repos/asf/drill/blob/70373260/_docs/sql-ref/functions/002-data-type-fmt.md
----------------------------------------------------------------------
diff --git a/_docs/sql-ref/functions/002-data-type-fmt.md b/_docs/sql-ref/functions/002-data-type-fmt.md
index d09f447..87f4a4c 100644
--- a/_docs/sql-ref/functions/002-data-type-fmt.md
+++ b/_docs/sql-ref/functions/002-data-type-fmt.md
@@ -8,11 +8,11 @@ Drill supports the following functions for casting and converting data types:
 * [CONVERT TO/FROM](/docs/data-type-fmt#convert-to-and-convert-from)
 * [Other data type conversion functions](/docs/data-type-fmt#other-data-type-conversion-functions)
 
-# CAST
+## CAST
 
 The CAST function converts an entity having a single data value, such as a column name, from
one type to another.
 
-## Syntax
+### Syntax
 
 cast (<expression> AS <data type>)
 
@@ -24,7 +24,7 @@ An entity that evaluates to one or more values, such as a column name or
literal
 
 The target data type, such as INTEGER or DATE, to which to cast the expression
 
-## Usage Notes
+### Usage Notes
 
 If the SELECT statement includes a WHERE clause that compares a column of an unknown data
type, cast both the value of the column and the comparison value in the WHERE clause. For
example:
 
@@ -38,28 +38,26 @@ Refer to the following tables for information about the data types to
use for ca
 * [Explicit Type Casting Maps](/docs/explicit-type-casting-maps)
 
 
-## Examples
+### Examples
 
-The following examples refer to a dummy JSON file in the FROM clause. The dummy JSON file
has following contents.
+The following examples show how to cast a string to a number, a number to a string, and casting
from one numerical type to another.
 
-    {"dummy" : "data"}
-
-### Casting a character string to a number
+#### Casting a character string to a number
 You cannot cast a character string that includes a decimal point to an INT or BIGINT. For
example, if you have "1200.50" in a JSON file, attempting to select and cast the string to
an INT fails. As a workaround, cast to a float or decimal type, and then to an integer type.

 
 The following example shows how to cast a character to a DECIMAL having two decimal places.
 
-    SELECT CAST('1' as DECIMAL(28, 2)) FROM dfs.`/Users/drill/dummy.json`;
+    SELECT CAST('1' as DECIMAL(28, 2)) FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
     | 1.00       |
     +------------+
 
-### Casting a number to a character string
+#### Casting a number to a character string
 The first example shows that Drill uses a default limit of 1 character if you omit the VARCHAR
limit: The result is truncated to 1 character.  The second example casts the same number to
a VARCHAR having a limit of 3 characters: The result is a 3-character string, 456. The third
example shows that you can use CHAR as an alias for VARCHAR. You can also use CHARACTER or
CHARACTER VARYING.
 
-    SELECT CAST(456 as VARCHAR) FROM dfs.`/Users/drill/dummy.json`;
+    SELECT CAST(456 as VARCHAR) FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -67,7 +65,7 @@ The first example shows that Drill uses a default limit of 1 character if
you om
     +------------+
     1 row selected (0.063 seconds)
 
-    SELECT CAST(456 as VARCHAR(3)) FROM dfs.`/Users/drill/dummy.json`;
+    SELECT CAST(456 as VARCHAR(3)) FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -75,7 +73,7 @@ The first example shows that Drill uses a default limit of 1 character if
you om
     +------------+
     1 row selected (0.08 seconds)
 
-    SELECT CAST(456 as CHAR(3)) FROM dfs.`/Users/drill/dummy.json`;
+    SELECT CAST(456 as CHAR(3)) FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -83,11 +81,11 @@ The first example shows that Drill uses a default limit of 1 character
if you om
     +------------+
     1 row selected (0.093 seconds)
 
-### Casting from One Numerical Type to Another
+#### Casting from one numerical type to another
 
 Cast an integer to a decimal.
 
-    SELECT CAST(-2147483648 AS DECIMAL(28,8)) FROM dfs.`/Users/drill/dummy.json`;
+    SELECT CAST(-2147483648 AS DECIMAL(28,8)) FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -95,7 +93,7 @@ Cast an integer to a decimal.
     +------------+
     1 row selected (0.08 seconds)
 
-## Casting Intervals
+### Casting Intervals
 
 To cast INTERVAL data use the following syntax:
 
@@ -119,7 +117,7 @@ The following CTAS statement shows how to cast text from a JSON file to
INTERVAL
 
 <!-- Text and include output -->
 
-# CONVERT_TO and CONVERT_FROM
+## CONVERT_TO and CONVERT_FROM
 
 The CONVERT_TO and CONVERT_FROM functions encode and decode
 data, respectively.
@@ -133,7 +131,7 @@ You can use CONVERT functions to convert any compatible data type to any
other t
 ## Usage Notes
 Use the CONVERT_TO function to change the data type to bytes when sending data back to HBase
from a Drill query. CONVERT_TO 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 byte arrays, JSON and Parquet arrays and maps to an SQL data type. 
 
-## Example
+### Example
 
 A common use case for CONVERT_FROM is to convert complex data embedded in
 a HBase column to a readable type. The following example converts VARBINARY data in col1
from HBase or MapR-DB table to JSON data. 
@@ -143,18 +141,50 @@ a HBase column to a readable type. The following example converts VARBINARY
data
     ...
 
 
-# Other Data Type Conversions
+## Other Data Type Conversions
 In addition to the CAST, CONVERT_TO, and CONVERT_FROM functions, Drill supports data type
conversion functions to perform the following conversions:
 
 * A timestamp, integer, decimal, or double to a character string.
 * A character string to a date
 * A character string to a number
-* A character string to a timestamp with time zone
 
-<!-- A decimal type to a timestamp with time zone -->
+## Time Zone Limitation
+Currently Drill does not support conversion of a date, time, or timestamp from one time zone
to another. 
 
-## Usage Notes
+The workaround is to configure Drill to use [UTC](http://www.timeanddate.com/time/aboututc.html)-based
time, convert your data to UTC timestamps, and perform date/time operation in UTC.  
+
+1. Take a look at the Drill time zone configuration by running the TIMEOFDAY function. This
function returns the local date and time with time zone information.
+
+    0: jdbc:drill:zk=local> select timeofday() from sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2015-04-02 15:01:31.114 America/Los_Angeles |
+    +------------+
+    1 row selected (1.199 seconds)
+
+2. Configure the default time zone format in <drill installation directory>/conf/drill-env.sh
by adding `-Duser.timezone=UTC` to DRILL_JAVA_OPTS. For example:
+
+    export DRILL_JAVA_OPTS="-Xms1G -Xmx$DRILL_MAX_HEAP -XX:MaxDirectMemorySize=$DRILL_MAX_DIRECT_MEMORY
-XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=1G -ea -Duser.timezone=UTC"
+
+3. Restart sqlline.
+
+4. Confirm that Drill is now set to UTC:
 
+    SELECT TIMEOFDAY() from sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2015-04-02 17:05:02.424 UTC |
+    +------------+
+    1 row selected (1.191 seconds)
+
+
+<!-- A character string to a timestamp with time zone
+
+A decimal type to a timestamp with time zone -->
+
+### Format Specifiers for Numerical Conversions
 Use the following format specifiers for numerical conversions:
 <table >
      <tr >
@@ -214,6 +244,8 @@ Use the following format specifiers for numerical conversions:
               itself, use two in a row: <code>"# o''clock"</code>.
  </table>
 
+### Format Specifiers for Date/Time Conversions
+
 Use the following format specifiers for date/time conversions:
 
 <table>
@@ -362,11 +394,11 @@ For more information about specifying a format, refer to one of the
following fo
 * [Java DecimalFormat class](http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html)
format specifiers 
 * [Java DateTimeFormat class](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html)
format specifiers
 
-# TO_CHAR
+## TO_CHAR
 
 TO_CHAR converts a date, time, timestamp, or numerical expression to a character string.
 
-## Syntax
+### Syntax
 
     TO_CHAR (expression, 'format');
 
@@ -375,13 +407,13 @@ TO_CHAR converts a date, time, timestamp, or numerical expression to
a character
 *'format'* is format specifier enclosed in single quotation marks that sets a pattern for
the output formatting. 
 
 ### Usage Notes
-Currently Drill does not support a timestamp with time zone data type. Drill stores the timestamp
and date in [UTC](http://www.timeanddate.com/time/aboututc.html) and maintains no timezone
information. Currently, you cannot convert dates/timestamp to a specific timezone. However
if your input data contains timezone information, Drill can use it as if it were UTC time.

 
-## Examples
+
+### Examples
 
 Convert a float to a character string.
 
-    SELECT TO_CHAR(125.789383, '#,###.###') FROM dfs.`/Users/Drill/dummy.json`;
+    SELECT TO_CHAR(125.789383, '#,###.###') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -390,7 +422,7 @@ Convert a float to a character string.
 
 Convert an integer to a character string.
 
-    SELECT TO_CHAR(125, '#,###.###') FROM dfs.`/Users/drill/dummy.json`;
+    SELECT TO_CHAR(125, '#,###.###') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -400,7 +432,7 @@ Convert an integer to a character string.
 
 Convert a date to a character string.
 
-    SELECT to_char((cast('2008-2-23' as date)), 'yyyy-MMM-dd') FROM dfs.`/Users/drill/dummy.json`;
+    SELECT TO_CHAR((CAST('2008-2-23' AS DATE)), 'yyyy-MMM-dd') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -409,7 +441,7 @@ Convert a date to a character string.
 
 Convert a time to a string.
 
-    SELECT to_char(cast('12:20:30' as time), 'HH mm ss') FROM dfs.`/Users/drill/dummy.json`;
+    SELECT TO_CHAR(CAST('12:20:30' AS TIME), 'HH mm ss') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -420,7 +452,7 @@ Convert a time to a string.
 
 Convert a timestamp to a string.
 
-    SELECT to_char(cast('2015-2-23 12:00:00' as timestamp), 'yyyy MMM dd HH:mm:ss') FROM
dfs.`/Users/drill/dummy.json`;
+    SELECT TO_CHAR(CAST('2015-2-23 12:00:00' AS TIMESTAMP), 'yyyy MMM dd HH:mm:ss') FROM
sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -428,25 +460,25 @@ Convert a timestamp to a string.
     +------------+
     1 row selected (0.075 seconds)
 
-# TO_DATE
+## TO_DATE
 Converts a character string or a UNIX epoch timestamp to a date.
 
-## Syntax
+### Syntax
 
     TO_DATE (expression [, 'format']);
 
-*expression* is a character string enclosed in single quotation marks or a UNIX epoch timestamp
in milliseconds, not enclosed in single quotation marks. 
+*expression* is a character string enclosed in single quotation marks or a Unix epoch timestamp
in milliseconds, not enclosed in single quotation marks. 
 
 * 'format'* is format specifier enclosed in single quotation marks that sets a pattern for
the output formatting. Use this option only when the expression is a character string, not
a UNIX epoch timestamp. 
 
-## Usage 
-Specify a format using patterns defined in [Java DateTimeFormat class](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html).
+### Usage 
+Specify a format using patterns defined in [Java DateTimeFormat class](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html).
The TO_TIMESTAMP function takes a Unix epoch timestamp. The TO_DATE function takes a UNIX
epoch timestamp in milliseconds.
 
 
-## Examples
+### Examples
 The first example converts a character string to a date. The second example extracts the
year to verify that Drill recognizes the date as a date type. 
 
-    SELECT TO_DATE('2015-FEB-23', 'yyyy-MMM-dd') FROM dfs.`/Users/drill/dummy.json`;
+    SELECT TO_DATE('2015-FEB-23', 'yyyy-MMM-dd') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -454,7 +486,7 @@ The first example converts a character string to a date. The second example
extr
     +------------+
     1 row selected (0.077 seconds)
 
-    SELECT EXTRACT(year from mydate) `extracted year` FROM (SELECT TO_DATE('2015-FEB-23',
'yyyy-MMM-dd') AS mydate FROM dfs.`/Users/drill/dummy.json`);
+    SELECT EXTRACT(year from mydate) `extracted year` FROM (SELECT TO_DATE('2015-FEB-23',
'yyyy-MMM-dd') AS mydate FROM sys.drillbits);
 
     +------------+
     |   myyear   |
@@ -465,7 +497,7 @@ The first example converts a character string to a date. The second example
extr
 
 The following example converts a UNIX epoch timestamp to a date.
 
-    SELECT TO_DATE(1427849046000) FROM dfs.`/Users/drill/dummy.json`;
+    SELECT TO_DATE(1427849046000) FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -473,11 +505,11 @@ The following example converts a UNIX epoch timestamp to a date.
     +------------+
     1 row selected (0.082 seconds)
 
-# TO_NUMBER
+## TO_NUMBER
 
 TO_NUMBER converts a character string to a formatted number using a format specification.
 
-## Syntax
+### Syntax
 
     TO_NUMBER ('string', 'format');
 
@@ -486,7 +518,7 @@ TO_NUMBER converts a character string to a formatted number using a format
speci
 * 'format'* is one or more [Java DecimalFormat class](http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html)
format specifiers enclosed in single quotation marks that set a pattern for the output formatting.
 
 
-## Usage Notes
+### Usage Notes
 The data type of the output of TO_NUMBER is a numeric. You can use the following [Java DecimalFormat
class](http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html) format specifiers
to set the output formatting. 
 
 * #  
@@ -504,16 +536,16 @@ The data type of the output of TO_NUMBER is a numeric. You can use the
following
 * E
   Exponent. Separates mantissa and exponent in scientific notation. 
 
-## Examples
+### Examples
 
-    SELECT TO_NUMBER('987,966', '######') FROM dfs.`/Users/Drill/dummy.json`;
+    SELECT TO_NUMBER('987,966', '######') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
     | 987.0      |
     +------------+
 
-    SELECT TO_NUMBER('987.966', '###.###') FROM dfs.`/Users/Drill/dummy.json`;
+    SELECT TO_NUMBER('987.966', '###.###') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -521,7 +553,7 @@ The data type of the output of TO_NUMBER is a numeric. You can use the
following
     +------------+
     1 row selected (0.063 seconds)
 
-    SELECT TO_NUMBER('12345', '##0.##E0') FROM dfs.`/Users/Drill/dummy.json`;
+    SELECT TO_NUMBER('12345', '##0.##E0') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -529,13 +561,23 @@ The data type of the output of TO_NUMBER is a numeric. You can use the
following
     +------------+
     1 row selected (0.069 seconds)
 
-# TO_TIME
-
+## TO_TIME
 Converts a character string to a time.
 
-## Examples
+### Syntax
+
+    TO_TIME (expression [, 'format']);
+
+*expression* is a character string enclosed in single quotation marks or milliseconds, not
enclosed in single quotation marks. 
 
-    SELECT TO_TIME('12:20:30', 'HH:mm:ss') FROM dfs.`/Users/Drill/test_files_source/dummy.json`;
+* 'format'* is format specifier enclosed in single quotation marks that sets a pattern for
the output formatting. Use this option only when the expression is a character string, not
milliseconds. 
+
+## Usage 
+Specify a format using patterns defined in [Java DateTimeFormat class](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html).
+
+### Examples
+
+    SELECT TO_TIME('12:20:30', 'HH:mm:ss') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -543,18 +585,43 @@ Converts a character string to a time.
     +------------+
     1 row selected (0.067 seconds)
 
-# TO_TIMESTAMP
+Convert 828550000 milliseconds (23 hours 55 seconds) to the time.
+
+    SELECT to_time(82855000) FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 23:00:55   |
+    +------------+
+    1 row selected (0.086 seconds)
+
+## TO_TIMESTAMP
+
+### Syntax
+
+    TO_TIMESTAMP (expression [, 'format']);
+
+*expression* is a character string enclosed in single quotation marks or a UNIX epoch timestamp,
not enclosed in single quotation marks. 
+
+* 'format'* is format specifier enclosed in single quotation marks that sets a pattern for
the output formatting. Use this option only when the expression is a character string, not
a UNIX epoch timestamp. 
 
-Converts a date or Unix Epoch timestamp to a timestamp.
+### Usage 
+Specify a format using patterns defined in [Java DateTimeFormat class](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html).
The TO_TIMESTAMP function takes a Unix epoch timestamp. The TO_DATE function takes a UNIX
epoch timestamp in milliseconds.
 
-    SELECT to_timestamp('2008-2-23 12:00:00', 'yyyy-MM-dd HH:mm:ss') FROM dfs.`/Users/Drill/dummy.json`;
+### Examples
+
+Convert a date to a timestamp. 
+
+    SELECT TO_TIMESTAMP('2008-2-23 12:00:00', 'yyyy-MM-dd HH:mm:ss') FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
     | 2008-02-23 12:00:00.0 |
     +------------+
 
-    SELECT to_timestamp(1427936330) FROM dfs.`/Users/drill/dummy.json`;
+Convert a Unix Epoch time to a timestamp.
+
+    SELECT TO_TIMESTAMP(1427936330) FROM sys.drillbits;
     +------------+
     |   EXPR$0   |
     +------------+
@@ -562,11 +629,18 @@ Converts a date or Unix Epoch timestamp to a timestamp.
     +------------+
     1 row selected (0.094 seconds)
 
-<!--     FROM Andries
-    select to_timestamp('2015-03-30 20:49:59.0 UTC', 'YYYY-MM-dd HH:mm:ss.s z') as Original,
to_char(to_timestamp('2015-03-30 20:49:59.0 UTC', 'YYYY-MM-dd HH:mm:ss.s z'), 'z') as New_TZ
from sys.version;
+Connvert a UTC date to a timestamp offset from the UTC time zone code.
+
+    SELECT TO_TIMESTAMP('2015-03-30 20:49:59.0 UTC', 'YYYY-MM-dd HH:mm:ss.s z') as Original,
TO_CHAR(TO_TIMESTAMP('2015-03-30 20:49:59.0 UTC', 'YYYY-MM-dd HH:mm:ss.s z'), 'z') AS New_TZ
FROM sys.drillbits;
+
+    +------------+------------+
+    |  Original  |   New_TZ   |
+    +------------+------------+
+    | 2015-03-30 20:49:00.0 | UTC        |
+    +------------+------------+
+    1 row selected (0.129 seconds)
+
 
-    Using ā€˜Zā€™ will provide offset from UTC as opposed to the 3 letter timezone code.
- -->
 <!-- DRILL-448 Support timestamp with time zone -->
 
 

http://git-wip-us.apache.org/repos/asf/drill/blob/70373260/_docs/sql-ref/functions/003-date-time-fcns.md
----------------------------------------------------------------------
diff --git a/_docs/sql-ref/functions/003-date-time-fcns.md b/_docs/sql-ref/functions/003-date-time-fcns.md
new file mode 100644
index 0000000..6815484
--- /dev/null
+++ b/_docs/sql-ref/functions/003-date-time-fcns.md
@@ -0,0 +1,325 @@
+---
+title: "Date/Time Functions and Arithmetic"
+parent: "SQL Functions"
+---
+
+In addition to the TO_DATE, TO_TIME, and TO_TIMESTAMP functions, Drill supports a number
of other date/time functions and arithmetic operators for use with dates, times, and intervals.

+
+## Date/Time Functions and Utilities
+
+The following functions perform date/time-related operations:
+
+* AGE
+* EXTRACT
+* DATE_PART
+
+Drill supports the following utilities:
+
+* CURRENT_DATE
+* CURRENT_TIME
+* CURRENT_TIMESTAMP
+* LOCALTIME
+* LOCALTIMESTAMP
+* NOW
+* TIMEOFDAY
+
+### AGE
+Returns the interval between two timestamps or subtracts a timestamp from midnight of the
current date.
+
+#### Syntax
+
+    AGE (timestamp[, timestamp]);
+
+*timestamp* is a timestamp formatted as shown in the examples.
+
+#### Usage Notes
+Cast string arguments to timestamp to include time data in the calculations of the interval.
+
+#### Examples
+
+Find the interval between midnight April 3, 2015 and June 13, 1957.
+
+    SELECT AGE('1957-06-13') FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | P703M23D   |
+    +------------+
+    1 row selected (0.064 seconds)
+
+Find the interval between 11:10:10 PM on January 1, 2001 and 10:10:10 PM on January 1, 2001.
+
+    SELECT AGE(CAST('2010-01-01 10:10:10' AS TIMESTAMP), CAST('2001-01-01 11:10:10' AS TIMESTAMP))
FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | P109M16DT82800S |
+    +------------+
+    1 row selected (0.161 seconds)
+
+For information about how to read the interval data, see the [Interval section](/docs/date-time-and-timestamp#interval).
+
+### EXTRACT
+
+Returns a component of a timestamp, time, date, or interval.
+
+#### Syntax
+
+    EXTRACT (expression);
+
+*expression* is:
+
+    component FROM (timestamp | time | date | interval)
+
+*component* is a year, month, day, hour, minute, or second value.
+
+#### Examples
+
+On the third day of the month, run the following function:
+
+    SELECT EXTRACT(day FROM NOW()), EXTRACT(day FROM CURRENT_DATE) FROM sys.drillbits;
+
+    +------------+------------+
+    |   EXPR$0   |   EXPR$1   |
+    +------------+------------+
+    | 3          | 3          |
+    +------------+------------+
+    1 row selected (0.208 seconds)
+
+At 8:00 am, extract the hour from the value of CURRENT_DATE.
+
+    SELECT EXTRACT(hour FROM CURRENT_DATE) FROM sys.drillbits;
+
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 8          |
+    +------------+
+
+What is the hour component of this time: 17:12:28.5?
+
+    SELECT EXTRACT(hour FROM TIME '17:12:28.5') from sys.drillbits;
+
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 17         |
+    +------------+
+    1 row selected (0.056 seconds)
+
+What is the second component of this timestamp: 2001-02-16 20:38:40
+
+    SELECT EXTRACT(SECOND FROM TIMESTAMP '2001-02-16 20:38:40') from sys.drillbits;
+
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 40.0       |
+    +------------+
+    1 row selected (0.062 seconds)
+
+
+### DATE_PART
+Returns a field of a date, time, timestamp, or interval.
+
+#### Syntax 
+
+    date_part(component, expression);
+
+*component* is year, month, day, hour, minute, second, enclosed in single quotation marks.
+
+*expression* is date, time, timestamp, or interval enclosed in single quotation marks.
+
+#### Usage Notes
+Use Unix Epoch timestamp in milliseconds as the expression to get the field of a timestamp.
+
+#### Examples
+
+    SELECT DATE_PART('day', '2015-04-02') FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2          |
+    +------------+
+    1 row selected (0.098 seconds)
+
+    SELECT DATE_PART('hour', '23:14:30.076') FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 23         |
+    +------------+
+    1 row selected (0.088 seconds)
+
+Find the hour part of the timestamp for April 2, 2015 23:25:43. Use Unix Epoch timestamp
in milliseconds, which is 1428017143000 in UTC.
+
+    SELECT DATE_PART('hour', 1428017143000) FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 23         |
+    +------------+
+    1 row selected (0.07 seconds)
+
+Return the day part of the one year, 2 months, 10 days interval.
+
+    SELECT DATE_PART('day', '1:2:10') FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 10         |
+    +------------+
+    1 row selected (0.069 seconds)
+
+<!-- date_add
+date_sub -->
+
+### Date/Time Utilities
+The utilities are:
+
+* CURRENT_DATE
+* CURRENT_TIME
+* CURRENT_TIMESTAMP
+* LOCALTIME
+* LOCALTIMESTAMP
+* NOW
+* TIMEOFDAY
+
+The following examples show how to use the utilities:
+
+    SELECT CURRENT_DATE FROM sys.drillbits;
+    +--------------+
+    | current_date |
+    +--------------+
+    | 2015-04-02   |
+    +--------------+
+    1 row selected (0.077 seconds)
+
+    SELECT CURRENT_TIME FROM sys.drillbits;
+    +--------------+
+    | current_time |
+    +--------------+
+    | 14:32:04.751 |
+    +--------------+
+    1 row selected (0.073 seconds)
+
+    SELECT CURRENT_TIMESTAMP FROM sys.drillbits;
+    +-------------------+
+    | current_timestamp |
+    +-------------------+
+    | 2015-04-02 14:32:34.047 |
+    +-------------------+
+    1 row selected (0.061 seconds)
+
+    SELECT LOCALTIME FROM sys.drillbits;
+
+    +------------+
+    | localtime  |
+    +------------+
+    | 14:33:04.95 |
+    +------------+
+    1 row selected (0.051 seconds)
+
+    SELECT LOCALTIMESTAMP FROM sys.drillbits;
+
+    +----------------+
+    | LOCALTIMESTAMP |
+    +----------------+
+    | 2015-04-02 23:13:13.204 |
+    +----------------+
+    1 row selected (0.105 seconds)
+
+    SELECT NOW() FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2015-04-02 23:14:30.076 |
+    +------------+
+    1 row selected (0.05 seconds)
+
+If you set up Drill for [UTC time](/docs/casting-converting-data-types/time-zone-limitation),
TIMEOFDAY returns the result for the UTC time zone.
+
+    SELECT TIMEOFDAY() FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2015-04-02 22:05:02.424 UTC |
+    +------------+
+    1 row selected (1.191 seconds)
+
+If you did not set up Drill for UTC time, TIMEOFDAY returns the local date and time with
time zone information.
+
+    SELECT TIMEOFDAY() FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2015-04-02 15:01:31.114 America/Los_Angeles |
+    +------------+
+    1 row selected (1.199 seconds)
+
+
+### Date, Time, and Interval Arithmetic Functions
+<!-- date +/- integer
+date + interval  -->
+
+Is the day returned from the NOW function the same as the day returned from the CURRENT_DATE
function?
+
+    SELECT EXTRACT(day FROM NOW()) = EXTRACT(day FROM CURRENT_DATE) FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | true       |
+    +------------+
+    1 row selected (0.092 seconds)
+
+Every 23 hours, a 4 hour task started. What time does the task end? 
+
+    SELECT TIME '04:00:00' + interval '23:00:00' hour to second FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 03:00:00   |
+    +------------+
+    1 row selected (0.097 seconds)
+
+Is the time 2:00 PM?
+
+    SELECT EXTRACT(hour FROM CURRENT_DATE) = 2 FROM sys.drillbits;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | false      |
+    +------------+
+    1 row selected (0.033 seconds)
+
+
+<!-- timestamp + interval 
+timestamptz + interval
+date + intervalday 
+time + intervalday 
+timestamp + intervalday
+timestamptz + intervalday
+date + intervalyear 
+time + intervalyear
+timestamp + intervalyear 
+timestamptz + intervalyear
+date + time
+date - date
+time - time
+timestamp - timestamp
+timestamptz - timestamptz
+interval +/- interval
+intervalday +/- intervalday
+intervalyear +/- intervalyear
+interval *//(div) integer or float or double
+intervalday *//(div) integer or float or double
+intervalyear *//(div) integer or float or double
+-interval
+-intervalday
+-intervalyear
+
+extract(field from timestamptz)
+extract(field from interval)
+extract(field from intervalday)
+extract(field from intervalyear) -->
+

http://git-wip-us.apache.org/repos/asf/drill/blob/70373260/_docs/tutorial/001-install-sandbox.md
----------------------------------------------------------------------
diff --git a/_docs/tutorial/001-install-sandbox.md b/_docs/tutorial/001-install-sandbox.md
old mode 100644
new mode 100755
index 26360ff..87cd1f5
--- a/_docs/tutorial/001-install-sandbox.md
+++ b/_docs/tutorial/001-install-sandbox.md
@@ -18,8 +18,7 @@ verify that the host system meets the following prerequisites:
 
 ### VM Player Downloads
 
-For Linux, Mac, or Windows, download the free [VMware Player](https://my.vmwar
-e.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0) or
+For Linux, Mac, or Windows, download the free [VMware Player](https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0
"VMwarePlayer") or
 [VirtualBox](https://www.virtualbox.org/wiki/Downloads). Optionally, you can
 purchase [VMware Fusion](http://www.vmware.com/products/fusion/) for Mac.
 


Mime
View raw message