Add support for function mod#2402
Add support for function mod#2402ti-srebot merged 36 commits intopingcap:masterfrom riteme:function-mod
mod#2402Conversation
modmod
modmod
|
/run-all-tests |
|
/run-all-tests |
modmod
|
/run-all-tests |
| } | ||
| else | ||
| { | ||
| return static_cast<Result>(a) % static_cast<Result>(b); |
There was a problem hiding this comment.
When both A and B are not decimal, the Result shouldn't be decimal. Suggest only leaving a static_assert(!IsDecimal<Result>) here.
| } | ||
| else // both A and B are integrals. | ||
| { | ||
| using UnsignedResultType = std::make_unsigned_t<Result>; |
There was a problem hiding this comment.
suggest using tics version of make_unsigned_t and is_signed_v.
| x = static_cast<UnsignedResultType>(a); | ||
|
|
||
| if (std::is_signed_v<B> && b < 0) | ||
| y = static_cast<UnsignedResultType>(-b); |
|
/run-all-tests |
|
/run-all-tests |
dbms/src/DataTypes/NumberTraits.h
Outdated
| * TODO: | ||
| * * add 128-bit and 256-bit integers. | ||
| * * change Float32 to Float64. | ||
| * * all floating-point arithmetics should evaluate to Float64. |
There was a problem hiding this comment.
| * * all floating-point arithmetics should evaluate to Float64. | |
| * * all floating-point arithmetics should be evaluated to Float64. |
There was a problem hiding this comment.
Past tense may not be needed. Here are some examples: https://linggle.com/?q=evaluate+to
There was a problem hiding this comment.
Guess they have different subjects. Anyway either style is okay.
| auto & a_nullmap_data = a_nullmap->getData(); | ||
| auto & b_nullmap_data = b_nullmap->getData(); | ||
| for (size_t i = 0; i < size; ++i) | ||
| res_null[i] = a_nullmap_data[i] || b_nullmap_data[i]; |
There was a problem hiding this comment.
https://godbolt.org/z/Kj7chc3xo seems | can generate simpler code than ||.
Anyway I found compiler won't automatically vectorize this for-loop.
| } | ||
| else if constexpr (is_modulo) | ||
| { | ||
| if (scale_a != 1) |
There was a problem hiding this comment.
Got it, so would you like to paste your explanation into the code?
Co-authored-by: Fu Zhe <fuzhe1989@gmail.com>
Co-authored-by: Fu Zhe <fuzhe1989@gmail.com>
|
/run-all-tests |
|
@fuzhe1989, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: tiflash(slack). |
|
/merge |
|
/run-all-tests |
|
/run-cherry-picker |
|
cherry pick to release-5.1 in PR #2560 |
|
cherry pick to release-5.0 in PR #2561 |
What problem does this PR solve?
Issue Number: close #2318
Problem Summary: enable pushing function
moddown to TiFlash.What is changed and how it works?
Proposal:
What's Changed:
Decimal.h: compatible with TiDB.DataTypeDecimal.h: add a helper function to get decimal precision in unit test.DAGUtils.cpp: add mappings from TiPB codes to scalar function name.FunctionArithmetic.h: update implementation ofFunctionModulo.NumberTraits.h: fix modulo result type deduction.types.h: addactual_type, which returns correct size of boost multiprecision integer.mod.test,mod_extra.test: the integration test.gtest_arithmetic_functions.cpp: the unit test.Related changes
pingcap/docs/pingcap/docs-cn:Check List
INF,NaNTests
Release note
MOD(N, M)to TiFlash.