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

quick fix for decimal encode #210

Merged
merged 3 commits into from
Aug 30, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dbms/src/Storages/Transaction/Codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,13 @@ void EncodeDecimalImpl(const T & dec, PrecType prec, ScaleType frac, std::string
{
static_assert(IsDecimal<T>);

// todo this is a work around, this fix only makes the encoded value as a valid value, the encoded prec
zanmato1984 marked this conversation as resolved.
Show resolved Hide resolved
// and scale is not the same as TiDB request, but luckily TiDB can handle this when reading from dag
// response. In order to encoding the decimal with the type requested by TiDB, TiFlash should get the
// prec and scale from column
if (prec < frac) {
zanmato1984 marked this conversation as resolved.
Show resolved Hide resolved
prec = frac;
}
constexpr Int32 decimal_mod = powers10[digitsPerWord];
ss << UInt8(prec) << UInt8(frac);

Expand Down