Author: bridgetb Date: Fri Apr 3 23:59:30 2015 New Revision: 1671223 URL: http://svn.apache.org/r1671223 Log: (empty)
Added: drill/site/trunk/content/drill/docs/date-time-functions-and-arithmetic/ drill/site/trunk/content/drill/docs/date-time-functions-and-arithmetic/index.html Modified: drill/site/trunk/content/drill/docs/apache-drill-contribution-guidelines/index.html drill/site/trunk/content/drill/docs/casting-converting-data-types/index.html drill/site/trunk/content/drill/docs/date-time-and-timestamp/index.html drill/site/trunk/content/drill/docs/index.html drill/site/trunk/content/drill/docs/installing-the-apache-drill-sandbox/index.html drill/site/trunk/content/drill/docs/math-and-trig/index.html drill/site/trunk/content/drill/feed.xml Modified: drill/site/trunk/content/drill/docs/apache-drill-contribution-guidelines/index.html URL: http://svn.apache.org/viewvc/drill/site/trunk/content/drill/docs/apache-drill-contribution-guidelines/index.html?rev=1671223&r1=1671222&r2=1671223&view=diff ============================================================================== --- drill/site/trunk/content/drill/docs/apache-drill-contribution-guidelines/index.html (original) +++ drill/site/trunk/content/drill/docs/apache-drill-contribution-guidelines/index.html Fri Apr 3 23:59:30 2015 @@ -99,7 +99,7 @@ Drill. For ideas about <em>what</em> you <p>First, you need the Drill source code.</p> -<p>Get the source code on your local drive using <a href="https://git-wip-%0Aus.apache.org/repos/asf/incubator-drill.git">Git</a>. Most development is done on +<p>Get the source code on your local drive using <a href="git%20clone%20https://git-wip-us.apache.org/repos/asf/incubator-drill.git">Git</a>. Most development is done on "master":</p> <div class="highlight"><pre><code class="language-text" data-lang="text">git clone https://git-wip-us.apache.org/repos/asf/drill.git </code></pre></div> Modified: drill/site/trunk/content/drill/docs/casting-converting-data-types/index.html URL: http://svn.apache.org/viewvc/drill/site/trunk/content/drill/docs/casting-converting-data-types/index.html?rev=1671223&r1=1671222&r2=1671223&view=diff ============================================================================== --- drill/site/trunk/content/drill/docs/casting-converting-data-types/index.html (original) +++ drill/site/trunk/content/drill/docs/casting-converting-data-types/index.html Fri Apr 3 23:59:30 2015 @@ -75,11 +75,11 @@ <li><a href="/docs/data-type-fmt#other-data-type-conversion-functions">Other data type conversion functions</a></li> </ul> -<h1 id="cast">CAST</h1> +<h2 id="cast">CAST</h2> <p>The CAST function converts an entity having a single data value, such as a column name, from one type to another.</p> -<h2 id="syntax">Syntax</h2> +<h3 id="syntax">Syntax</h3> <p>cast (<expression> AS <data type>)</p> @@ -91,7 +91,7 @@ <p>The target data type, such as INTEGER or DATE, to which to cast the expression</p> -<h2 id="usage-notes">Usage Notes</h2> +<h3 id="usage-notes">Usage Notes</h3> <p>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:</p> <div class="highlight"><pre><code class="language-text" data-lang="text">SELECT c_row, CAST(c_int AS DECIMAL(28,8)) FROM mydata WHERE CAST(c_int AS DECIMAL(28,8)) > -3.0 @@ -105,27 +105,26 @@ <li><a href="/docs/explicit-type-casting-maps">Explicit Type Casting Maps</a></li> </ul> -<h2 id="examples">Examples</h2> +<h3 id="examples">Examples</h3> -<p>The following examples refer to a dummy JSON file in the FROM clause. The dummy JSON file has following contents.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">{"dummy" : "data"} -</code></pre></div> -<h3 id="casting-a-character-string-to-a-number">Casting a character string to a number</h3> +<p>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.</p> + +<h4 id="casting-a-character-string-to-a-number">Casting a character string to a number</h4> <p>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. </p> <p>The following example shows how to cast a character to a DECIMAL having two decimal places.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT CAST('1' as DECIMAL(28, 2)) FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT CAST('1' as DECIMAL(28, 2)) FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ | 1.00 | +------------+ </code></pre></div> -<h3 id="casting-a-number-to-a-character-string">Casting a number to a character string</h3> +<h4 id="casting-a-number-to-a-character-string">Casting a number to a character string</h4> <p>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.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT CAST(456 as VARCHAR) FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT CAST(456 as VARCHAR) FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -133,7 +132,7 @@ +------------+ 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 | +------------+ @@ -141,7 +140,7 @@ SELECT CAST(456 as VARCHAR(3)) FROM dfs. +------------+ 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 | +------------+ @@ -149,10 +148,10 @@ SELECT CAST(456 as CHAR(3)) FROM dfs.`/U +------------+ 1 row selected (0.093 seconds) </code></pre></div> -<h3 id="casting-from-one-numerical-type-to-another">Casting from One Numerical Type to Another</h3> +<h4 id="casting-from-one-numerical-type-to-another">Casting from one numerical type to another</h4> <p>Cast an integer to a decimal.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT CAST(-2147483648 AS DECIMAL(28,8)) FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT CAST(-2147483648 AS DECIMAL(28,8)) FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -160,7 +159,7 @@ SELECT CAST(456 as CHAR(3)) FROM dfs.`/U +------------+ 1 row selected (0.08 seconds) </code></pre></div> -<h2 id="casting-intervals">Casting Intervals</h2> +<h3 id="casting-intervals">Casting Intervals</h3> <p>To cast INTERVAL data use the following syntax:</p> <div class="highlight"><pre><code class="language-text" data-lang="text">CAST (column_name AS INTERVAL) @@ -181,7 +180,7 @@ FROM `/user/root/intervals.json`); </code></pre></div> <!-- Text and include output --> -<h1 id="convert_to-and-convert_from">CONVERT_TO and CONVERT_FROM</h1> +<h2 id="convert_to-and-convert_from">CONVERT_TO and CONVERT_FROM</h2> <p>The CONVERT_TO and CONVERT_FROM functions encode and decode data, respectively.</p> @@ -196,7 +195,7 @@ data, respectively.</p> <p>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. </p> -<h2 id="example">Example</h2> +<h3 id="example">Example</h3> <p>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. </p> @@ -204,7 +203,7 @@ a HBase column to a readable type. The f FROM hbase.table1 ... </code></pre></div> -<h1 id="other-data-type-conversions">Other Data Type Conversions</h1> +<h2 id="other-data-type-conversions">Other Data Type Conversions</h2> <p>In addition to the CAST, CONVERT_TO, and CONVERT_FROM functions, Drill supports data type conversion functions to perform the following conversions:</p> @@ -212,12 +211,44 @@ FROM hbase.table1 <li>A timestamp, integer, decimal, or double to a character string.</li> <li>A character string to a date</li> <li>A character string to a number</li> -<li>A character string to a timestamp with time zone</li> </ul> -<!-- A decimal type to a timestamp with time zone --> +<h2 id="time-zone-limitation">Time Zone Limitation</h2> -<h2 id="usage-notes">Usage Notes</h2> +<p>Currently Drill does not support conversion of a date, time, or timestamp from one time zone to another. </p> + +<p>The workaround is to configure Drill to use <a href="http://www.timeanddate.com/time/aboututc.html">UTC</a>-based time, convert your data to UTC timestamps, and perform date/time operation in UTC. </p> + +<ol> +<li><p>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.</p> + +<p>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)</p></li> +<li><p>Configure the default time zone format in <drill installation directory>/conf/drill-env.sh by adding <code>-Duser.timezone=UTC</code> to DRILL_JAVA_OPTS. For example:</p> + +<p>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"</p></li> +<li><p>Restart sqlline.</p></li> +<li><p>Confirm that Drill is now set to UTC:</p> + +<p>SELECT TIMEOFDAY() from sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| 2015-04-02 17:05:02.424 UTC | ++------------+ +1 row selected (1.191 seconds)</p></li> +</ol> + +<!-- A character string to a timestamp with time zone + +A decimal type to a timestamp with time zone --> + +<h3 id="format-specifiers-for-numerical-conversions">Format Specifiers for Numerical Conversions</h3> <p>Use the following format specifiers for numerical conversions: <table > @@ -278,6 +309,8 @@ FROM hbase.table1 itself, use two in a row: <code>"# o''clock"</code>. </table></p> +<h3 id="format-specifiers-for-date/time-conversions">Format Specifiers for Date/Time Conversions</h3> + <p>Use the following format specifiers for date/time conversions:</p> <table> @@ -428,11 +461,11 @@ FROM hbase.table1 <li><a href="http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html">Java DateTimeFormat class</a> format specifiers</li> </ul> -<h1 id="to_char">TO_CHAR</h1> +<h2 id="to_char">TO_CHAR</h2> <p>TO_CHAR converts a date, time, timestamp, or numerical expression to a character string.</p> -<h2 id="syntax">Syntax</h2> +<h3 id="syntax">Syntax</h3> <div class="highlight"><pre><code class="language-text" data-lang="text">TO_CHAR (expression, 'format'); </code></pre></div> <p><em>expression</em> is a float, integer, decimal, date, time, or timestamp expression. </p> @@ -441,12 +474,10 @@ FROM hbase.table1 <h3 id="usage-notes">Usage Notes</h3> -<p>Currently Drill does not support a timestamp with time zone data type. Drill stores the timestamp and date in <a href="http://www.timeanddate.com/time/aboututc.html">UTC</a> 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. </p> - -<h2 id="examples">Examples</h2> +<h3 id="examples">Examples</h3> <p>Convert a float to a character string.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_CHAR(125.789383, '#,###.###') FROM dfs.`/Users/Drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_CHAR(125.789383, '#,###.###') FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -454,7 +485,7 @@ FROM hbase.table1 +------------+ </code></pre></div> <p>Convert an integer to a character string.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_CHAR(125, '#,###.###') FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_CHAR(125, '#,###.###') FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -463,7 +494,7 @@ FROM hbase.table1 1 row selected (0.083 seconds) </code></pre></div> <p>Convert a date to a character string.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT to_char((cast('2008-2-23' as date)), 'yyyy-MMM-dd') FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_CHAR((CAST('2008-2-23' AS DATE)), 'yyyy-MMM-dd') FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -471,7 +502,7 @@ FROM hbase.table1 +------------+ </code></pre></div> <p>Convert a time to a string.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT to_char(cast('12:20:30' as time), 'HH mm ss') FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_CHAR(CAST('12:20:30' AS TIME), 'HH mm ss') FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -480,7 +511,7 @@ FROM hbase.table1 1 row selected (0.07 seconds) </code></pre></div> <p>Convert a timestamp to a string.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT to_char(cast('2015-2-23 12:00:00' as timestamp), 'yyyy MMM dd HH:mm:ss') FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_CHAR(CAST('2015-2-23 12:00:00' AS TIMESTAMP), 'yyyy MMM dd HH:mm:ss') FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -488,27 +519,27 @@ FROM hbase.table1 +------------+ 1 row selected (0.075 seconds) </code></pre></div> -<h1 id="to_date">TO_DATE</h1> +<h2 id="to_date">TO_DATE</h2> <p>Converts a character string or a UNIX epoch timestamp to a date.</p> -<h2 id="syntax">Syntax</h2> +<h3 id="syntax">Syntax</h3> <div class="highlight"><pre><code class="language-text" data-lang="text">TO_DATE (expression [, 'format']); </code></pre></div> -<p><em>expression</em> is a character string enclosed in single quotation marks or a UNIX epoch timestamp in milliseconds, not enclosed in single quotation marks. </p> +<p><em>expression</em> is a character string enclosed in single quotation marks or a Unix epoch timestamp in milliseconds, not enclosed in single quotation marks. </p> <ul> <li>'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. </li> </ul> -<h2 id="usage">Usage</h2> +<h3 id="usage">Usage</h3> -<p>Specify a format using patterns defined in <a href="http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html">Java DateTimeFormat class</a>.</p> +<p>Specify a format using patterns defined in <a href="http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html">Java DateTimeFormat class</a>. The TO_TIMESTAMP function takes a Unix epoch timestamp. The TO_DATE function takes a UNIX epoch timestamp in milliseconds.</p> -<h2 id="examples">Examples</h2> +<h3 id="examples">Examples</h3> <p>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. </p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_DATE('2015-FEB-23', 'yyyy-MMM-dd') FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_DATE('2015-FEB-23', 'yyyy-MMM-dd') FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -516,7 +547,7 @@ FROM hbase.table1 +------------+ 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 | @@ -526,7 +557,7 @@ SELECT EXTRACT(year from mydate) `extrac 1 row selected (0.128 seconds) </code></pre></div> <p>The following example converts a UNIX epoch timestamp to a date.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_DATE(1427849046000) FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_DATE(1427849046000) FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -534,11 +565,11 @@ SELECT EXTRACT(year from mydate) `extrac +------------+ 1 row selected (0.082 seconds) </code></pre></div> -<h1 id="to_number">TO_NUMBER</h1> +<h2 id="to_number">TO_NUMBER</h2> <p>TO_NUMBER converts a character string to a formatted number using a format specification.</p> -<h2 id="syntax">Syntax</h2> +<h3 id="syntax">Syntax</h3> <div class="highlight"><pre><code class="language-text" data-lang="text">TO_NUMBER ('string', 'format'); </code></pre></div> <p><em>'string'</em> is a character string enclosed in single quotation marks. </p> @@ -547,7 +578,7 @@ SELECT EXTRACT(year from mydate) `extrac <li>'format'* is one or more <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">Java DecimalFormat class</a> format specifiers enclosed in single quotation marks that set a pattern for the output formatting.</li> </ul> -<h2 id="usage-notes">Usage Notes</h2> +<h3 id="usage-notes">Usage Notes</h3> <p>The data type of the output of TO_NUMBER is a numeric. You can use the following <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">Java DecimalFormat class</a> format specifiers to set the output formatting. </p> @@ -563,15 +594,15 @@ Comma grouping separator. </p></li> Exponent. Separates mantissa and exponent in scientific notation. </p></li> </ul> -<h2 id="examples">Examples</h2> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_NUMBER('987,966', '######') FROM dfs.`/Users/Drill/dummy.json`; +<h3 id="examples">Examples</h3> +<div class="highlight"><pre><code class="language-text" data-lang="text">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 | +------------+ @@ -579,7 +610,7 @@ SELECT TO_NUMBER('987.966', ' +------------+ 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 | +------------+ @@ -587,12 +618,25 @@ SELECT TO_NUMBER('12345', '# +------------+ 1 row selected (0.069 seconds) </code></pre></div> -<h1 id="to_time">TO_TIME</h1> +<h2 id="to_time">TO_TIME</h2> <p>Converts a character string to a time.</p> -<h2 id="examples">Examples</h2> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_TIME('12:20:30', 'HH:mm:ss') FROM dfs.`/Users/Drill/test_files_source/dummy.json`; +<h3 id="syntax">Syntax</h3> +<div class="highlight"><pre><code class="language-text" data-lang="text">TO_TIME (expression [, 'format']); +</code></pre></div> +<p><em>expression</em> is a character string enclosed in single quotation marks or milliseconds, not enclosed in single quotation marks. </p> + +<ul> +<li>'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. </li> +</ul> + +<h2 id="usage">Usage</h2> + +<p>Specify a format using patterns defined in <a href="http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html">Java DateTimeFormat class</a>.</p> + +<h3 id="examples">Examples</h3> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_TIME('12:20:30', 'HH:mm:ss') FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -600,17 +644,42 @@ SELECT TO_NUMBER('12345', '# +------------+ 1 row selected (0.067 seconds) </code></pre></div> -<h1 id="to_timestamp">TO_TIMESTAMP</h1> +<p>Convert 828550000 milliseconds (23 hours 55 seconds) to the time.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT to_time(82855000) FROM sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| 23:00:55 | ++------------+ +1 row selected (0.086 seconds) +</code></pre></div> +<h2 id="to_timestamp">TO_TIMESTAMP</h2> + +<h3 id="syntax">Syntax</h3> +<div class="highlight"><pre><code class="language-text" data-lang="text">TO_TIMESTAMP (expression [, 'format']); +</code></pre></div> +<p><em>expression</em> is a character string enclosed in single quotation marks or a UNIX epoch timestamp, not enclosed in single quotation marks. </p> + +<ul> +<li>'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. </li> +</ul> -<p>Converts a date or Unix Epoch timestamp to a timestamp.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT to_timestamp('2008-2-23 12:00:00', 'yyyy-MM-dd HH:mm:ss') FROM dfs.`/Users/Drill/dummy.json`; +<h3 id="usage">Usage</h3> + +<p>Specify a format using patterns defined in <a href="http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html">Java DateTimeFormat class</a>. The TO_TIMESTAMP function takes a Unix epoch timestamp. The TO_DATE function takes a UNIX epoch timestamp in milliseconds.</p> + +<h3 id="examples">Examples</h3> + +<p>Convert a date to a timestamp. </p> +<div class="highlight"><pre><code class="language-text" data-lang="text">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`; +</code></pre></div> +<p>Convert a Unix Epoch time to a timestamp.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TO_TIMESTAMP(1427936330) FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -618,12 +687,16 @@ SELECT to_timestamp(1427936330) FROM dfs +------------+ 1 row selected (0.094 seconds) </code></pre></div> -<!-- 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; - - Using âZâ will provide offset from UTC as opposed to the 3 letter timezone code. - --> +<p>Connvert a UTC date to a timestamp offset from the UTC time zone code.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">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) +</code></pre></div> <!-- DRILL-448 Support timestamp with time zone --> <!-- Apache Drill Modified: drill/site/trunk/content/drill/docs/date-time-and-timestamp/index.html URL: http://svn.apache.org/viewvc/drill/site/trunk/content/drill/docs/date-time-and-timestamp/index.html?rev=1671223&r1=1671222&r2=1671223&view=diff ============================================================================== --- drill/site/trunk/content/drill/docs/date-time-and-timestamp/index.html (original) +++ drill/site/trunk/content/drill/docs/date-time-and-timestamp/index.html Fri Apr 3 23:59:30 2015 @@ -67,20 +67,17 @@ </div> -<div class="int_text" align="left"><p>Using familiar date and time formats, listed in the <a href="/docs/data-types">SQL data types table</a>, 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. </p> +<div class="int_text" align="left"><p>Using familiar date and time formats, listed in the <a href="/docs/data-types/supported-data-types">SQL data types table</a>, 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. </p> -<p>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.</p> +<p>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 <a href="/docs/casting/converting-data-types#to_timestamp">TO_TIMESTAMP function</a> in a query to use time stamp data having a time zone.</p> -<p>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.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">{"dummy" : "data"} -</code></pre></div> <p>Next, use the following literals in a SELECT statement. </p> <ul> <li><code>date</code></li> <li><code>time</code></li> <li><p><code>timestamp</code></p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT date '2010-2-15' FROM dfs.`/Users/drilluser/apache-drill-0.8.0/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT date '2010-2-15' FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -88,7 +85,7 @@ +------------+ 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 | +------------+ @@ -96,7 +93,7 @@ SELECT time '15:20:30' from dfs. +------------+ 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 | +------------+ @@ -131,8 +128,8 @@ P [qty] Y [qty] M <p>The format of INTERVAL data in the data source differs from the query format. </p> -<p>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.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT INTERVAL '1 10:20:30.123' day to second FROM dfs.`/Users/drilluser/apache-drill-0.8.0/dummy.json`; +<p>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.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT INTERVAL '1 10:20:30.123' day to second FROM sys.drillbits; +------------+ | EXPR$0 | +------------+ @@ -140,7 +137,7 @@ P [qty] Y [qty] M +------------+ 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 | +------------+ @@ -148,7 +145,7 @@ SELECT INTERVAL '1-2' year to mo +------------+ 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 | +------------+ @@ -156,7 +153,7 @@ SELECT INTERVAL '1' year FROM df +------------+ 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 | +------------+ Added: drill/site/trunk/content/drill/docs/date-time-functions-and-arithmetic/index.html URL: http://svn.apache.org/viewvc/drill/site/trunk/content/drill/docs/date-time-functions-and-arithmetic/index.html?rev=1671223&view=auto ============================================================================== --- drill/site/trunk/content/drill/docs/date-time-functions-and-arithmetic/index.html (added) +++ drill/site/trunk/content/drill/docs/date-time-functions-and-arithmetic/index.html Fri Apr 3 23:59:30 2015 @@ -0,0 +1,400 @@ +<!DOCTYPE html> +<html> + +<head> + +<meta charset="UTF-8"> + + +<title>Date/Time Functions and Arithmetic - Apache Drill</title> + +<link href="/css/syntax.css" rel="stylesheet" type="text/css"> +<link href="/css/style.css" rel="stylesheet" type="text/css"> +<link href="/css/arrows.css" rel="stylesheet" type="text/css"> +<link href="/css/button.css" rel="stylesheet" type="text/css"> + +<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> +<link rel="icon" href="/favicon.ico" type="image/x-icon"> + +<script language="javascript" type="text/javascript" src="/js/lib/jquery-1.11.1.min.js"></script> +<script language="javascript" type="text/javascript" src="/js/lib/jquery.easing.1.3.js"></script> +<script language="javascript" type="text/javascript" src="/js/modernizr.custom.js"></script> +<script language="javascript" type="text/javascript" src="/js/script.js"></script> + +</head> + +<body onResize="resized();"> + +<div class="bui"></div> + +<div id="search"> +<input type="text" placeholder="Enter search term here"> +</div> + +<div id="menu" class="mw"> +<ul> + <li class="logo"><a href="/"></a></li> + <li> + <a href="/overview/">Documentation</a> + <ul> + <li><a href="/overview/">Overview </a></li> + <li><a href="http://drill.apache.org/docs/apache-drill-in-10-minutes/" target="_blank">Drill in 10 Minutes</a></li> + <li><a href="/why/">Why Drill? </a></li> + <li><a href="/architecture/">Architecture</a></li> + </ul> + </li> + <li> + <a href="/community/">Community</a> + <ul> + <li><a href="/team/">Team</a></li> + <li><a href="/community/#events">Events and Meetups</a></li> + <li><a href="/community/#mailinglists">Mailing Lists</a></li> + <li><a href="/community/#getinvolved">Get Involved</a></li> + <li><a href="https://issues.apache.org/jira/browse/DRILL/" target="_blank">Issue Tracker</a></li> + <li><a href="https://github.com/apache/drill" target="_blank">GitHub</a></li> + </ul> + </li> + <li><a href="/faq/">FAQ</a></li> + <li><a href="/blog/">Blog</a></li> + <li style="width:30px; padding-left: 2px; padding-right:10px"><a href="https://twitter.com/apachedrill" target="_blank"><img src="/images/twitterbw.png" alt="" align="center" width="22" style="padding: 0px 10px 1px 0px;"></a> </li> + <li class="l"><span> </span></li> + <li class="d"><a href="/download/">Download</a></li> +</ul> +</div> + +<div class="int_title"> +<h1>Date/Time Functions and Arithmetic</h1> + +</div> + +<div class="int_text" align="left"><p>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. </p> + +<h2 id="date/time-functions-and-utilities">Date/Time Functions and Utilities</h2> + +<p>The following functions perform date/time-related operations:</p> + +<ul> +<li>AGE</li> +<li>EXTRACT</li> +<li>DATE_PART</li> +</ul> + +<p>Drill supports the following utilities:</p> + +<ul> +<li>CURRENT_DATE</li> +<li>CURRENT_TIME</li> +<li>CURRENT_TIMESTAMP</li> +<li>LOCALTIME</li> +<li>LOCALTIMESTAMP</li> +<li>NOW</li> +<li>TIMEOFDAY</li> +</ul> + +<h3 id="age">AGE</h3> + +<p>Returns the interval between two timestamps or subtracts a timestamp from midnight of the current date.</p> + +<h4 id="syntax">Syntax</h4> +<div class="highlight"><pre><code class="language-text" data-lang="text">AGE (timestamp[, timestamp]); +</code></pre></div> +<p><em>timestamp</em> is a timestamp formatted as shown in the examples.</p> + +<h4 id="usage-notes">Usage Notes</h4> + +<p>Cast string arguments to timestamp to include time data in the calculations of the interval.</p> + +<h4 id="examples">Examples</h4> + +<p>Find the interval between midnight April 3, 2015 and June 13, 1957.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT AGE('1957-06-13') FROM sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| P703M23D | ++------------+ +1 row selected (0.064 seconds) +</code></pre></div> +<p>Find the interval between 11:10:10 PM on January 1, 2001 and 10:10:10 PM on January 1, 2001.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">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) +</code></pre></div> +<p>For information about how to read the interval data, see the <a href="/docs/date-time-and-timestamp#interval">Interval section</a>.</p> + +<h3 id="extract">EXTRACT</h3> + +<p>Returns a component of a timestamp, time, date, or interval.</p> + +<h4 id="syntax">Syntax</h4> +<div class="highlight"><pre><code class="language-text" data-lang="text">EXTRACT (expression); +</code></pre></div> +<p><em>expression</em> is:</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">component FROM (timestamp | time | date | interval) +</code></pre></div> +<p><em>component</em> is a year, month, day, hour, minute, or second value.</p> + +<h4 id="examples">Examples</h4> + +<p>On the third day of the month, run the following function:</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">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) +</code></pre></div> +<p>At 8:00 am, extract the hour from the value of CURRENT_DATE.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT EXTRACT(hour FROM CURRENT_DATE) FROM sys.drillbits; + ++------------+ +| EXPR$0 | ++------------+ +| 8 | ++------------+ +</code></pre></div> +<p>What is the hour component of this time: 17:12:28.5?</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT EXTRACT(hour FROM TIME '17:12:28.5') from sys.drillbits; + ++------------+ +| EXPR$0 | ++------------+ +| 17 | ++------------+ +1 row selected (0.056 seconds) +</code></pre></div> +<p>What is the second component of this timestamp: 2001-02-16 20:38:40</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT EXTRACT(SECOND FROM TIMESTAMP '2001-02-16 20:38:40') from sys.drillbits; + ++------------+ +| EXPR$0 | ++------------+ +| 40.0 | ++------------+ +1 row selected (0.062 seconds) +</code></pre></div> +<h3 id="date_part">DATE_PART</h3> + +<p>Returns a field of a date, time, timestamp, or interval.</p> + +<h4 id="syntax">Syntax</h4> +<div class="highlight"><pre><code class="language-text" data-lang="text">date_part(component, expression); +</code></pre></div> +<p><em>component</em> is year, month, day, hour, minute, second, enclosed in single quotation marks.</p> + +<p><em>expression</em> is date, time, timestamp, or interval enclosed in single quotation marks.</p> + +<h4 id="usage-notes">Usage Notes</h4> + +<p>Use Unix Epoch timestamp in milliseconds as the expression to get the field of a timestamp.</p> + +<h4 id="examples">Examples</h4> +<div class="highlight"><pre><code class="language-text" data-lang="text">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) +</code></pre></div> +<p>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.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT DATE_PART('hour', 1428017143000) FROM sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| 23 | ++------------+ +1 row selected (0.07 seconds) +</code></pre></div> +<p>Return the day part of the one year, 2 months, 10 days interval.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT DATE_PART('day', '1:2:10') FROM sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| 10 | ++------------+ +1 row selected (0.069 seconds) +</code></pre></div> +<!-- date_add +date_sub --> + +<h3 id="date/time-utilities">Date/Time Utilities</h3> + +<p>The utilities are:</p> + +<ul> +<li>CURRENT_DATE</li> +<li>CURRENT_TIME</li> +<li>CURRENT_TIMESTAMP</li> +<li>LOCALTIME</li> +<li>LOCALTIMESTAMP</li> +<li>NOW</li> +<li>TIMEOFDAY</li> +</ul> + +<p>The following examples show how to use the utilities:</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">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) +</code></pre></div> +<p>If you set up Drill for <a href="/docs/casting-converting-data-types/time-zone-limitation">UTC time</a>, TIMEOFDAY returns the result for the UTC time zone.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TIMEOFDAY() FROM sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| 2015-04-02 22:05:02.424 UTC | ++------------+ +1 row selected (1.191 seconds) +</code></pre></div> +<p>If you did not set up Drill for UTC time, TIMEOFDAY returns the local date and time with time zone information.</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT TIMEOFDAY() FROM sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| 2015-04-02 15:01:31.114 America/Los_Angeles | ++------------+ +1 row selected (1.199 seconds) +</code></pre></div> +<h3 id="date,-time,-and-interval-arithmetic-functions">Date, Time, and Interval Arithmetic Functions</h3> + +<!-- date +/- integer +date + interval --> + +<p>Is the day returned from the NOW function the same as the day returned from the CURRENT_DATE function?</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT EXTRACT(day FROM NOW()) = EXTRACT(day FROM CURRENT_DATE) FROM sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| true | ++------------+ +1 row selected (0.092 seconds) +</code></pre></div> +<p>Every 23 hours, a 4 hour task started. What time does the task end? </p> +<div class="highlight"><pre><code class="language-text" data-lang="text">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) +</code></pre></div> +<p>Is the time 2:00 PM?</p> +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT EXTRACT(hour FROM CURRENT_DATE) = 2 FROM sys.drillbits; ++------------+ +| EXPR$0 | ++------------+ +| false | ++------------+ +1 row selected (0.033 seconds) +</code></pre></div> +<!-- 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) --> +</div> + + +<div id="footer" class="mw"> +<div class="wrapper"> +Copyright © 2012-2014 The Apache Software Foundation, licensed under the Apache License, Version 2.0.<br> +Apache and the Apache feather logo are trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.<br/><br/> +</div> +</div> + +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + +ga('create', 'UA-53379651-1', 'auto'); +ga('send', 'pageview'); +</script> + +</body> +</html> Modified: drill/site/trunk/content/drill/docs/index.html URL: http://svn.apache.org/viewvc/drill/site/trunk/content/drill/docs/index.html?rev=1671223&r1=1671222&r2=1671223&view=diff ============================================================================== --- drill/site/trunk/content/drill/docs/index.html (original) +++ drill/site/trunk/content/drill/docs/index.html Fri Apr 3 23:59:30 2015 @@ -427,6 +427,8 @@ + + </ul> @@ -691,6 +693,8 @@ + + </ul> @@ -985,6 +989,8 @@ + + <li><a href="/docs/installing-the-apache-drill-sandbox/">Installing the Apache Drill Sandbox</a></li> @@ -1286,6 +1292,8 @@ + + <li><a href="/docs/installing-the-mapr-sandbox-with-apache-drill-on-vmware-player-vmware-fusion/">Installing the MapR Sandbox with Apache Drill on VMware Player/VMware Fusion</a></li> @@ -1791,6 +1799,8 @@ + + </ul> @@ -1980,6 +1990,8 @@ + + </ul> @@ -2359,6 +2371,8 @@ + + </ul> @@ -2621,6 +2635,8 @@ + + </ul> @@ -3084,6 +3100,8 @@ + + </ul> @@ -3403,6 +3421,8 @@ + + </ul> @@ -3578,6 +3598,8 @@ + + </ul> @@ -4078,6 +4100,8 @@ + + </ul> @@ -4395,6 +4419,8 @@ + + </ul> @@ -4721,6 +4747,8 @@ + + </ul> @@ -4852,6 +4880,8 @@ + + </ul> @@ -5400,6 +5430,8 @@ + + </ul> @@ -5704,6 +5736,10 @@ + <li><a href="/docs/date-time-functions-and-arithmetic/">Date/Time Functions and Arithmetic</a></li> + + + @@ -6013,6 +6049,8 @@ + + <li><a href="/docs/flatten/">FLATTEN</a></li> @@ -6375,6 +6413,8 @@ + + </ul> @@ -6447,6 +6487,8 @@ + + </ul> @@ -6776,6 +6818,8 @@ + + </ul> @@ -7110,6 +7154,8 @@ + + </ul> @@ -7592,6 +7638,8 @@ + + </ul> @@ -7754,6 +7802,8 @@ + + </ul> @@ -8162,6 +8212,8 @@ + + </ul> @@ -8475,6 +8527,8 @@ + + </ul> @@ -8794,6 +8848,8 @@ + + </ul> @@ -9002,6 +9058,8 @@ + + </ul> @@ -9341,6 +9399,8 @@ + + </ul> @@ -9665,6 +9725,8 @@ + + </ul> @@ -9984,6 +10046,8 @@ + + </ul> @@ -10298,6 +10362,8 @@ + + </ul> @@ -10310,6 +10376,8 @@ + + Modified: drill/site/trunk/content/drill/docs/installing-the-apache-drill-sandbox/index.html URL: http://svn.apache.org/viewvc/drill/site/trunk/content/drill/docs/installing-the-apache-drill-sandbox/index.html?rev=1671223&r1=1671222&r2=1671223&view=diff ============================================================================== --- drill/site/trunk/content/drill/docs/installing-the-apache-drill-sandbox/index.html (original) +++ drill/site/trunk/content/drill/docs/installing-the-apache-drill-sandbox/index.html Fri Apr 3 23:59:30 2015 @@ -88,7 +88,7 @@ verify that the host system meets the fo <h3 id="vm-player-downloads">VM Player Downloads</h3> -<p>For Linux, Mac, or Windows, download the free <a href="https://my.vmwar%0Ae.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0">VMware Player</a> or +<p>For Linux, Mac, or Windows, download the free <a href="https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0" title="VMwarePlayer">VMware Player</a> or <a href="https://www.virtualbox.org/wiki/Downloads">VirtualBox</a>. Optionally, you can purchase <a href="http://www.vmware.com/products/fusion/">VMware Fusion</a> for Mac.</p> Modified: drill/site/trunk/content/drill/docs/math-and-trig/index.html URL: http://svn.apache.org/viewvc/drill/site/trunk/content/drill/docs/math-and-trig/index.html?rev=1671223&r1=1671222&r2=1671223&view=diff ============================================================================== --- drill/site/trunk/content/drill/docs/math-and-trig/index.html (original) +++ drill/site/trunk/content/drill/docs/math-and-trig/index.html Fri Apr 3 23:59:30 2015 @@ -225,18 +225,10 @@ <h2 id="math-function-examples">Math Function Examples</h2> -<p>Examples in this section use the following files:</p> - -<ul> -<li>The <code>input2.json</code> file</li> -<li>A dummy JSON file</li> -</ul> +<p>Examples in this section use the <code>input2.json</code> file</p> <p>Download the <code>input2.json</code> file from the <a href="https://github.com/apache/drill/tree/master/exec/java-exec/src/test/resources/jsoninput">Drill source code</a> page. On the Mac, for example, right-click input2.json and choose Save Link As, and then click Save.</p> -<p>The following examples refer to a dummy JSON file in the FROM clause. The dummy JSON file has following contents.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">{"dummy" : "data"} -</code></pre></div> <h4 id="abs-example">ABS Example</h4> <p>Get the absolute value of the integer key in <code>input2.json</code>. The following snippet of input2.json shows the relevant integer content:</p> @@ -333,7 +325,7 @@ SELECT ABS(`integer`) FROM dfs.`/Users/d +------------+ 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 | @@ -350,7 +342,7 @@ SELECT ROUND(`float`, 4) FROM dfs.`/User <h2 id="log-examples">Log Examples</h2> <p>Get the base 2 log of 64.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT log(2, 64) FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT log(2, 64) FROM sys.drillbits; +------------+ | EXPR$0 | @@ -360,7 +352,7 @@ SELECT ROUND(`float`, 4) FROM dfs.`/User 1 row selected (0.069 seconds) </code></pre></div> <p>Get the common log of 100.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT log10(100) FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT log10(100) FROM sys.drillbits; +------------+ | EXPR$0 | @@ -370,7 +362,7 @@ SELECT ROUND(`float`, 4) FROM dfs.`/User 1 row selected (0.203 seconds) </code></pre></div> <p>Get the natural log of 7.5.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT log(7.5) FROM dfs.`/Users/drill/sample-data/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT log(7.5) FROM sys.drillbits; +------------+ | EXPR$0 | @@ -407,7 +399,7 @@ Hyperbolic tangent of hyperbolic angle x <p><strong>Examples</strong></p> <p>Find the sine and tangent of a 45 degree angle. First convert degrees to radians for use in the SIN() function.</p> -<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT RADIANS(30) AS Degrees FROM dfs.`/Users/drill/dummy.json`; +<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT RADIANS(30) AS Degrees FROM sys.drillbits; +------------+ | Degrees | @@ -416,7 +408,7 @@ Hyperbolic tangent of hyperbolic angle x +------------+ 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 | @@ -425,7 +417,7 @@ SELECT SIN(0.7853981633974483) AS `Sine +-----------------------+ 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 | Modified: drill/site/trunk/content/drill/feed.xml URL: http://svn.apache.org/viewvc/drill/site/trunk/content/drill/feed.xml?rev=1671223&r1=1671222&r2=1671223&view=diff ============================================================================== --- drill/site/trunk/content/drill/feed.xml (original) +++ drill/site/trunk/content/drill/feed.xml Fri Apr 3 23:59:30 2015 @@ -6,8 +6,8 @@ </description> <link>/</link> <atom:link href="/feed.xml" rel="self" type="application/rss+xml"/> - <pubDate>Wed, 01 Apr 2015 18:48:09 -0700</pubDate> - <lastBuildDate>Wed, 01 Apr 2015 18:48:09 -0700</lastBuildDate> + <pubDate>Fri, 03 Apr 2015 16:57:09 -0700</pubDate> + <lastBuildDate>Fri, 03 Apr 2015 16:57:09 -0700</lastBuildDate> <generator>Jekyll v2.5.2</generator> <item>