Open mbasmanova opened 2 years ago
The evaluated expression is in(-40, reverse(ARRAY [...]))
. The common evaluation path constant-folds the second sub-expression such that when in
is evaluated, InPredicate::create() sees the second argument being a constant. On the other hand, the simplified evaluation path does not do constant-folding, so InPredicate::create() sees the second argument being an expression. But it requires the second argument being a constant and hence throws.
I feel both behaviors are expected respectively.
@oerling is going to enable constant-folding in simplified path as well. This change will make the two paths behave the same.
@kagamiori @oerling Is there an ETA for the fix?
Looking at this, actually the current VELOX implementation of in as function is not accurate.
Velox support select 1 in array(1,2,3) and select 1 in reverse(1,2,3) which are not supported in prestoSQL. I tried the following in presto and they are not allowed:
select 1 in Array[1,2,3] select 1 in reverse(array(1,2,3))
I propose that we right IN as special form that have constant list of literals.
Repro files:
in.tar.gz