[ https://issues.apache.org/jira/browse/ASTERIXDB-2458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16847947#comment-16847947 ]
ASF subversion and git services commented on ASTERIXDB-2458: ------------------------------------------------------------ Commit 1a565f89959ba281dc0dfd8c9664fc5a373f09ad in asterixdb's branch refs/heads/master from Ali Alsuliman [ https://gitbox.apache.org/repos/asf?p=asterixdb.git;h=1a565f8 ] [ASTERIXDB-2458][COMP] Fix InjectTypeCastForFunctionArgumentsRule - user model changes: no - storage format changes: no - interface changes: no Details: InjectTypeCastForFunctionArgumentsRule is for functions that can potentially return any of their arguments. switch and if_null(expr1, expr2, ...) are examples. All the arguments need to be casted (opened) to the type that the function will return which is the generalized type of all arguments. Some functions like if_null can determine the exact expression they will return, e.g. if_null(1, {"id": 3}) in which case the return type is always integer. The rule tries to cast th 2nd argument, the record, to integer and fails. In such cases, these functions do not need to cast their arguments. If the function determines its output type to be ANY, then all arguments need to be casted (opened). If the function determines its output to be a dervied type, then casting is also needed since that output type should be the generalized type of all arguments. Change-Id: I2fee234d883b59319e4ec4df58d61ecd498373fd Reviewed-on: https://asterix-gerrit.ics.uci.edu/3406 Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Dmitry Lychagin <dmitry.lycha...@couchbase.com> > Compilation exception when if_null(), if_missing(), if_missing_or_null() are > provided with certain kinds of arguments > --------------------------------------------------------------------------------------------------------------------- > > Key: ASTERIXDB-2458 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-2458 > Project: Apache AsterixDB > Issue Type: Bug > Components: FUN - Functions > Affects Versions: 0.9.3 > Reporter: Ali Alsuliman > Assignee: Ali Alsuliman > Priority: Major > Fix For: 0.9.4.2 > > > if_null(), if_missing(), if_missing_or_null() would throw compilation > exception for certain kinds of arguments. One example is if_null(int, > record). The cause is related to trying to cast the arguments to the type > that the function wants to return. -- This message was sent by Atlassian JIRA (v7.6.3#76005)