databend icon indicating copy to clipboard operation
databend copied to clipboard

Migrate control-flow functions to new expression framework

Open andylokandy opened this issue 3 years ago • 2 comments

Tasks

  • [x] multi_if https://github.com/datafuselabs/databend/pull/6832
  • [ ] is_null
  • [ ] is_not_null
  • [ ] ~~in~~

andylokandy avatar Jul 26 '22 16:07 andylokandy

@sundy-li Currently, function in has signature in(<input>, list_0, list_1, ....). Can we change it to array_contains(T, Array(T))? Therefore, a IN (1, 2, 3) will be desugured into array_contains(a, array_construct(1, 2, 3)).

andylokandy avatar Jul 26 '22 16:07 andylokandy

@sundy-li Currently, function in has signature in(<input>, list_0, list_1, ....). Can we change it to array_contains(T, Array(T))? Therefore, a IN (1, 2, 3) will be desugured into array_contains(a, array_construct(1, 2, 3)).

Yes, we can do it in type_checker.

sundy-li avatar Jul 26 '22 23:07 sundy-li

I am now trying to implement IS_NULL and IS_NOT_null and I want to know how to generate the file:

https://github.com/datafuselabs/databend/blob/42de73d733c05573815c8c8ada7c3c6fa9d43226/src/query/functions-v2/tests/it/scalars/testdata/control.txt

@sundy-li @andylokandy

JasonLi-cn avatar Aug 24 '22 12:08 JasonLi-cn

See the comments in: https://github.com/datafuselabs/databend/blob/fc868936df12e06f5c907c335ac813e950c3eb8b/src/query/functions-v2/tests/it/main.rs

sundy-li avatar Aug 24 '22 13:08 sundy-li

See the comments in: https://github.com/datafuselabs/databend/blob/fc868936df12e06f5c907c335ac813e950c3eb8b/src/query/functions-v2/tests/it/main.rs

thanks!

JasonLi-cn avatar Aug 24 '22 15:08 JasonLi-cn