[
https://issues.apache.org/jira/browse/ASTERIXDB-2447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16599241#comment-16599241
]
ASF subversion and git services commented on ASTERIXDB-2447:
------------------------------------------------------------
Commit 8c88975a781cd2b384da31bcd59aad2e26480e3e in asterixdb's branch
refs/heads/master from [~dlychagin-cb]
[ https://git-wip-us.apache.org/repos/asf?p=asterixdb.git;h=8c88975 ]
[ASTERIXDB-2447][COMP] Parameter rewriting for if_missing, if_null functions
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Introduce cast operation for parameters of if_missing, if_null functions
(as performed for parameters of the switch_case function)
- Fix union type handling in TypeResolverUtil.generalizeTypes()
Change-Id: I768d8236f5b0ccb9a850304ffedd3686d911702d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2935
Tested-by: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Reviewed-by: Till Westmann <[email protected]>
> Incorrect handling of non-primitive arguments by if_missing, if_null functions
> ------------------------------------------------------------------------------
>
> Key: ASTERIXDB-2447
> URL: https://issues.apache.org/jira/browse/ASTERIXDB-2447
> Project: Apache AsterixDB
> Issue Type: Bug
> Components: COMP - Compiler
> Reporter: Dmitry Lychagin
> Assignee: Dmitry Lychagin
> Priority: Minor
>
> if_missing, if_null functions return one of the arguments. When input values
> are of different non-primitive types then the output type is computed as
> 'any', but the argument is returned as is at runtime (without casting). This
> may cause problems for consumers of the returned values.
> For example:
> { "j": (
> let v = if_null(
> case when get_year(current_datetime()) > 0 then null else false end,
> \{ "c": [ 2 ] }
> )
> select v as b
> ) }
> currently returns
> { "j": [ \{ "b": { } } ] }
> but it should return:
> { "j": [ \{ "b": { "c": [ 2 ] } } ] }
> Parameters of these functions should be rewritten by the optimizer in the
> same manner as parameters of the switch-case function
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)