phoenix-dev mailing list archives

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

     [ https://issues.apache.org/jira/browse/PHOENIX-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

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

There are several questions.

{quote}
in ArrayAppendFunction.evaluate(), move this code up front, as there's no reason to do any
work if these are the case:
{quote}
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?


{quote}
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.
{quote}
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.
{code}
rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(integers,ROUND(23.4)) FROM regions
WHERE region_name = 'SF Bay Area'");
{code}


{quote}
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.
{quote}
Here there is an explicit coerceBytes call in evaluate method.
{code}
+        baseType.coerceBytes(ptr, elementDataType, elementExpr.getSortOrder(), arrayExpr.getSortOrder(),
getMaxLength());
{code}
 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?
{code}
rs = conn.createStatement().executeQuery("SELECT ARRAY_APPEND(doubles,23) FROM regions WHERE
region_name = 'SF Bay Area'");
{code}



> implement ARRAY_APPEND built in function
> ----------------------------------------
>
>                 Key: PHOENIX-1705
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1705
>             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
(v6.3.4#6332)

Mime
View raw message