Repository: orc Updated Branches: refs/heads/master b1ea896c0 -> 8a845e24c
ORC-272. Minor porting changes. Includes: * fix the return type pf fls() prototype. * alignment of arguments types for std::min * use LL suffix for int64 constants (or explicit cast) * Use heap to store big array. * use std::numeric_limits<float>::max() for FLT_MAX * fix signedness conversion warning * sort headers. * use rowCount for vector size Fixes #198 Signed-off-by: Owen O'Malley <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/orc/repo Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/8a845e24 Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/8a845e24 Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/8a845e24 Branch: refs/heads/master Commit: 8a845e24ca12aa401182bce7508e7c6f1397381e Parents: b1ea896 Author: rip-nsk <[email protected]> Authored: Tue Dec 5 15:35:48 2017 -0800 Committer: Owen O'Malley <[email protected]> Committed: Tue Dec 19 11:59:47 2017 -0800 ---------------------------------------------------------------------- c++/src/Int128.cc | 5 +++-- c++/test/TestColumnReader.cc | 4 +++- c++/test/TestInt128.cc | 4 ++-- c++/test/TestRle.cc | 2 +- c++/test/TestWriter.cc | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/orc/blob/8a845e24/c++/src/Int128.cc ---------------------------------------------------------------------- diff --git a/c++/src/Int128.cc b/c++/src/Int128.cc index b289a48..433e6fa 100644 --- a/c++/src/Int128.cc +++ b/c++/src/Int128.cc @@ -19,6 +19,7 @@ #include "orc/Int128.hh" #include "Adaptor.hh" +#include <algorithm> #include <iomanip> #include <iostream> #include <sstream> @@ -41,7 +42,7 @@ namespace orc { bool isNegative = str[0] == '-'; size_t posn = isNegative ? 1 : 0; while (posn < length) { - size_t group = std::min(18ul, length - posn); + size_t group = std::min(static_cast<size_t>(18), length - posn); int64_t chunk = std::stoll(str.substr(posn, group)); int64_t multiple = 1; for(size_t i=0; i < group; ++i) { @@ -59,7 +60,7 @@ namespace orc { Int128& Int128::operator*=(const Int128 &right) { const uint64_t INT_MASK = 0xffffffff; - const uint64_t CARRY_BIT = 1l << 32; + const uint64_t CARRY_BIT = INT_MASK + 1; // Break the left and right numbers into 32 bit chunks // so that we can multiply them without overflow. http://git-wip-us.apache.org/repos/asf/orc/blob/8a845e24/c++/test/TestColumnReader.cc ---------------------------------------------------------------------- diff --git a/c++/test/TestColumnReader.cc b/c++/test/TestColumnReader.cc index 58d9871..6278623 100644 --- a/c++/test/TestColumnReader.cc +++ b/c++/test/TestColumnReader.cc @@ -2347,7 +2347,9 @@ TEST(TestColumnReader, testFloatWithNulls) { std::numeric_limits<float>::infinity(), std::numeric_limits<float>::quiet_NaN(), -std::numeric_limits<float>::infinity(), - 3.4028235E38f, -3.4028235E38f, 1.4e-45f, -1.4e-45f }; + std::numeric_limits<float>::max(), + -std::numeric_limits<float>::max(), + 1.4e-45f, -1.4e-45f }; const unsigned char buffer2[] = { 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x20, 0x40, 0x00, 0x40, 0xc8, 0xc2, http://git-wip-us.apache.org/repos/asf/orc/blob/8a845e24/c++/test/TestInt128.cc ---------------------------------------------------------------------- diff --git a/c++/test/TestInt128.cc b/c++/test/TestInt128.cc index 6a0f247..f61f772 100644 --- a/c++/test/TestInt128.cc +++ b/c++/test/TestInt128.cc @@ -260,7 +260,7 @@ namespace orc { x *= 6432346; EXPECT_EQ(6432346 * 5, x.toLong()); - x = (1L << 62) + (3L << 34) + 3L; + x = (1LL << 62) + (3LL << 34) + 3LL; x *= 96; EXPECT_EQ("0x00000000000000180000048000000120", x.toHexString()); @@ -317,7 +317,7 @@ namespace orc { EXPECT_EQ(0x9abcdef0, array[2]); } - int fls(uint32_t x); + int64_t fls(uint32_t x); TEST(Int128, testFindLastSet) { EXPECT_EQ(0, fls(0)); http://git-wip-us.apache.org/repos/asf/orc/blob/8a845e24/c++/test/TestRle.cc ---------------------------------------------------------------------- diff --git a/c++/test/TestRle.cc b/c++/test/TestRle.cc index 6feda3c..9f192ac 100644 --- a/c++/test/TestRle.cc +++ b/c++/test/TestRle.cc @@ -224,7 +224,7 @@ TEST(RLEv2, multiByteShortRepeats) { std::vector<int64_t> values; for (size_t i = 0; i < nVals; ++i) { for (size_t j = 0; j < runLength; ++j) { - values.push_back(static_cast<int64_t>(i)+(1L<<62)); + values.push_back(static_cast<int64_t>(i) + (1LL << 62)); } } http://git-wip-us.apache.org/repos/asf/orc/blob/8a845e24/c++/test/TestWriter.cc ---------------------------------------------------------------------- diff --git a/c++/test/TestWriter.cc b/c++/test/TestWriter.cc index c612e3c..4e6dbf0 100644 --- a/c++/test/TestWriter.cc +++ b/c++/test/TestWriter.cc @@ -296,7 +296,7 @@ namespace orc { uint64_t compressionBlockSize = 1024; uint64_t rowCount = 655350; - double data[655350]; + std::vector<double> data(rowCount); for (uint64_t i = 0; i < rowCount; ++i) { data[i] = 100000 * (std::rand() * 1.0 / RAND_MAX); }
