Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Impala 3.0
-
None
-
ghx-label-5
Description
Consider the description of decode() in the docs. Original text:
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.
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.
Attachments
Issue Links
- is part of
-
IMPALA-7747 Clean up the Expression Rewriter
-
- Open
-