velox icon indicating copy to clipboard operation
velox copied to clipboard

Add Presto functions

Open mbasmanova opened this issue 2 years ago • 48 comments

Velox includes many of the PrestoSQL functions, but a few are still missing. It would great to add these.

Function coverage map: https://facebookincubator.github.io/velox/functions/coverage.html

A subset of missing functions that would be most helpful to add.

Array functions

all_match (lambda function) https://github.com/facebookincubator/velox/pull/3356 any_match (lambda function) array_average #2434 array_frequency #3807 array_has_duplicates #3320 array_normalize array_remove array_union flatten repeat sequence shuffle #3404 zip_with (lambda function) #2685

Map functions

map_from_entries #3417 map_normalize map_zip_with (lambda function) #2711

JSON functions

is_json_scalar https://github.com/facebookincubator/velox/pull/2291 json_array_contains https://github.com/facebookincubator/velox/pull/2299 json_array_get json_array_length https://github.com/facebookincubator/velox/pull/2294 json_extract json_format #3525 json_parse #3663 json_size

String functions

split_to_map split_to_multimap strrpos

Regular expression functions

regexp_split

Date and Time functions

timezone_hour timezone_minute week https://github.com/facebookincubator/velox/pull/2287 week_of_year https://github.com/facebookincubator/velox/pull/2287

Mathematical functions

truncate

mbasmanova avatar Aug 11 '22 10:08 mbasmanova

CC: @majetideepak @aditi-pandit

mbasmanova avatar Aug 11 '22 10:08 mbasmanova

Thanks for sharing the list of missing functions. Following functions have been added: Date and Time functions week, week_of_year: https://github.com/facebookincubator/velox/pull/2287

JSON functions is_json_scalar: https://github.com/facebookincubator/velox/pull/2291 json_array_length: https://github.com/facebookincubator/velox/pull/2294 json_array_contains: https://github.com/facebookincubator/velox/pull/2299

Working on the following functions: Mathematical functions truncate (shelved till decimal to double cast is supported)

JSON functions json_array_get (Not implementing because the usage of this function is not recommended)

pramodsatya avatar Aug 15 '22 20:08 pramodsatya

I am going to start working on array_union.

jwyles-ahana avatar Aug 23 '22 16:08 jwyles-ahana

I am going to start working on array_union.

There was a prior PR for array_union https://github.com/facebookincubator/velox/pull/867 that was abandoned. Maybe you can check with @kagamiori about it.

aditi-pandit avatar Aug 23 '22 18:08 aditi-pandit

I am going to start working on array_union.

There was a prior PR for array_union #867 that was abandoned. Maybe you can check with @kagamiori about it.

@aditi-pandit Thank you for bringing up this! It was a PR I didn't finish. I originally planned to rewrite it as a simple function once it's supported. (I just confirmed that it's not supported yet currently.) Do you need this function soon? Please feel free to take it over, or let me know if you want me to finish #867.

kagamiori avatar Aug 23 '22 19:08 kagamiori

There isn't an urgency for the array_union function rightaway. We were just picking stuff from Masha's list above.

aditi-pandit avatar Aug 23 '22 20:08 aditi-pandit

I will leave array_union to @kagamiori and instead start on array_average instead.

jwyles-ahana avatar Aug 23 '22 20:08 jwyles-ahana

Thanks for sharing the list of missing functions. Following functions have been added: Date and Time functions week, week_of_year: #2287

JSON functions is_json_scalar: #2291 json_array_length: #2294 json_array_contains: #2299

Working on the following functions: Mathematical functions truncate (shelved till decimal to double cast is supported)

JSON functions json_array_get (Not implementing because the usage of this function is not recommended)

Hi @pramodsatya!

Looking for functions to pick up. Wondering if you are still working on truncate?

Cheers, Gosh

gosharz avatar Oct 17 '22 03:10 gosharz

Hi @gosharz, I am not working on truncate function. Thanks for checking.

pramodsatya avatar Oct 17 '22 03:10 pramodsatya

@pramodsatya mind if I pick it up?

gosharz avatar Oct 17 '22 03:10 gosharz

No, please go for it. Thank you!

@pramodsatya mind if I pick it up?

pramodsatya avatar Oct 17 '22 03:10 pramodsatya

Adding truncate: https://github.com/facebookincubator/velox/pull/2862

gosharz avatar Oct 17 '22 16:10 gosharz

Will also give a try to strrpos if nobody minds :)

