Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VL] add div function #5574

Open
guixiaowen opened this issue Apr 29, 2024 · 6 comments
Open

[VL] add div function #5574

guixiaowen opened this issue Apr 29, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@guixiaowen
Copy link
Contributor

guixiaowen commented Apr 29, 2024

Description

div function
expr1 div expr2 - Divide expr1 by expr2. It returns NULL if an operand is NULL or expr2 is 0. The result is casted to long.

Examples:

`
SELECT 3 div 2;
SELECT INTERVAL '1-1' YEAR TO MONTH div INTERVAL '-1' MONTH;
-13

`

In Spark, the implementation class of div is: IntegralDivide.

In 3.2.x, supports two types of div:

div(long, long) , return long result

div(decimal, decimal), return long result

After 3.3.x, add new type:

div(YearMonthIntervalType, YearMonthIntervalType), return long result

div(DayTimeIntervalType, DayTimeIntervalType), return long result

In velox, the currently supported DIV scenarios are:

divide(x, y) → double

divide(x, y) → decimal

//TODO:
To support div, add velox udf function.

divide(x, y) → long
div(long, long) , return long result
Pr:
facebookincubator/velox#9621

@guixiaowen guixiaowen added the enhancement New feature or request label Apr 29, 2024
@guixiaowen
Copy link
Contributor Author

@PHILO-HE PH hi, Can you help me check if the direction of the issuse I mentioned is correct.

@guixiaowen
Copy link
Contributor Author

@Yohahaha yo hi, Can you help me check if the direction of the issuse I mentioned is correct.

@Yohahaha
Copy link
Contributor

Yohahaha commented May 6, 2024

@Yohahaha yo hi, Can you help me check if the direction of the issuse I mentioned is correct.

yeah, IntegralDivide for Long type is missed, you can verify it with an UT.

@guixiaowen
Copy link
Contributor Author

@Yohahaha yo hi, Can you help me check if the direction of the issuse I mentioned is correct.

yeah, IntegralDivide for Long type is missed, you can verify it with an UT.

@Yohahaha 3q.

@PHILO-HE
Copy link
Contributor

PHILO-HE commented May 6, 2024

@guixiaowen, the proposal looks good! Just left some comments on the velox PR. Thanks!

@guixiaowen
Copy link
Contributor Author

@guixiaowen, the proposal looks good! Just left some comments on the velox PR. Thanks!

OK. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants