Clone
Ali Alsuliman <ali.al.solaiman@gmail.com>
committed
on 24 May
[ASTERIXDB-2458][COMP] Fix InjectTypeCastForFunctionArgumentsRule
- user model changes: no
- storage format changes: no
- interface changes:… Show more
[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 <jenkins@fulliautomatix.ics.uci.edu>

Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>

Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>

Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>

Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>

Show less