asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xikui Wang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ASTERIXDB-1901) UDF fails at constant parameter
Date Sat, 06 May 2017 22:31:04 GMT

    [ https://issues.apache.org/jira/browse/ASTERIXDB-1901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15999614#comment-15999614
] 

Xikui Wang commented on ASTERIXDB-1901:
---------------------------------------

[~buyingyi] During the function evaluation, JavaFunctionHelper will assign the input value
to an arguments list for external UDF evaluation. The defined type is used as the expected
type for the arguments (org/apache/asterix/external/library/JavaFunctionHelper.java:113).
I think the ConstantFoldingRule triggers the evaluation. Here are the logical plan before
logical rewrite, the queries used in both cases are updated in the description:

{noformat}
-- Exception case before Logical Rewrite
distribute result [%0->$$0] -- |UNPARTITIONED|
  project ([$$0]) -- |UNPARTITIONED|
    assign [$$0] <- [function-call: externallibtest:testlib#toUpper, Args:[function-call:
asterix:open-object-constructor, Args:[AString: {id}, AInt64: {1}, AString: {text}, AString:
{lower text}]]] -- |UNPARTITIONED|
      empty-tuple-source -- |UNPARTITIONED|
      
-- Succ case before Logical Rewrite
distribute result [%0->$$2] -- |UNPARTITIONED|
  project ([$$2]) -- |UNPARTITIONED|
    assign [$$2] <- [function-call: externallibtest:testlib#toUpper, Args:[%0->$$0]]
-- |UNPARTITIONED|
      assign [$$0] <- [function-call: asterix:open-object-constructor, Args:[AString: {id},
AInt64: {1}, AString: {text}, AString: {lower text}]] -- |UNPARTITIONED|
        empty-tuple-source -- |UNPARTITIONED|

{noformat} 

> UDF fails at constant parameter
> -------------------------------
>
>                 Key: ASTERIXDB-1901
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1901
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Xikui Wang
>            Assignee: Xikui Wang
>
> If the declared datatype for UDF input is a open type, UDF will fail when given constant
record (which has a closed datatype implicitly)
> Execute following query with default lib installed can reproduce this issue:
> {noformat}
> drop dataverse externallibtest if exists;
> create dataverse externallibtest;
> use dataverse externallibtest;
> create type TextType if not exists as open {
>     id: int32,
>     text: string
> };
> testlib#toUpper({"id":1, "text":"lower text"})
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message