Repository: drill Updated Branches: refs/heads/gh-pages 91e3f20aa -> 2672c3669
DRILL-2713 Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/2672c366 Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/2672c366 Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/2672c366 Branch: refs/heads/gh-pages Commit: 2672c3669ed434b6825064c6ac103d19347eeb73 Parents: 91e3f20 Author: Kristine Hahn <kh...@maprtech.com> Authored: Tue Apr 7 18:27:44 2015 -0700 Committer: Bridget Bevens <bbev...@maprtech.com> Committed: Tue Apr 7 18:44:22 2015 -0700 ---------------------------------------------------------------------- _docs/query/003-query-hbase.md | 4 ++-- _docs/sql-ref/004-functions.md | 2 +- _docs/sql-ref/functions/001-math.md | 15 ++++++++------- _docs/sql-ref/functions/002-conversion.md | 10 ++++------ _docs/sql-ref/functions/004-string.md | 4 ++-- _docs/sql-ref/nested/004-repeated-contains.md | 17 +++++++++++++---- 6 files changed, 30 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/2672c366/_docs/query/003-query-hbase.md ---------------------------------------------------------------------- diff --git a/_docs/query/003-query-hbase.md b/_docs/query/003-query-hbase.md index a4e8bc5..e4bbd9d 100644 --- a/_docs/query/003-query-hbase.md +++ b/_docs/query/003-query-hbase.md @@ -91,7 +91,7 @@ steps: cat testdata.txt | hbase shell 5. Start Drill. Type `sqlline` on the terminal command line if you are using the Drill Sandbox; otherwise, see [Starting/Stopping Drill]({{ site.baseurl }}/docs/starting-stopping-drill). -6. Use the `maprdb` storage plugin, which includes the [MapR-DB format](/docs/mapr-db-format), if you are using the Drill Sandbox; otherwise, enable and use the hbase storage plugin on a system having HBase services. +6. Use the [MapR-DB format plugin](/docs/mapr-db-format), if you are using the Drill Sandbox; otherwise, enable and use the hbase storage plugin on a system having HBase services. USE hbase; /* If you have installed HBase services. */ @@ -99,7 +99,7 @@ steps: USE maprdb; /* If you are using the Drill Sandbox */ -The `maprdb` storage plugin provides access to the `/tables` directory. Use Drill to query the students and clicks tables on the Drill Sandbox. +The `maprdb` format plugin provides access to the `/tables` directory. Use Drill to query the students and clicks tables on the Drill Sandbox. ## Query HBase Tables 1. Issue the following query to see the data in the students table: http://git-wip-us.apache.org/repos/asf/drill/blob/2672c366/_docs/sql-ref/004-functions.md ---------------------------------------------------------------------- diff --git a/_docs/sql-ref/004-functions.md b/_docs/sql-ref/004-functions.md index 3eba507..a076920 100644 --- a/_docs/sql-ref/004-functions.md +++ b/_docs/sql-ref/004-functions.md @@ -5,7 +5,7 @@ parent: "SQL Reference" You can use the following types of functions in your Drill queries: * [Math and Trig](/docs/math-and-trig/) - * [Casting and Converting Data Types](/docs/casting-converting-data-types/) + * [Data Type Conversion](/docs/data-type-conversion/) * [Date/Time and Arithmetic](/docs/date-time-functions-and-arithmetic/) * [String Manipulation](/docs/string-manipulation) * [Aggregate and Aggregate Statistical](/docs/aggregate-and-aggregate-statistical) http://git-wip-us.apache.org/repos/asf/drill/blob/2672c366/_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 fd0c8f3..718998a 100644 --- a/_docs/sql-ref/functions/001-math.md +++ b/_docs/sql-ref/functions/001-math.md @@ -19,7 +19,7 @@ Exceptions are the LSHIFT and RSHIFT functions, which take all types except the * DECIMAL9 * DECIMAL18 -**Math Functions** +# Math Functions <table> <tr> @@ -156,10 +156,9 @@ Exceptions are the LSHIFT and RSHIFT functions, which take all types except the ## Math Function Examples -Examples in this section use the `input2.json` file +Examples in this section use the `input2.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. - -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. +You need to use a FROM clause in Drill queries. This document often uses the sys.version table in the FROM clause of the query for example purposes. #### ABS Example Get the absolute value of the integer key in `input2.json`. The following snippet of input2.json shows the relevant integer content: @@ -178,6 +177,8 @@ Get the absolute value of the integer key in `input2.json`. The following snippe SELECT `integer` FROM dfs.`/Users/drill/input2.json`; +The output shows values not shown in the snippet. You can take a look at all the values in the input2.json file. + +------------+ | integer | +------------+ @@ -200,7 +201,7 @@ Get the absolute value of the integer key in `input2.json`. The following snippe +------------+ 4 rows selected (0.357 seconds) -## CEIL Example +### CEIL Example Get the ceiling of float key values in input2.json. The input2.json file contains these float key values: * 17.4 @@ -300,7 +301,7 @@ Get the natural log of 7.5. +------------+ 1 row selected (0.063 seconds) -**Trig Functions** +# Trig Functions Drill supports the following trig functions, which return a FLOAT8 result. @@ -331,7 +332,7 @@ Drill supports the following trig functions, which return a FLOAT8 result. * TANH() Hyperbolic tangent of hyperbolic angle x in radians -**Examples** +## Examples Find the sine and tangent of a 45 degree angle. First convert degrees to radians for use in the SIN() function. http://git-wip-us.apache.org/repos/asf/drill/blob/2672c366/_docs/sql-ref/functions/002-conversion.md ---------------------------------------------------------------------- diff --git a/_docs/sql-ref/functions/002-conversion.md b/_docs/sql-ref/functions/002-conversion.md index 67b6562..875de69 100644 --- a/_docs/sql-ref/functions/002-conversion.md +++ b/_docs/sql-ref/functions/002-conversion.md @@ -211,7 +211,7 @@ You use the CONVERT_FROM function to decode the binary data to render it readabl This example assumes you are working in the Drill Sandbox. The `maprdb` storage plugin definition is limited, so you modify the `dfs` storage plugin slightly and use that plugin for this example. -1. Copy/paste the `dfs` storage plugin defintion to a newly created plugin called myplugin. +1. Copy/paste the `dfs` storage plugin definition to a newly created plugin called myplugin. 2. Change the root location to "/mapr/demo.mapr.com/tables". This change allows you to query tables for reading in the tables directory by workspace.table name. This change allows you to read a table in the `tables` directory. You can write a converted version of the table in the `tmp` directory because the writable property is true. @@ -651,8 +651,6 @@ TO_CHAR converts a date, time, timestamp, or numerical expression to a character *'format'* is a format specifier enclosed in single quotation marks that sets a pattern for the output formatting. -### Usage Notes - ### Examples @@ -796,10 +794,10 @@ TO_NUMBER converts a character string to a formatted number using a format speci 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) specifiers to set the output formatting. * # - Digit place holder. + Digit placeholder. * 0 - Digit place holder. If a value has a digit in the position where the zero '0' appears in the format string, that digit appears in the output; otherwise, a '0' appears in that position in the output. + Digit placeholder. If a value has a digit in the position where the zero '0' appears in the format string, that digit appears in the output; otherwise, a '0' appears in that position in the output. * . Decimal point. Make the first '.' character in the format string the location of the decimal separator in the value; ignore any additional '.' characters. @@ -903,7 +901,7 @@ Convert Unix Epoch time to a timestamp. +------------+ 1 row selected (0.094 seconds) -Connvert a UTC date to a timestamp offset from the UTC time zone code. +Convert 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 http://git-wip-us.apache.org/repos/asf/drill/blob/2672c366/_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 04c8ffc..1367272 100644 --- a/_docs/sql-ref/functions/004-string.md +++ b/_docs/sql-ref/functions/004-string.md @@ -146,7 +146,7 @@ Returns the number of characters in the string. 4 rows selected (0.259 seconds) ## LOWER -Converts characters in the string to lower case. +Converts characters in the string to lowercase. ### Syntax @@ -364,7 +364,7 @@ Removes the longest string having only the characters from the beginning, end, o 1 row selected (0.172 seconds) ## UPPER -Converts characters in the string to lower case. +Converts characters in the string to uppercase. ### Syntax http://git-wip-us.apache.org/repos/asf/drill/blob/2672c366/_docs/sql-ref/nested/004-repeated-contains.md ---------------------------------------------------------------------- diff --git a/_docs/sql-ref/nested/004-repeated-contains.md b/_docs/sql-ref/nested/004-repeated-contains.md index 1c0f8f1..bbb1643 100644 --- a/_docs/sql-ref/nested/004-repeated-contains.md +++ b/_docs/sql-ref/nested/004-repeated-contains.md @@ -27,12 +27,21 @@ REPEATED CONTAINS searches for a keyword in an array. * keyword is a value in the array, such as 'Glazed'. ## Usage Notes -REPEATED_CONTAINS returns true if Drill finds a match; otherwise, the function returns false. The function supports regular expression wildcards, such as *, ., and ?, but not at the beginning of the keyword. Enclose keyword string values in single quotation marks. Do not enclose numerical keyword values in single quotation marks. +REPEATED_CONTAINS returns true if Drill finds a match; otherwise, the function returns false. The function supports regular expression wildcards, but not at the beginning of the keyword: + +* Asterisk (*) +* Period (.) +* Question mark (?) +* Square bracketed ranges [a-z] +* Square bracketed characters [ch] +* Negated square bracketed ranges or characters [!ch]. + +Enclose keyword string values in single quotation marks. Do not enclose numerical keyword values in single quotation marks. ## Examples -The examples in this section `testRepeatedWrite.json`. To download this file, go to [Drill test resources](https://github.com/apache/drill/tree/master/exec/java-exec/src/test/resources) page, locate testRepeatedWrite.json.json in the list of files, and download it. For example, on the Mac right-click the five, select Save Link As, and then click Save. +The examples in this section use `testRepeatedWrite.json`. To download this file, go to [Drill test resources](https://github.com/apache/drill/tree/master/exec/java-exec/src/test/resources) page, locate testRepeatedWrite.json in the list of files, and download it. -Which donuts having glazed or glaze toppings? +Which donuts have glazed or glaze toppings? SELECT name, REPEATED_CONTAINS(topping, 'Glaze?') AS `Glazed?` FROM dfs.`/Users/drill/testRepeatedWrite.json` WHERE type='donut'; @@ -47,7 +56,7 @@ Which donuts having glazed or glaze toppings? +------------+------------+ 5 rows selected (0.072 seconds) -Which objects have powered sugar toppings? Use the asterisk wildcard instead of typing the entire keyword pair. +Which objects have powdered sugar toppings? Use the asterisk wildcard instead of typing the entire keyword pair. SELECT name, REPEATED_CONTAINS(topping, 'P*r') AS `Powdered Sugar?` FROM dfs.`/Users/khahn/Documents/test_files_source/testRepeatedWrite.json` WHERE type='donut';