[
https://issues.apache.org/jira/browse/TAJO-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13966730#comment-13966730
]
hyoungjunkim commented on TAJO-746:
-----------------------------------
COALESCE function has a variable-length argument. So I implemented some
features for a variable-length argument in CatalogUtil.
In order to use a variable-length argument, Declare as an array.
{code}
@Description(
functionName = "coalesce",
description = "Returns the first of its arguments that is not null.",
detail = "Like a CASE expression, COALESCE only evaluates the arguments
that are needed to determine the result; " +
"that is, arguments to the right of the first non-null argument are not
evaluated",
example = "> SELECT coalesce(null, null, 10);\n"
+ "10",
returnType = TajoDataTypes.Type.INT8,
paramTypes = {@ParamTypes(paramTypes = {TajoDataTypes.Type.INT8,
TajoDataTypes.Type.INT8_ARRAY})}
)
public class CoalesceLong extends Coalesce {
}
{code}
I attached the patch for this issue. please review this patch.
https://reviews.apache.org/r/20264/
> Implements function COALESCE
> ----------------------------
>
> Key: TAJO-746
> URL: https://issues.apache.org/jira/browse/TAJO-746
> Project: Tajo
> Issue Type: New Feature
> Reporter: hyoungjunkim
> Assignee: hyoungjunkim
> Attachments: TAJO-746.patch
>
>
> See title.
> The next description is from the postgresql
> document(http://www.postgresql.org/docs/9.1/static/functions-conditional.html).
>
> {noformat}
> COALESCE(value [, ...])
> {noformat}
> The COALESCE function returns the first of its arguments that is not null.
> Null is returned only if all arguments are null. It is often used to
> substitute a default value for null values when data is retrieved for
> display, for example:
> {code:sql}
> SELECT COALESCE(description, short_description, '(none)') ...
> {code}
> Like a CASE expression, COALESCE only evaluates the arguments that are needed
> to determine the result; that is, arguments to the right of the first
> non-null argument are not evaluated. This SQL-standard function provides
> capabilities similar to NVL and IFNULL, which are used in some other database
> systems.
--
This message was sent by Atlassian JIRA
(v6.2#6252)