phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dumindu Buddhika (JIRA)" <>
Subject [jira] [Updated] (PHOENIX-1705) implement ARRAY_APPEND built in function
Date Wed, 25 Mar 2015 04:11:53 GMT


Dumindu Buddhika updated PHOENIX-1705:
    Attachment: PHOENIX-1705_implement_ARRAY_APPEND_built_in_function8.patch

There are several questions.

in ArrayAppendFunction.evaluate(), move this code up front, as there's no reason to do any
work if these are the case:
If this is moved up ptr will be pointed to array rather than the element. But there are some
operations which are done using ptr to the element(such as padding, size checking, coercing).
So how do we go about that?

Also, you should be able to do a size check in the constructor as well. You'd want to make
sure that the elementDataType.getMaxLength() <= baseType.getMaxLength() and the same for
getScale(). In both cases, you'd only check this if both are non null.
here dataType.getMaxLength() needs an object passed in as an argument. if that argument is
set to null some test cases fail where input element type is decimal but needs to be casted
to be added to an integer array such as below.
rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,ROUND(23.4)) FROM regions
WHERE region_name = 'SF Bay Area'");

The if (!elementDataType.isCastableTo(baseType)) in the constructor should be if (!baseType.isCoercibleTo(elementDataType))
instead. Otherwise, the ARRAY_APPEND call should have an explicit cast.
Here there is an explicit coerceBytes call in evaluate method.
+        baseType.coerceBytes(ptr, elementDataType, elementExpr.getSortOrder(), arrayExpr.getSortOrder(),
 if (!elementDataType.isCastableTo(baseType)) is changed to (!baseType.isCoercibleTo(elementDataType))
cases like following fails where an integer added to a double array. Is this behavior expected?
rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,23) FROM regions WHERE
region_name = 'SF Bay Area'");

> implement ARRAY_APPEND built in function
> ----------------------------------------
>                 Key: PHOENIX-1705
>                 URL:
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Dumindu Buddhika
>            Assignee: Dumindu Buddhika
>         Attachments: PHOENIX-1705_implement_ARRAY_APPEND_built_in_function.patch, PHOENIX-1705_implement_ARRAY_APPEND_built_in_function.patch,
PHOENIX-1705_implement_ARRAY_APPEND_built_in_function1.patch, PHOENIX-1705_implement_ARRAY_APPEND_built_in_function2.patch,
PHOENIX-1705_implement_ARRAY_APPEND_built_in_function3.patch, PHOENIX-1705_implement_ARRAY_APPEND_built_in_function4.patch,
PHOENIX-1705_implement_ARRAY_APPEND_built_in_function5.patch, PHOENIX-1705_implement_ARRAY_APPEND_built_in_function6.patch,
PHOENIX-1705_implement_ARRAY_APPEND_built_in_function7.patch, PHOENIX-1705_implement_ARRAY_APPEND_built_in_function8.patch

This message was sent by Atlassian JIRA

View raw message