gosharz avatar Oct 20 '22 01:10 gosharz

Here we go: https://github.com/facebookincubator/velox/pull/2903

gosharz avatar Oct 20 '22 15:10 gosharz

Hi @mbasmanova,

I'd like to claim this array function first: array_has_duplicates: #3397

darrenfu avatar Dec 01 '22 23:12 darrenfu

Hi @mbasmanova,

I'd like to claim this array function first: array_has_duplicates: #3397

Looks like there is a duplicate WIP PR on the same udf, array_has_duplicates: #3320

I switched to shuffle: #3404 (ready for review)

darrenfu avatar Dec 02 '22 19:12 darrenfu

Hello @mbasmanova,

I'm claiming functions: timezone_hour timezone_minute current_date current_time

czentgr avatar Mar 17 '23 18:03 czentgr

Hi @mbasmanova I'm claiming any_match (lambda function). I am working on all_match (lambda function) https://github.com/facebookincubator/velox/pull/3356, and will continue to work on any_match #4327 once #3356 is merged.

duanmeng avatar Mar 18 '23 06:03 duanmeng

@duanmeng

I'm claiming any_match (lambda function).

Sounds great.

mbasmanova avatar Mar 20 '23 14:03 mbasmanova

Hi @mbasmanova, I would like to claim the json_parse function.

svm1 avatar Apr 18 '23 03:04 svm1

@svm1 Looks like json_parse was added in #3663

mbasmanova avatar Apr 18 '23 15:04 mbasmanova

Thanks @mbasmanova, must've missed that. Then may I claim theflatten array function? Doesn't look like it's been added yet.

svm1 avatar Apr 18 '23 19:04 svm1

Hi @mbasmanova, I would actually like to take the split_to_map string function first instead if that's alright.

svm1 avatar Apr 19 '23 01:04 svm1

Hi @mbasmanova, I would actually like to take the split_to_map string function first instead if that's alright.

That's fine. Thanks.

mbasmanova avatar Apr 19 '23 04:04 mbasmanova

Hi @mbasmanova, I would also like to claim the following functions:

from_iso8601_date
from_iso8601_timestamp
current_timezone

svm1 avatar Apr 19 '23 23:04 svm1

hello all , seems like a lot has been done !. Is there anything that I could be able to work on ? , I am a newbie to opensource , but I believe I have good skills in C++ , C , Python and such , I hope @mbasmanova or someone would be able to help me soon , cheers!

SANTHOSH-MAMIDISETTI avatar May 13 '23 16:05 SANTHOSH-MAMIDISETTI

I want to join this interesting work, My code analysis about Velox compilation execution: Velox--compile, @mbasmanova I'm claiming array_remove

dusx1981 avatar Jul 25 '23 09:07 dusx1981

@dusx1981 Welcome. FYI, someone might be already working on array_remove: https://github.com/facebookincubator/velox/pull/5538

mbasmanova avatar Jul 25 '23 10:07 mbasmanova

@SANTHOSH-MAMIDISETTI @dusx1981 Welcome, folks. Would you provide some context re: your interest in Velox. Are you part of the teams that use Velox? If so, what are these team do?

mbasmanova avatar Jul 25 '23 10:07 mbasmanova

@SANTHOSH-MAMIDISETTI @dusx1981 Welcome, folks. Would you provide some context re: your interest in Velox. Are you part of the teams that use Velox? If so, what are these team do?

We are working on a distributed database, and we need to use things like ICompiledCall.

dusx1981 avatar Jul 26 '23 01:07 dusx1981