You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jr...@apache.org on 2018/01/12 09:10:14 UTC

[3/3] impala git commit: IMPALA-1767: [DOCS] Document new Boolean operators

IMPALA-1767: [DOCS] Document new Boolean operators

In a new subtopic:

IS [NOT] TRUE
IS [NOT] FALSE

Folded into IS [NOT] NULL:

IS [NOT] UNKNOWN
Change-Id: Iefebf210418ec2d47b154bd37166b76720f085bb
Reviewed-on: http://gerrit.cloudera.org:8080/8942
Reviewed-by: Vuk Ercegovac <ve...@cloudera.com>
Reviewed-by: Alex Behm <al...@cloudera.com>
Tested-by: Impala Public Jenkins


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

Branch: refs/heads/master
Commit: 5842c8406ddeed9ae51b9d976d868f49769cb788
Parents: fd5c3a7
Author: John Russell <jr...@cloudera.com>
Authored: Thu Jan 4 11:35:58 2018 -0800
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Fri Jan 12 09:04:48 2018 +0000

----------------------------------------------------------------------
 docs/impala_keydefs.ditamap                  |  3 +-
 docs/shared/impala_common.xml                |  8 ++
 docs/topics/impala_conditional_functions.xml |  8 ++
 docs/topics/impala_operators.xml             | 97 ++++++++++++++++++++++-
 4 files changed, 110 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/5842c840/docs/impala_keydefs.ditamap
----------------------------------------------------------------------
diff --git a/docs/impala_keydefs.ditamap b/docs/impala_keydefs.ditamap
index 39d65ff..3fd6c83 100644
--- a/docs/impala_keydefs.ditamap
+++ b/docs/impala_keydefs.ditamap
@@ -10532,8 +10532,7 @@ under the License.
   <keydef keys="impala13"><topicmeta><keywords><keyword>Impala 1.3</keyword></keywords></topicmeta></keydef>
 
 <!-- 3-part forms of version numbers, for use in release notes. -->
-<!-- For the 2.11.0 entry, have to space out the digits with underscores to avoid a conflict with the
-     keydef for Impala 2.1.10. -->
+<!-- Using spaced-out form to avoid conflict with variable for 2.1.10 -->
   <keydef keys="impala2_11_0"><topicmeta><keywords><keyword>Impala 2.11.0</keyword></keywords></topicmeta></keydef>
   <keydef keys="impala2100"><topicmeta><keywords><keyword>Impala 2.10.0</keyword></keywords></topicmeta></keydef>
   <keydef keys="impala290"><topicmeta><keywords><keyword>Impala 2.9.0</keyword></keywords></topicmeta></keydef>

http://git-wip-us.apache.org/repos/asf/impala/blob/5842c840/docs/shared/impala_common.xml
----------------------------------------------------------------------
diff --git a/docs/shared/impala_common.xml b/docs/shared/impala_common.xml
index c1496c6..9ada9a6 100644
--- a/docs/shared/impala_common.xml
+++ b/docs/shared/impala_common.xml
@@ -773,6 +773,14 @@ select concat('abc','mno','xyz');</codeblock>
         HBase tables.
       </p>
 
+      <p id="boolean_functions_vs_expressions" rev="2.11.0 IMPALA-1767">
+        In <keyword keyref="impala211_full"/> and higher, you can use
+        the operators <codeph>IS [NOT] TRUE</codeph> and
+        <codeph>IS [NOT] FALSE</codeph> as equivalents for the built-in
+        functions <codeph>istrue()</codeph>, <codeph>isnottrue()</codeph>,
+        <codeph>isfalse()</codeph>, and <codeph>isnotfalse()</codeph>.
+      </p>
+
       <p id="base64_charset">
         The set of characters that can be generated as output
         from <codeph>base64encode()</codeph>, or specified in

http://git-wip-us.apache.org/repos/asf/impala/blob/5842c840/docs/topics/impala_conditional_functions.xml
----------------------------------------------------------------------
diff --git a/docs/topics/impala_conditional_functions.xml b/docs/topics/impala_conditional_functions.xml
index 889294e..d110fe6 100644
--- a/docs/topics/impala_conditional_functions.xml
+++ b/docs/topics/impala_conditional_functions.xml
@@ -240,6 +240,8 @@ under the License.
           Identical to <codeph>isnottrue()</codeph>, except it returns the opposite value for a <codeph>NULL</codeph> argument.
           <p conref="../shared/impala_common.xml#common/return_type_boolean"/>
           <p conref="../shared/impala_common.xml#common/added_in_220"/>
