You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-641 1. Add support for int128_t in ParsedColumnFilter.
2. Set Decimal precision in SimpleColumn::evaluate(). 3. Add support for int128_t in ConstantColumn. 4. Set IDB_Decimal::s128Value in buildDecimalColumn(). 5. Use width 16 as first if predicate for branching based on decimal width.
This commit is contained in:
committed by
Roman Nozdrin
parent
0bd172cd6e
commit
74b64eb4f1
@ -729,5 +729,67 @@ TEST(DataConvertTest, DecimalToStringCheckScale38)
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
}
|
||||
|
||||
TEST(DataConvertTest, ConvertColumnData) {
|
||||
TEST(DataConvertTest, DecimalToStringCheckScale37)
|
||||
{
|
||||
CalpontSystemCatalog::ColType ct;
|
||||
ct.colDataType = CalpontSystemCatalog::DECIMAL;
|
||||
char buf[42];
|
||||
string expected;
|
||||
ct.precision = 38;
|
||||
ct.scale = 37;
|
||||
int128_t res;
|
||||
|
||||
// test simple values
|
||||
res = 0;
|
||||
expected = "0.0000000000000000000000000000000000000";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
res = 2;
|
||||
expected = "0.0000000000000000000000000000000000002";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
res = -2;
|
||||
expected = "-0.0000000000000000000000000000000000002";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
res = 123;
|
||||
expected = "0.0000000000000000000000000000000000123";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
res = -123;
|
||||
expected = "-0.0000000000000000000000000000000000123";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
res = ((((((int128_t)1234567890 * 10000000000) + 1234567890) * 10000000000) + 1234567890) * 100000000 ) + 12345678;
|
||||
expected = "1.2345678901234567890123456789012345678";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
res = -res;
|
||||
expected = "-1.2345678901234567890123456789012345678";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
|
||||
// test max/min decimal (i.e. 38 9's)
|
||||
res = ((((((((int128_t)999999999 * 1000000000) + 999999999) * 1000000000) + 999999999) * 1000000000 ) + 999999999) * 100) + 99;
|
||||
expected = "9.9999999999999999999999999999999999999";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
res = -res;
|
||||
expected = "-9.9999999999999999999999999999999999999";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
|
||||
// test trailing zeros
|
||||
res = 123000;
|
||||
expected = "0.0000000000000000000000000000000123000";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
res = -res;
|
||||
expected = "-0.0000000000000000000000000000000123000";
|
||||
DataConvert::decimalToString(&res, ct.scale, buf, 42, ct.colDataType);
|
||||
EXPECT_EQ(string(buf), expected);
|
||||
}
|
||||
|
||||
TEST(DataConvertTest, ConvertColumnData)
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user