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

Support multiplication on ANSI interval types #5105

Merged
merged 10 commits into from
Apr 14, 2022

Conversation

res-life
Copy link
Collaborator

@res-life res-life commented Mar 31, 2022

Contributes #4151

Supports

  • Year-month interval * (byte, short, int, long, float, double)
  • Day-time interval * (byte, short, int, long, float, double)

Note: not support decimal type because of CUDF Decimal128 does not handle overflow, like:

CUDF positive decimal * positive decimal can generate negative value.
val d1 = ColumnVector.fromDecimals(new java.math.BigDecimal("123456789012345678901234567890123456.11"))
val d2 = Scalar.fromDecimal(new java.math.BigDecimal("12345678901234567890123456789012345611"))
val r = d1.mul(d2)
println(r)

123456789012345678901234567890123456.11 * 12345678901234567890123456789012345611 = -1053265448675579329726886670761974900.55

Signed-off-by: Chong Gao res_life@163.com

Signed-off-by: Chong Gao <res_life@163.com>
@res-life
Copy link
Collaborator Author

build

@res-life
Copy link
Collaborator Author

build


longResult.incRefCount()
}
case _: FloatType => // num is float
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try

case FloatType | DoubleType => interval.mul(numOperable, DType.FLOAT64)

instead of separating the float and double ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* if(x == Long.MIN_VALUE && y == -1) throw exception
*
* @param x long cv or scalar
* @param y long cv or scalar, will not be scalar if x is scalar
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

y is declared to be a column vector in the below function, can not be a scalar.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comments.

* @param y long cv or scalar, will not be scalar if x is scalar
* @param r is the result of x * y
*/
def checkMultiplyOverflowSimpleImp(x: BinaryOperable, y: ColumnVector,
Copy link
Collaborator

@firestarman firestarman Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The postfix Imp, personally , is not suitable here. Usually it is used in a class declaration for implementing an interface, or a concrete method declaration implementing an abstract method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@sameerz sameerz added the audit_3.3.0 Audit related tasks for 3.3.0 label Apr 1, 2022
@sameerz sameerz added this to the Apr 4 - Apr 15 milestone Apr 1, 2022
@res-life
Copy link
Collaborator Author

Waiting #5150 to merge, has some conflict on Spark33XShims.

Chong Gao added 2 commits April 11, 2022 18:09
Signed-off-by: Chong Gao <res_life@163.com>
@res-life res-life marked this pull request as draft April 11, 2022 12:51
@res-life
Copy link
Collaborator Author

build

@res-life
Copy link
Collaborator Author

build

1 similar comment
@res-life
Copy link
Collaborator Author

build

@res-life res-life marked this pull request as ready for review April 12, 2022 06:54
@res-life res-life requested a review from jlowe April 12, 2022 07:56
@res-life
Copy link
Collaborator Author

build

@res-life
Copy link
Collaborator Author

build

@res-life
Copy link
Collaborator Author

build

@res-life
Copy link
Collaborator Author

build

Copy link
Collaborator

@firestarman firestarman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@res-life res-life requested a review from jlowe April 13, 2022 11:54
@res-life res-life merged commit 6c27068 into NVIDIA:branch-22.06 Apr 14, 2022
@res-life res-life deleted the interval-multiply branch April 14, 2022 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit_3.3.0 Audit related tasks for 3.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants