drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bridg...@apache.org
Subject [1/2] drill git commit: DRILL-2736
Date Mon, 13 Apr 2015 21:30:24 GMT
Repository: drill
Updated Branches:
  refs/heads/gh-pages c8a79a519 -> d3328217e


http://git-wip-us.apache.org/repos/asf/drill/blob/d3328217/_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
index 71a0e12..97267a3 100644
--- a/_docs/sql-ref/functions/003-date-time-fcns.md
+++ b/_docs/sql-ref/functions/003-date-time-fcns.md
@@ -3,44 +3,26 @@ 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.
The following table lists date/time functions described in this section:
+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.
Drill supports time functions based on the Gregorian calendar and in the range 1971 to 2037.
+
+This section defines the following date/time functions:
 
 **Function**| **Return Type**  
 ---|---  
 [AGE(TIMESTAMP)](/docs/date-time-functions-and-arithmetic#age)| INTERVAL
-[CURRENT_DATE](/docs/date-time-functions-and-arithmetic#current_date)| DATE  
-[CURRENT_TIME](/docs/date-time-functions-and-arithmetic#current_time)| TIME   
-[CURRENT_TIMESTAMP](/docs/date-time-functions-and-arithmetic#current_timestamp)| TIMESTAMP

-[DATE_ADD(DATE,INTERVAL expr type)](/docs/date-time-functions-and-arithmetic#date_add)| date/datetime
 
-[DATE_PART(text, time_expression)](/docs/date-time-functions-and-arithmetic#date_part)| double
precision  
-[DATE_SUB(DATE,INTERVAL expr type)](/docs/date-time-functions-and-arithmetic#date_sub)| date/datetime
 
-[EXTRACT(field from time_expression)](/docs/date-time-functions-and-arithmetic#extract)|
double precision   
-[LOCALTIME](/docs/date-time-functions-and-arithmetic#localtime)| TIME  
-[LOCALTIMESTAMP](/docs/date-time-functions-and-arithmetic#localtimestamp)| TIMESTAMP  
-[NOW()](/docs/date-time-functions-and-arithmetic#now)| TIMESTAMP  
-[TIMEOFDAY()](/docs/date-time-functions-and-arithmetic#timeofday)| text  
-
-## Date/Time Functions and Utilities
-
-The following functions perform date/time-related operations:
-
-* AGE
-* EXTRACT
-* DATE_ADD
-* DATE_PART
-* DATE_SUB
-
-Drill supports the following utilities:
-
-* CURRENT_DATE
-* CURRENT_TIME
-* CURRENT_TIMESTAMP
-* LOCALTIME
-* LOCALTIMESTAMP
-* NOW
-* TIMEOFDAY
-
-### AGE
+[EXTRACT(field from time_expression)](/docs/date-time-functions-and-arithmetic#extract)|
double precision
+[CURRENT_DATE](/docs/date-time-functions-and-arithmetic#current_*x*-local*x*-now-and-timeofday)|
DATE  
+[CURRENT_TIME](/docs/date-time-functions-and-arithmetic#current_*x*-local*x*-now-and-timeofday)|
TIME   
+[CURRENT_TIMESTAMP](/docs/date-time-functions-and-arithmetic#current_*x*-local*x*-now-and-timeofday)|
TIMESTAMP 
+[DATE_ADD](/docs/date-time-functions-and-arithmetic#date_add)| date/datetime  
+[DATE_PART](/docs/date-time-functions-and-arithmetic#date_part)| double precision  
+[DATE_SUB](/docs/date-time-functions-and-arithmetic#date_sub)| date/datetime     
+[LOCALTIME](/docs/date-time-functions-and-arithmetic#current_*x*-local*x*-now-and-timeofday)|
TIME  
+[LOCALTIMESTAMP](/docs/date-time-functions-and-arithmetic#current_*x*-local*x*-now-and-timeofday)|
TIMESTAMP  
+[NOW](/docs/date-time-functions-and-arithmetic#current_*x*-local*x*-now-and-timeofday)| TIMESTAMP
 
+[TIMEOFDAY](/docs/date-time-functions-and-arithmetic#current_*x*-local*x*-now-and-timeofday)|
text  
+
+## AGE
 Returns the interval between two timestamps or subtracts a timestamp from midnight of the
current date.
 
 #### Syntax
@@ -76,92 +58,96 @@ Find the interval between 11:10:10 PM on January 1, 2001 and 10:10:10
PM on Janu
 
 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.
+### DATE_ADD
+Returns the sum of a date/time and a number of days/hours, or of a date/time and date/time
interval.
 
 #### Syntax
 
-    EXTRACT (expression);
+    DATE_ADD(date literal_date, integer);
 
-*expression* is:
+    DATE_ADD(keyword literal, interval expr); 
 
-    component FROM (timestamp | time | date | interval)
+*date* is the keyword date.  
+*literal_date* is a date in yyyy-mm-dd format enclosed in single quotation marks.  
+*integer* is a number of days to add to the date/time.  
 
-*component* is a year, month, day, hour, minute, or second value.
+
+*keyword* is the word date, time, or timestamp.  
+*literal* is a date, time, or timestamp literal.  
+*interval* is a keyword  
+*expr* is an interval expression.  
 
 #### Examples
 
-On the third day of the month, run the following function:
+Add two days to today's date May 15, 2015.
 
-    SELECT EXTRACT(day FROM NOW()), EXTRACT(day FROM CURRENT_DATE) FROM sys.version;
-
-    +------------+------------+
-    |   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 DATE_ADD(date '2015-05-15', 2) from sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2015-05-17 |
+    +------------+
+    1 row selected (0.07 seconds)
 
-    SELECT EXTRACT(hour FROM CURRENT_DATE) FROM sys.version;
+Add two months to April 15, 2015.
 
+    SELECT DATE_ADD(date '2015-04-15', interval '2' month) FROM sys.version;
     +------------+
     |   EXPR$0   |
     +------------+
-    | 8          |
+    | 2015-06-15 00:00:00.0 |
     +------------+
+    1 row selected (0.073 seconds)
 
-What is the hour component of this time: 17:12:28.5?
-
-    SELECT EXTRACT(hour FROM TIME '17:12:28.5') from sys.version;
+Add 10 hours to the timestamp 2015-04-15 22:55:55.
 
+    SELECT DATE_ADD(timestamp '2015-04-15 22:55:55', interval '10' hour) FROM sys.version;
     +------------+
     |   EXPR$0   |
     +------------+
-    | 17         |
+    | 2015-04-16 08:55:55.0 |
     +------------+
-    1 row selected (0.056 seconds)
-
-What is the second component of this timestamp: 2001-02-16 20:38:40
+    1 row selected (0.068 seconds)
 
-    SELECT EXTRACT(SECOND FROM TIMESTAMP '2001-02-16 20:38:40') from sys.version;
+Add 10 hours to the time 22 hours, 55 minutes, 55 seconds.
 
+    SELECT DATE_ADD(time '22:55:55', interval '10' hour) FROM sys.version;
     +------------+
     |   EXPR$0   |
     +------------+
-    | 40.0       |
+    | 08:55:55   |
     +------------+
-    1 row selected (0.062 seconds)
+    1 row selected (0.085 seconds)
 
-### DATE_ADD
-Returns the sum of a date and an interval.
-
-#### Syntax
+Add 1 year and 1 month to the timestamp 2015-04-15 22:55:55.
 
-    DATE_ADD(date, interval);
+    SELECT DATE_ADD(timestamp '2015-04-15 22:55:55', interval '1-2' year to month) FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2016-06-15 22:55:55.0 |
+    +------------+
+    1 row selected (0.065 seconds)
 
-#### Example
+Add 1 day 2 and 1/2 hours and 45.100 seconds to the time 22:55:55.
 
-    SELECT CAST(DATE_ADD(datetype(2008, 2, 27), intervaltype(0, 1, 0, 0, 0, 0, 0)) as VARCHAR(100))
FROM sys.version;
+    SELECT DATE_ADD(time '22:55:55', interval '1 2:30:45.100' day to second) FROM sys.version;
     +------------+
     |   EXPR$0   |
     +------------+
-    | 2008-03-27 00:00:00.000 |
+    | 01:26:40.100 |
     +------------+
-    1 row selected (0.247 seconds)
+    1 row selected (0.07 seconds)
 
 ### DATE_PART
 Returns a field of a date, time, timestamp, or interval.
 
 #### Syntax 
 
-    date_part(component, expression);
+    date_part(keyword, 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.
+*keyword* is year, month, day, hour, minute, or second enclosed in single quotation marks.
 
+*expression* is date, time, timestamp, or interval literal enclosed in single quotation marks.
 
 #### Usage Notes
 Use Unix Epoch timestamp in milliseconds as the expression to get the field of a timestamp.
@@ -205,24 +191,89 @@ Return the day part of the one year, 2 months, 10 days interval.
     1 row selected (0.069 seconds)
 
 ### DATE_SUB
-Returns the sum of a date and an interval.
+Returns the difference between a date/time and a number of days/hours, or between a date/time
and date/time interval.
 
 #### Syntax
 
-    DATE_SUB(date, interval);
+    DATE_SUB(date literal_date, integer);
+
+    DATE_SUB(keyword literal, interval expr); 
+
+*date* is the keyword date.  
+*literal_date* is a date in yyyy-mm-dd format enclosed in single quotation marks.  
+*integer* is a number of days to subtract from the date/time.  
+
+
+*keyword* is the word date, time, or timestamp.  
+*literal* is a date, time, or timestamp literal.  
+*interval* is a keyword.  
+*expr* is an interval expression.
+
+#### Examples
+
+Subtract two days to today's date May 15, 2015.
+
+    SELECT DATE_SUB(date '2015-05-15', 2) from sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2015-05-13 |
+    +------------+
+    1 row selected (0.088 seconds)
 
-#### Example
+Subtact two months from April 15, 2015.
 
-    SELECT CAST(DATE_SUB(datetype(2008, 2, 27), intervaltype(0, 1, 0, 0, 0, 0, 0)) as VARCHAR(100))
FROM sys.version;
+    SELECT DATE_SUB(date '2015-04-15', interval '2' month) FROM sys.version;
     +------------+
     |   EXPR$0   |
     +------------+
-    | 2008-01-27 |
+    | 2015-02-15 |
     +------------+
-    1 row selected (0.199 seconds)
+    1 row selected (0.088 seconds)
 
-### Date/Time Utilities
-The utilities are:
+Subtract 10 hours from the timestamp 2015-04-15 22:55:55.
+
+    SELECT DATE_SUB(timestamp '2015-04-15 22:55:55', interval '10' hour) FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2015-04-15 12:55:55.0 |
+    +------------+
+    1 row selected (0.068 seconds)
+
+Subtract 10 hours from the time 22 hours, 55 minutes, 55 seconds.
+
+    SELECT DATE_SUB(time '22:55:55', interval '10' hour) FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 12:55:55   |
+    +------------+
+    1 row selected (0.079 seconds)
+
+Subtract 1 year and 1 month from the timestamp 2015-04-15 22:55:55.
+
+    SELECT DATE_SUB(timestamp '2015-04-15 22:55:55', interval '1-2' year to month) FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 2014-02-15 22:55:55.0 |
+    +------------+
+    1 row selected (0.073 seconds)
+
+Subtract 1 day, 2 and 1/2 hours, and 45.100 seconds from the time 22:55:55.
+
+    SELECT DATE_ADD(time '22:55:55', interval '1 2:30:45.100' day to second) FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 01:26:40.100 |
+    +------------+
+    1 row selected (0.073 seconds)
+
+### CURRENT_*x*, LOCAL*x*, NOW, and TIMEOFDAY
+
+The following examples show how to use these functions:
 
 * CURRENT_DATE
 * CURRENT_TIME
@@ -232,8 +283,6 @@ The utilities are:
 * NOW
 * TIMEOFDAY
 
-The following examples show how to use the utilities:
-
     SELECT CURRENT_DATE FROM sys.version;
     +--------------+
     | current_date |
@@ -304,8 +353,71 @@ If you did not set up Drill for UTC time, TIMEOFDAY returns the local
date and t
     +------------+
     1 row selected (1.199 seconds)
 
+### EXTRACT
+
+Returns a component of a timestamp, time, date, or interval.
+
+#### Syntax
+
+    EXTRACT (extract_expression);
+
+*extract_expression* is:
+
+    component FROM (timestamp | time | date | interval)
+
+*component* is supported time unit.
+
+#### Usage Notes
+
+The extract function supports the following time units: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND.
+
+#### Examples
+
+On the third day of the month, run the following function:
+
+    SELECT EXTRACT(day FROM NOW()), EXTRACT(day FROM CURRENT_DATE) FROM sys.version;
+
+    +------------+------------+
+    |   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.version;
+
+    +------------+
+    |   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.version;
+
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 17         |
+    +------------+
+    1 row selected (0.056 seconds)
+
+What is the seconds component of this timestamp: 2001-02-16 20:38:40
+
+    SELECT EXTRACT(SECOND FROM TIMESTAMP '2001-02-16 20:38:40') from sys.version;
+
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 40.0       |
+    +------------+
+    1 row selected (0.062 seconds)
+
 
-### Date, Time, and Interval Arithmetic Functions
+## Date, Time, and Interval Arithmetic Functions
 <!-- date +/- integer
 date + interval  -->
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d3328217/_docs/sql-ref/functions/004-string.md
----------------------------------------------------------------------
diff --git a/_docs/sql-ref/functions/004-string.md b/_docs/sql-ref/functions/004-string.md
index 1367272..6e2b0cf 100644
--- a/_docs/sql-ref/functions/004-string.md
+++ b/_docs/sql-ref/functions/004-string.md
@@ -7,22 +7,22 @@ You can use the following string functions in Drill queries:
 
 Function| Return Type  
 --------|---  
-[BYTE_SUBSTR(string, start [, length])](/docs/string-manipulation#byte_substr)|byte array
or text
-[CHAR_LENGTH(string) or character_length(string)](/docs/string-manipulation#char_length)|
int  
-[CONCAT(str "any" [, str "any" [, ...] ])](/docs/string-manipulation#concat)| text
-[INITCAP(string)](/docs/string-manipulation#initcap)| text
-[LENGTH(string [, encoding name ])](/docs/string-manipulation#length)| int
-[LOWER(string)](/docs/string-manipulation#lower)| text
-[LPAD(string, length [, fill])](/docs/string-manipulation#lpad)| text
-[LTRIM(string [, characters])](/docs/string-manipulation#ltrim)| text
-[POSITION(substring in string)](/docs/string-manipulation#position)| int
-[REGEXP_REPLACE(string, pattern, replacement](/docs/string-manipulation#regexp_replace)|text
-[RPAD(string, length [, fill ])](/docs/string-manipulation#rpad)| text
-[RTRIM(string [, characters])](/docs/string-manipulation#rtrim)| text
-[STRPOS(string, substring)](/docs/string-manipulation#strpos)| int
-[SUBSTR(string, from [, count])](/docs/string-manipulation#substr)| text
-[TRIM([position_option] [characters] from string)](/docs/string-manipulation#trim)| text
-[UPPER(string)](/docs/string-manipulation#upper)| text
+[BYTE_SUBSTR](/docs/string-manipulation#byte_substr)|byte array or text
+[CHAR_LENGTH](/docs/string-manipulation#char_length)| int  
+[CONCAT](/docs/string-manipulation#concat)| text
+[INITCAP](/docs/string-manipulation#initcap)| text
+[LENGTH](/docs/string-manipulation#length)| int
+[LOWER](/docs/string-manipulation#lower)| text
+[LPAD](/docs/string-manipulation#lpad)| text
+[LTRIM](/docs/string-manipulation#ltrim)| text
+[POSITION](/docs/string-manipulation#position)| int
+[REGEXP_REPLACE](/docs/string-manipulation#regexp_replace)|text
+[RPAD](/docs/string-manipulation#rpad)| text
+[RTRIM](/docs/string-manipulation#rtrim)| text
+[STRPOS](/docs/string-manipulation#strpos)| int
+[SUBSTR](/docs/string-manipulation#substr)| text
+[TRIM](/docs/string-manipulation#trim)| text
+[UPPER](/docs/string-manipulation#upper)| text
 
 ## BYTE_SUBSTR
 Returns in binary format a substring of a string.
@@ -65,7 +65,10 @@ Returns the number of characters in a string.
 
 ### Syntax
 
-    ( CHAR_LENGTH | CHARACTER_LENGTH ) (string);
+    CHAR_LENGTH(string);
+
+### Usage Notes
+You can use the alias CHARACTER_LENGTH.
 
 ### Example
 
@@ -183,13 +186,13 @@ Pads the string to the length specified by prepending the fill or a
space. Trunc
     1 row selected (0.112 seconds)
 
 ## LTRIM
-Removes the longest string having only characters specified in the second argument string
from the beginning of the string.
+Removes any characters from the beginning of string1 that match the characters in string2.

 
 ### Syntax
 
-    LTRIM(string, string);
+    LTRIM(string1, string2);
 
-### Example
+### Examples
 
     SELECT LTRIM('Apache Drill', 'Apache ') FROM sys.version;
 
@@ -200,6 +203,15 @@ Removes the longest string having only characters specified in the second
argume
     +------------+
     1 row selected (0.131 seconds)
 
+    SELECT LTRIM('A powerful tool Apache Drill', 'Apache ') FROM sys.version;
+
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | owerful tool Apache Drill |
+    +------------+
+    1 row selected (0.07 seconds)
+
 ## POSITION
 Returns the location of a substring.
 
@@ -220,7 +232,7 @@ Returns the location of a substring.
 
 ## REGEXP_REPLACE
 
-Substitutes new text for substrings that match POSIX regular expression patterns.
+Substitutes new text for substrings that match [POSIX regular expression patterns](http://www.regular-expressions.info/posix.html).
 
 ### Syntax
 
@@ -234,39 +246,29 @@ Substitutes new text for substrings that match POSIX regular expression
patterns
 
 ### Examples
 
-Flatten and replace a's with b's in this JSON data.
+Replace a's with b's in this string.
 
-    {"id":1,"strs":["abc","acd"]}
-    {"id":2,"strs":["ade","aef"]}
-
-    SELECT id, REGEXP_REPLACE(FLATTEN(strs), 'a','b') FROM tmp.`regex-flatten.json`;
+    SELECT REGEXP_REPLACE('abc, acd, ade, aef', 'a', 'b') FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | bbc, bcd, bde, bef |
+    +------------+
 
-    +------------+------------+
-    |     id     |   EXPR$1   |
-    +------------+------------+
-    | 1          | bbc        |
-    | 1          | bcd        |
-    | 2          | bde        |
-    | 2          | bef        |
-    +------------+------------+
-    4 rows selected (0.186 seconds)
 
-Use the regular expression a. in the same query to replace all a's and the subsequent character.
+Use the regular expression *a* followed by a period (.) in the same query to replace all
a's and the subsequent character.
 
-    SELECT ID, REGEXP_REPLACE(FLATTEN(strs), 'a.','b') FROM tmp.`regex-flatten.json`;
+    SELECT REGEXP_REPLACE('abc, acd, ade, aef', 'a.','b') FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | bc, bd, be, bf |
+    +------------+
+    1 row selected (0.099 seconds)
 
-    +------------+------------+
-    |     id     |   EXPR$1   |
-    +------------+------------+
-    | 1          | bc         |
-    | 1          | bd         |
-    | 2          | be         |
-    | 2          | bf         |
-    +------------+------------+
-    4 rows selected (0.132 seconds)
 
 ## RPAD
-Pads the string to the length specified by appending the fill or a space. Truncates the string
if longer than the specified length.
+Pads the string to the length specified. Appends the text you specify after the fill keyword
using spaces for the fill if you provide no text or insufficient text to achieve the length.
 Truncates the string if longer than the specified length.
 
 ### Syntax
 
@@ -283,13 +285,13 @@ Pads the string to the length specified by appending the fill or a space.
Trunca
     1 row selected (0.15 seconds)
 
 ## RTRIM
-Removes the longest string having only characters specified in the second argument string
from the end of the string.
+Removes any characters from the end of string1 that match the characters in string2.  
 
 ### Syntax
 
-    RTRIM(string, string);
+    RTRIM(string1, string2);
 
-### Example
+### Examples
 
     SELECT RTRIM('Apache Drill', 'Drill ') FROM sys.version;
 
@@ -300,6 +302,14 @@ Removes the longest string having only characters specified in the second
argume
     +------------+
     1 row selected (0.135 seconds)
 
+    SELECT RTRIM('1.0 Apache Tomcat 1.0', 'Drill 1.0') from sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | 1.0 Apache Tomcat |
+    +------------+
+    1 row selected (0.088 seconds)
+
 ## STRPOS
 Returns the location of the substring in a string.
 
@@ -323,7 +333,10 @@ Extracts characters from position 1 - x of the string an optional y times.
 
 ### Syntax
 
-(SUBSTR | SUBSTRING)(string, x, y)
+SUBSTR(string, x, y)
+
+### Usage Notes
+You can use the alias SUBSTRING for this function.
 
 
 ### Example
@@ -347,11 +360,11 @@ Extracts characters from position 1 - x of the string an optional y
times.
     1 row selected (0.129 seconds)
 
 ## TRIM
-Removes the longest string having only the characters from the beginning, end, or both ends
of the string.
+Removes any characters from the beginning, end, or both sides of string2 that match the characters
in string1.  
 
 ### Syntax
 
-    TRIM ([leading | trailing | both] [characters] from string)
+    TRIM ([leading | trailing | both] [string1] from string2)
 
 ### Example
 
@@ -363,6 +376,22 @@ Removes the longest string having only the characters from the beginning,
end, o
     +------------+
     1 row selected (0.172 seconds)
 
+    SELECT TRIM(both 'l' from 'long live Drill') FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | ong live Dri |
+    +------------+
+    1 row selected (0.087 seconds)
+
+    SELECT TRIM(leading 'l' from 'long live Drill') FROM sys.version;
+    +------------+
+    |   EXPR$0   |
+    +------------+
+    | ong live Drill |
+    +------------+
+    1 row selected (0.077 seconds)
+
 ## UPPER
 Converts characters in the string to uppercase.
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d3328217/_docs/sql-ref/functions/005-aggregate.md
----------------------------------------------------------------------
diff --git a/_docs/sql-ref/functions/005-aggregate.md b/_docs/sql-ref/functions/005-aggregate.md
index eda1049..3295b45 100644
--- a/_docs/sql-ref/functions/005-aggregate.md
+++ b/_docs/sql-ref/functions/005-aggregate.md
@@ -17,7 +17,7 @@ MAX(expression)| any array, numeric, string, or date/time type| same as
argument
 MIN(expression)| any array, numeric, string, or date/time type| same as argument type
 SUM(expression)| smallint, int, bigint, real, double precision, numeric, or interval| bigint
for smallint or int arguments, numeric for bigint arguments, double precision for floating-point
arguments, otherwise the same as the argument data type
 
-MIN, MAX, COUNT, AVG, SUM accept ALL and DISTINCT keywords. The default is ALL.
+MIN, MAX, COUNT, AVG, and SUM accept ALL and DISTINCT keywords. The default is ALL.
 
 ### Examples
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d3328217/_docs/sql-ref/functions/006-nulls.md
----------------------------------------------------------------------
diff --git a/_docs/sql-ref/functions/006-nulls.md b/_docs/sql-ref/functions/006-nulls.md
index bc98b63..bbf7da0 100644
--- a/_docs/sql-ref/functions/006-nulls.md
+++ b/_docs/sql-ref/functions/006-nulls.md
@@ -3,7 +3,7 @@ title: "Functions for Handling Nulls"
 parent: "SQL Functions"
 ---
 
-Drill supports the following SQL functions:
+Drill supports the following functions for handling nulls:
 
 * COALESCE
 * NULLIF

http://git-wip-us.apache.org/repos/asf/drill/blob/d3328217/_docs/tutorial/install-sandbox/001-install-mapr-vm.md
----------------------------------------------------------------------
diff --git a/_docs/tutorial/install-sandbox/001-install-mapr-vm.md b/_docs/tutorial/install-sandbox/001-install-mapr-vm.md
index 73daa6d..fc75f94 100644
--- a/_docs/tutorial/install-sandbox/001-install-mapr-vm.md
+++ b/_docs/tutorial/install-sandbox/001-install-mapr-vm.md
@@ -7,22 +7,23 @@ VMware Player or VMware Fusion:
 
 1. Download the MapR Sandbox with Drill file to a directory on your machine:  
    <https://www.mapr.com/products/mapr-sandbox-hadoop/download-sandbox-drill>
-2. Open the virtual machine player, and select the **Open a Virtual Machine **option.  
+2. Open the virtual machine player, and select the **Open a Virtual Machine** option.  
   
     **Tip for VMware Fusion**  
 
-    If you are running VMware Fusion, select** Import**.  
+    If you are running VMware Fusion, select **Import**.  
 
     ![drill query flow]({{ site.baseurl }}/docs/img/vmWelcome.png)
-3. Navigate to the directory where you downloaded the MapR Sandbox with Apache Drill file,
and select `MapR-Sandbox-For-Apache-Drill-4.0.1_VM.ova`.
+3. Navigate to the directory where you downloaded the MapR Sandbox with Apache Drill file,
and select `MapR-Sandbox-For-Apache-Drill-0.8.0-4.1.0-vmware`.  
+
+    The Import Virtual Machine dialog appears.
 
     ![drill query flow]({{ site.baseurl }}/docs/img/vmShare.png)
 
-    The Import Virtual Machine dialog appears.
 4. Click **Import**. The virtual machine player imports the sandbox.
 
     ![drill query flow]({{ site.baseurl }}/docs/img/vmLibrary.png)
-5. Select `MapR-Sandbox-For-Apache-Drill-4.0.1_VM`, and click **Play virtual machine**. It
takes a few minutes for the MapR services to start.  
+5. Select `MapR-Sandbox-For-Apache-Drill-0.8.0-4.1.0-vmware`, and click **Play virtual machine**.
It takes a few minutes for the MapR services to start.  
 
      After the MapR services start and installation completes, the following screen
 appears:
@@ -31,16 +32,14 @@ appears:
 
      Note the URL provided in the screen, which corresponds to the Web UI in Apache
 Drill.
-6. Verify that a DNS entry was created on the host machine for the virtual machine. If not,
create the entry.
-    * For Linux and Mac, create the entry in `/etc/hosts`.  
-    * For Windows, create the entry in the `%WINDIR%\system32\drivers\etc\hosts` file.  
 
-     
-    For example: `127.0.1.1 <vm_hostname>`
+6. Verify that a DNS entry was created on the host machine for the virtual machine. If not,
create the entry.  
+   * For Linux and Mac, create the entry in `/etc/hosts`.  
+   * For Windows, create the entry in the `%WINDIR%\system32\drivers\etc\hosts` file.  
+     For example: `127.0.1.1 <vm_hostname>`  
 
 7. You can navigate to the URL provided to experience Drill Web UI or you can login to the
sandbox through the command line.  
-
-    a. To navigate to the MapR Sandbox with Apache Drill, enter the provided URL in your
browser's address bar.  
-    b. To login to the virtual machine and access the command line, press Alt+F2 on Windows
or Option+F5 on Mac. When prompted, enter `mapr` as the login name and password.
+   * To navigate to the MapR Sandbox with Apache Drill, enter the provided URL in your browser's
address bar.  
+   * To login to the virtual machine and access the command line, press Alt+F2 on Windows
or Option+F5 on Mac. When prompted, enter `mapr` as the login name and password.
 
 ## What's Next
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d3328217/_docs/tutorial/install-sandbox/002-install-mapr-vb.md
----------------------------------------------------------------------
diff --git a/_docs/tutorial/install-sandbox/002-install-mapr-vb.md b/_docs/tutorial/install-sandbox/002-install-mapr-vb.md
index e72abf9..886d894 100644
--- a/_docs/tutorial/install-sandbox/002-install-mapr-vb.md
+++ b/_docs/tutorial/install-sandbox/002-install-mapr-vb.md
@@ -22,40 +22,40 @@ VirtualBox:
 
      ![drill query flow]({{ site.baseurl }}/docs/img/vbNetwork.png)
 7. Select **Network**.  
-
-    The correct setting depends on your network connectivity when you run the
-Sandbox. In general, if you are going to use a wired Ethernet connection,
-select **NAT Networks **and **vboxnet0**. If you are going to use a wireless
+   The correct setting depends on your network connectivity when you run the
+Sandbox:  
+   * If you are going to use a wired Ethernet connection, generally its best to
+select **NAT Network** and **vboxnet0**.  
+   * If you use ODBC or JDBC on a remote host, select **Bridged Adapter**.  
+   * If you are going to use a wireless
 network, select **Host-only Networks** and the **VirtualBox Host-Only Ethernet
-Adapter**. If no adapters appear, click the green** +** button to add the
+Adapter**.  
+
+    If no adapters appear, click the green **+** button to add the
 VirtualBox adapter.
 
-     ![drill query flow]({{ site.baseurl }}/docs/img/vbMaprSetting.png)
-8. Click **OK **to continue.
-9. Click Settings.
+![drill query flow]({{ site.baseurl }}/docs/img/vbMaprSetting.png)
+8. Click **OK** to continue.  
+9. Click Settings. 
+![settings icon]({{ site.baseurl }}/docs/img/settings.png)  
+   The MapR Settings dialog appears.     
+![drill query flow]({{ site.baseurl }}/docs/img/vbGenSettings.png)    
+10.Click **OK** to continue.  
+11.Click **Start**. It takes a few minutes for the MapR services to start.  
+   After the MapR services start and installation completes, the following screen appears:
 
+![drill query flow]({{ site.baseurl }}/docs/img/vbloginSandBox.png)
+   Note the URL provided in the screen.  
+12.The client must be able to resolve the actual hostname of the Drill node(s) with the IP(s).
Verify that a DNS entry was created on the client machine for the Drill node(s). If a DNS
entry does not exist, create the entry for the Drill node(s):  
+
+   * For Windows, create the entry in the %WINDIR%\system32\drivers\etc\hosts file.  
+   * For Linux and Mac, create the entry in /etc/hosts.  
+<drill-machine-IP> <drill-machine-hostname>
+        Example: `127.0.1.1 maprdemo`  
 
-    ![settings icon]({{ site.baseurl }}/docs/img/settings.png)  
-   The MapR-Sandbox-For-Apache-Drill-0.6.0-r2-4.0.1 - Settings dialog appears.
-     
-     ![drill query flow]({{ site.baseurl }}/docs/img/vbGenSettings.png)    
-10. Click **OK** to continue.
-11. Click **Start**. It takes a few minutes for the MapR services to start.   
- 
-      After the MapR services start and installation completes, the following screen appears:
-      
-       ![drill query flow]({{ site.baseurl }}/docs/img/vbloginSandBox.png)
-12. The client must be able to resolve the actual hostname of the Drill node(s) with the
IP(s). Verify that a DNS entry was created on the client machine for the Drill node(s).  
- 
-     If a DNS entry does not exist, create the entry for the Drill node(s).
-     * For Windows, create the entry in the %WINDIR%\system32\drivers\etc\hosts file.
-     * For Linux and Mac, create the entry in /etc/hosts.  
-<drill-machine-IP> <drill-machine-hostname>  
-  
-     Example: `127.0.1.1 maprdemo`
-13. You can navigate to the URL provided or to [localhost:8047](http://localhost:8047) to
experience the Drill Web UI, or you can log into the sandbox through the command line.  
+13.You can navigate to the URL provided or to [localhost:8047](http://localhost:8047) to
experience the Drill Web UI, or you can log into the sandbox through the command line.  
 
-    a. To navigate to the MapR Sandbox with Apache Drill, enter the provided URL in your
browser's address bar.  
-    b. To log into the virtual machine and access the command line, enter Alt+F2 on Windows
or Option+F5 on Mac. When prompted, enter `mapr` as the login name and password.
+   * To navigate to the MapR Sandbox with Apache Drill, enter the provided URL in your browser's
address bar.  
+   * To log into the virtual machine and access the command line, enter Alt+F2 on Windows
or Option+F5 on Mac. When prompted, enter `mapr` as the login name and password.
 
 # What's Next
 


Mime
View raw message