+          <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
+          <p conref="../shared/impala_common.xml#common/boolean_functions_vs_expressions"/>
         </dd>
 
       </dlentry>
@@ -259,6 +261,8 @@ under the License.
           <p conref="../shared/impala_common.xml#common/return_type_boolean"/>
           <p conref="../shared/impala_common.xml#common/for_compatibility_only"/>
           <p conref="../shared/impala_common.xml#common/added_in_220"/>
+          <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
+          <p conref="../shared/impala_common.xml#common/boolean_functions_vs_expressions"/>
         </dd>
 
       </dlentry>
@@ -277,6 +281,8 @@ under the License.
           Identical to <codeph>isfalse()</codeph>, except it returns the opposite value for a <codeph>NULL</codeph> argument.
           <p conref="../shared/impala_common.xml#common/return_type_boolean"/>
           <p conref="../shared/impala_common.xml#common/added_in_220"/>
+          <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
+          <p conref="../shared/impala_common.xml#common/boolean_functions_vs_expressions"/>
         </dd>
 
       </dlentry>
@@ -318,6 +324,8 @@ under the License.
           <p conref="../shared/impala_common.xml#common/return_type_boolean"/>
           <p conref="../shared/impala_common.xml#common/for_compatibility_only"/>
           <p conref="../shared/impala_common.xml#common/added_in_220"/>
+          <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
+          <p conref="../shared/impala_common.xml#common/boolean_functions_vs_expressions"/>
         </dd>
 
       </dlentry>

http://git-wip-us.apache.org/repos/asf/impala/blob/5842c840/docs/topics/impala_operators.xml
----------------------------------------------------------------------
diff --git a/docs/topics/impala_operators.xml b/docs/topics/impala_operators.xml
index 126c2dc..673260e 100644
--- a/docs/topics/impala_operators.xml
+++ b/docs/topics/impala_operators.xml
@@ -1194,18 +1194,31 @@ select
 
       <p>
         <indexterm audience="hidden">IS NULL operator</indexterm>
-
         <indexterm audience="hidden">IS NOT NULL operator</indexterm>
+        <indexterm audience="hidden">IS UNKNOWN operator</indexterm>
+        <indexterm audience="hidden">IS NOT UNKNOWN operator</indexterm>
+
         The <codeph>IS NULL</codeph> operator, and its converse the <codeph>IS NOT NULL</codeph> operator, test whether a specified value is
         <codeph><xref href="impala_literals.xml#null">NULL</xref></codeph>. Because using <codeph>NULL</codeph> with any of the other
         comparison operators such as <codeph>=</codeph> or <codeph>!=</codeph> also returns <codeph>NULL</codeph> rather than
         <codeph>TRUE</codeph> or <codeph>FALSE</codeph>, you use a special-purpose comparison operator to check for this special condition.
       </p>
 
+      <p rev="2.11.0 IMPALA-1767">
+        In <keyword keyref="impala211_full"/> and higher, you can use
+        the operators <codeph>IS UNKNOWN</codeph> and
+        <codeph>IS NOT UNKNOWN</codeph> as synonyms for
+        <codeph>IS NULL</codeph> and <codeph>IS NOT NULL</codeph>,
+        respectively.
+      </p>
+
       <p conref="../shared/impala_common.xml#common/syntax_blurb"/>
 
 <codeblock><varname>expression</varname> IS NULL
 <varname>expression</varname> IS NOT NULL
+
+<ph rev="2.11.0 IMPALA-1767"><varname>expression</varname> IS UNKNOWN</ph>
+<ph rev="2.11.0 IMPALA-1767"><varname>expression</varname> IS NOT UNKNOWN</ph>
 </codeblock>
 
       <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
@@ -1231,9 +1244,10 @@ select
       <p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
 
       <p rev="2.3.0">
