Paul Rogers created IMPALA-7739:
-----------------------------------
Summary: Errata in documentation of decode() method
Key: IMPALA-7739
URL: https://issues.apache.org/jira/browse/IMPALA-7739
Project: IMPALA
Issue Type: Improvement
Components: Docs
Affects Versions: Impala 3.0
Reporter: Paul Rogers
Consider the description of {{decode()}} in [the
docs|https://impala.apache.org/docs/build3x/html/topics/impala_conditional_functions.html].
Original text:
{quote}
decode(type expression, type search1, type result1 [, type search2, type
result2 ...] [, type default] )
Purpose: Compares an expression to one or more possible values, and returns a
corresponding result when a match is found.
Return type: same as the initial argument value, except that integer values are
promoted to BIGINT and floating-point values are promoted to DOUBLE; use CAST()
when inserting into a smaller numeric column
Usage notes:
* Can be used as shorthand for a CASE expression.
* The original expression and the search expressions must of the same type or
convertible types. * The result expression can be a different type, but all
result expressions must be of the same type.
* Returns a successful match If the original expression is NULL and a search
expression is also NULL. the
* Returns NULL if the final default value is omitted and none of the search
expressions match the original expression.
{quote}
Revise:
* Remove “type” prefix for arguments (here and in all functions), it really
adds no value and is actually confusing because the argument is not a type, it
is a value.
* Usage notes: Comparison is done using the IS NOT DISTINCT (<=>) operator:
this NULL can be used as a search condition.
* Since this is a list, great between the two items in the second item in usage.
* The third item has a dangling “the” at the end.
* Reword the fourth item: “If none of the search expressions match the
expression, then returns the default (if given) or NULL (if no default is
given.)”
Suggested revised text:
Purpose: Compares an expression to one or more possible values using the IS NOT
DISTINCT operator, and returns a corresponding result when a match is found.
Usage notes:
* Can be used as shorthand for a CASE expression.
* The expression and the search expressions must of the same type or
convertible types.
* The result expression can be a different type, but all result expressions
must be of the same type.
* Returns a successful match If the original expression is NULL and a search
expression is also NULL. (Uses IS NOT DISTINCT to do the comparison.)
* NULL can be used as a search expression.
* Returns NULL if the final default value is omitted and none of the search
expressions match the original expression.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]