-        This operator is not applicable to complex type columns (<codeph>STRUCT</codeph>,
-        <codeph>ARRAY</codeph>, or <codeph>MAP</codeph>). Using a complex type column
-        with <codeph>IS NULL</codeph> or <codeph>IS NOT NULL</codeph> causes a query error.
+        The <codeph>IS [NOT] UNKNOWN</codeph> operator, as with the <codeph>IS [NOT] NULL</codeph>
+        operator, is not applicable to complex type columns (<codeph>STRUCT</codeph>,
+        <codeph>ARRAY</codeph>, or <codeph>MAP</codeph>). Using a complex type column with this
+        operator causes a query error.
       </p>
 
       <p conref="../shared/impala_common.xml#common/example_blurb"/>
@@ -1253,6 +1267,81 @@ select count(*) from web_traffic where weird_http_code is not null;</codeblock>
 
   </concept>
 
+  <concept id="is_true" rev="2.11.0 IMPALA-1767">
+
+    <title>IS TRUE Operator</title>
+
+    <conbody>
+
+      <p>
+        <indexterm audience="hidden">IS TRUE operator</indexterm>
+        <indexterm audience="hidden">IS FALSE operator</indexterm>
+        <indexterm audience="hidden">IS NOT TRUE operator</indexterm>
+        <indexterm audience="hidden">IS NOT FALSE operator</indexterm>
+        This variation of the <codeph>IS</codeph> operator tests for truth
+        or falsity, with right-hand arguments <codeph>[NOT] TRUE</codeph>,
+        <codeph>[NOT] FALSE</codeph>, and <codeph>[NOT] UNKNOWN</codeph>.
+      </p>
+
+      <p conref="../shared/impala_common.xml#common/syntax_blurb"/>
+
+<codeblock><varname>expression</varname> IS TRUE
+<varname>expression</varname> IS NOT TRUE
+
+<varname>expression</varname> IS FALSE
+<varname>expression</varname> IS NOT FALSE
+
+</codeblock>
+
+      <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
+
+      <p>
+        This <codeph>IS TRUE</codeph> and <codeph>IS FALSE</codeph> forms are
+        similar to doing equality comparisons with the Boolean values
+        <codeph>TRUE</codeph> and <codeph>FALSE</codeph>, except that
+        <codeph>IS TRUE</codeph> and <codeph>IS FALSE</codeph>
+        always return either <codeph>TRUE</codeph> or <codeph>FALSE</codeph>,
+        even if the left-hand side expression returns <codeph>NULL</codeph>
+      </p>
+
+      <p rev="2.11.0 IMPALA-1767">
+        These operators let you simplify Boolean comparisons that must also
+        check for <codeph>NULL</codeph>, for example
+        <codeph>X != 10 AND X IS NOT NULL</codeph> is equivalent to
+        <codeph>(X != 10) IS TRUE</codeph>.
+      </p>
+
+      <p conref="../shared/impala_common.xml#common/boolean_functions_vs_expressions"/>
+
+      <p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
+
+      <p rev="2.3.0">
+        The <codeph>IS [NOT] TRUE</codeph> and <codeph>IS [NOT] FALSE</codeph> operators are not
+        applicable to complex type columns (<codeph>STRUCT</codeph>, <codeph>ARRAY</codeph>, or
+        <codeph>MAP</codeph>). Using a complex type column with these operators causes a query error.
+      </p>
+
+      <p conref="../shared/impala_common.xml#common/added_in_2110"/>
+
+      <p conref="../shared/impala_common.xml#common/example_blurb"/>
+
+<codeblock>
+select assertion, b, b is true, b is false, b is unknown
+  from boolean_test;
++-------------+-------+-----------+------------+-----------+
+| assertion   | b     | istrue(b) | isfalse(b) | b is null |
++-------------+-------+-----------+------------+-----------+
+| 2 + 2 = 4   | true  | true      | false      | false     |
+| 2 + 2 = 5   | false | false     | true       | false     |
+| 1 = null    | NULL  | false     | false      | true      |
+| null = null | NULL  | false     | false      | true      |
++-------------+-------+-----------+------------+-----------+
+</codeblock>
+
+    </conbody>
+
+  </concept>
+
   <concept id="like">
 
     <title>LIKE Operator</title>