From 8c220768a9998f291d007bc26b4f4468266c9dd4 Mon Sep 17 00:00:00 2001 From: Owen O'Malley Date: Thu, 14 Dec 2017 17:03:05 -0800 Subject: [PATCH] ORC-281. Add missing override markers on destructors in InputStream.hh and OutputStream.hh Fixes #203 Signed-off-by: Owen O'Malley --- .travis.yml | 12 ++++- c++/src/ByteRLE.cc | 14 ++--- c++/src/ColumnPrinter.cc | 28 +++++----- c++/src/ColumnReader.cc | 88 +++++++++++++++---------------- c++/src/ColumnWriter.cc | 8 +-- c++/src/ColumnWriter.hh | 2 +- c++/src/Compression.cc | 24 ++++----- c++/src/MemoryPool.cc | 2 +- c++/src/OrcFile.cc | 4 +- c++/src/OrcHdfsFile.cc | 2 +- c++/src/RLEv1.hh | 2 +- c++/src/RLEv2.cc | 2 +- c++/src/Reader.cc | 2 +- c++/src/Statistics.cc | 4 +- c++/src/Statistics.hh | 26 ++++----- c++/src/StripeStream.hh | 6 +-- c++/src/Timezone.cc | 8 +-- c++/src/TypeImpl.hh | 2 +- c++/src/io/InputStream.hh | 4 +- c++/src/io/OutputStream.hh | 2 +- c++/src/wrap/gtest-wrapper.h | 2 + c++/src/wrap/orc-proto-wrapper.cc | 2 + c++/src/wrap/orc-proto-wrapper.hh | 2 + c++/test/MemoryInputStream.hh | 2 +- c++/test/MemoryOutputStream.hh | 2 +- c++/test/TestColumnReader.cc | 2 +- docker/ubuntu16-clang5/Dockerfile | 48 +++++++++++++++++ tools/src/FileMemory.cc | 2 +- tools/src/FileStatistics.cc | 2 +- tools/test/gzip.cc | 8 +-- 30 files changed, 188 insertions(+), 126 deletions(-) create mode 100644 docker/ubuntu16-clang5/Dockerfile diff --git a/.travis.yml b/.travis.yml index 7b5ddcbf6e..77d48a775a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,12 +9,21 @@ matrix: os: linux - compiler: clang os: linux + addons: + apt: + sources: + - llvm-toolchain-trusty-4.0 + packages: + - clang-4.0 + before_script: + - export CC=clang-4.0 + - export CXX=clang++-4.0 - compiler: clang os: osx osx_image: xcode6.4 - compiler: clang os: osx - osx_image: xcode8.3 + osx_image: xcode9.2 script: - mkdir build - cd build @@ -23,7 +32,6 @@ matrix: jdk: - openjdk7 -before_script: env: - MAVEN_OPTS=-Xmx2g MAVEN_SKIP_RC=true script: diff --git a/c++/src/ByteRLE.cc b/c++/src/ByteRLE.cc index d9e29fd61d..2664019f67 100644 --- a/c++/src/ByteRLE.cc +++ b/c++/src/ByteRLE.cc @@ -37,7 +37,7 @@ namespace orc { class ByteRleEncoderImpl : public ByteRleEncoder { public: ByteRleEncoderImpl(std::unique_ptr output); - virtual ~ByteRleEncoderImpl(); + virtual ~ByteRleEncoderImpl() override; /** * Encode the next batch of values @@ -212,7 +212,7 @@ namespace orc { class BooleanRleEncoderImpl : public ByteRleEncoderImpl { public: BooleanRleEncoderImpl(std::unique_ptr output); - virtual ~BooleanRleEncoderImpl(); + virtual ~BooleanRleEncoderImpl() override; /** * Encode the next batch of values @@ -369,8 +369,8 @@ namespace orc { repeating = false; remainingValues = 0; value = 0; - bufferStart = 0; - bufferEnd = 0; + bufferStart = nullptr; + bufferEnd = nullptr; } ByteRleDecoderImpl::~ByteRleDecoderImpl() { @@ -526,7 +526,7 @@ namespace orc { } if (consumed != 0) { remainingBits = 8 - consumed; - ByteRleDecoderImpl::next(&lastByte, 1, 0); + ByteRleDecoderImpl::next(&lastByte, 1, nullptr); } } @@ -537,7 +537,7 @@ namespace orc { numValues -= remainingBits; uint64_t bytesSkipped = numValues / 8; ByteRleDecoderImpl::skip(bytesSkipped); - ByteRleDecoderImpl::next(&lastByte, 1, 0); + ByteRleDecoderImpl::next(&lastByte, 1, nullptr); remainingBits = 8 - (numValues % 8); } } @@ -585,7 +585,7 @@ namespace orc { } else if (position < numValues) { // read the new bytes into the array uint64_t bytesRead = (nonNulls + 7) / 8; - ByteRleDecoderImpl::next(data + position, bytesRead, 0); + ByteRleDecoderImpl::next(data + position, bytesRead, nullptr); lastByte = data[position + bytesRead - 1]; remainingBits = bytesRead * 8 - nonNulls; // expand the array backwards so that we don't clobber the data diff --git a/c++/src/ColumnPrinter.cc b/c++/src/ColumnPrinter.cc index 2462143ed8..379ef0b32e 100644 --- a/c++/src/ColumnPrinter.cc +++ b/c++/src/ColumnPrinter.cc @@ -36,7 +36,7 @@ namespace orc { class VoidColumnPrinter: public ColumnPrinter { public: VoidColumnPrinter(std::string&); - ~VoidColumnPrinter() {} + ~VoidColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -46,7 +46,7 @@ namespace orc { const int64_t* data; public: BooleanColumnPrinter(std::string&); - ~BooleanColumnPrinter() {} + ~BooleanColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -56,7 +56,7 @@ namespace orc { const int64_t* data; public: LongColumnPrinter(std::string&); - ~LongColumnPrinter() {} + ~LongColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -68,7 +68,7 @@ namespace orc { public: DoubleColumnPrinter(std::string&, const Type& type); - virtual ~DoubleColumnPrinter() {} + virtual ~DoubleColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -80,7 +80,7 @@ namespace orc { public: TimestampColumnPrinter(std::string&); - ~TimestampColumnPrinter() {} + ~TimestampColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -91,7 +91,7 @@ namespace orc { public: DateColumnPrinter(std::string&); - ~DateColumnPrinter() {} + ~DateColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -102,7 +102,7 @@ namespace orc { int32_t scale; public: Decimal64ColumnPrinter(std::string&); - ~Decimal64ColumnPrinter() {} + ~Decimal64ColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -113,7 +113,7 @@ namespace orc { int32_t scale; public: Decimal128ColumnPrinter(std::string&); - ~Decimal128ColumnPrinter() {} + ~Decimal128ColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -124,7 +124,7 @@ namespace orc { const int64_t* length; public: StringColumnPrinter(std::string&); - virtual ~StringColumnPrinter() {} + virtual ~StringColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -135,7 +135,7 @@ namespace orc { const int64_t* length; public: BinaryColumnPrinter(std::string&); - virtual ~BinaryColumnPrinter() {} + virtual ~BinaryColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -147,7 +147,7 @@ namespace orc { public: ListColumnPrinter(std::string&, const Type& type); - virtual ~ListColumnPrinter() {} + virtual ~ListColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -160,7 +160,7 @@ namespace orc { public: MapColumnPrinter(std::string&, const Type& type); - virtual ~MapColumnPrinter() {} + virtual ~MapColumnPrinter() override {} void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -173,7 +173,7 @@ namespace orc { public: UnionColumnPrinter(std::string&, const Type& type); - virtual ~UnionColumnPrinter(); + virtual ~UnionColumnPrinter() override; void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; @@ -184,7 +184,7 @@ namespace orc { std::vector fieldNames; public: StructColumnPrinter(std::string&, const Type& type); - virtual ~StructColumnPrinter(); + virtual ~StructColumnPrinter() override; void printRow(uint64_t rowId) override; void reset(const ColumnVectorBatch& batch) override; }; diff --git a/c++/src/ColumnReader.cc b/c++/src/ColumnReader.cc index 58dd002225..5462becbc4 100644 --- a/c++/src/ColumnReader.cc +++ b/c++/src/ColumnReader.cc @@ -75,7 +75,7 @@ namespace orc { uint64_t chunkSize = std::min(remaining, static_cast(bufferSize)); - decoder->next(buffer, chunkSize, 0); + decoder->next(buffer, chunkSize, nullptr); remaining -= chunkSize; for(uint64_t i=0; i < chunkSize; ++i) { if (!buffer[i]) { @@ -134,7 +134,7 @@ namespace orc { public: BooleanColumnReader(const Type& type, StripeStreams& stipe); - ~BooleanColumnReader(); + ~BooleanColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -169,7 +169,7 @@ namespace orc { // we cheat here and use the long* and then expand it in a second pass. int64_t *ptr = dynamic_cast(rowBatch).data.data(); rle->next(reinterpret_cast(ptr), - numValues, rowBatch.hasNulls ? rowBatch.notNull.data() : 0); + numValues, rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr); expandBytesToLongs(ptr, numValues); } @@ -179,7 +179,7 @@ namespace orc { public: ByteColumnReader(const Type& type, StripeStreams& stipe); - ~ByteColumnReader(); + ~ByteColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -214,7 +214,7 @@ namespace orc { // we cheat here and use the long* and then expand it in a second pass. int64_t *ptr = dynamic_cast(rowBatch).data.data(); rle->next(reinterpret_cast(ptr), - numValues, rowBatch.hasNulls ? rowBatch.notNull.data() : 0); + numValues, rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr); expandBytesToLongs(ptr, numValues); } @@ -224,7 +224,7 @@ namespace orc { public: IntegerColumnReader(const Type& type, StripeStreams& stripe); - ~IntegerColumnReader(); + ~IntegerColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -258,7 +258,7 @@ namespace orc { char *notNull) { ColumnReader::next(rowBatch, numValues, notNull); rle->next(dynamic_cast(rowBatch).data.data(), - numValues, rowBatch.hasNulls ? rowBatch.notNull.data() : 0); + numValues, rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr); } class TimestampColumnReader: public ColumnReader { @@ -270,7 +270,7 @@ namespace orc { public: TimestampColumnReader(const Type& type, StripeStreams& stripe); - ~TimestampColumnReader(); + ~TimestampColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -342,7 +342,7 @@ namespace orc { class DoubleColumnReader: public ColumnReader { public: DoubleColumnReader(const Type& type, StripeStreams& stripe); - ~DoubleColumnReader(); + ~DoubleColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -399,8 +399,8 @@ namespace orc { columnKind(type.getKind()), bytesPerValue((type.getKind() == FLOAT) ? 4 : 8), - bufferPointer(NULL), - bufferEnd(NULL) { + bufferPointer(nullptr), + bufferEnd(nullptr) { // PASS } @@ -418,8 +418,8 @@ namespace orc { inputStream->Skip(static_cast(bytesPerValue*numValues - static_cast(bufferEnd - bufferPointer))); - bufferEnd = NULL; - bufferPointer = NULL; + bufferEnd = nullptr; + bufferPointer = nullptr; } return numValues; @@ -430,7 +430,7 @@ namespace orc { char *notNull) { ColumnReader::next(rowBatch, numValues, notNull); // update the notNull from the parent class - notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : 0; + notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr; double* outArray = dynamic_cast(rowBatch).data.data(); if (columnKind == FLOAT) { @@ -482,7 +482,7 @@ namespace orc { public: StringDictionaryColumnReader(const Type& type, StripeStreams& stipe); - ~StringDictionaryColumnReader(); + ~StringDictionaryColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -511,7 +511,7 @@ namespace orc { false, rleVersion, memoryPool); dictionaryOffset.resize(dictionaryCount+1); int64_t* lengthArray = dictionaryOffset.data(); - lengthDecoder->next(lengthArray + 1, dictionaryCount, 0); + lengthDecoder->next(lengthArray + 1, dictionaryCount, nullptr); lengthArray[0] = 0; for(uint64_t i=1; i < dictionaryCount + 1; ++i) { lengthArray[i] += lengthArray[i-1]; @@ -538,7 +538,7 @@ namespace orc { char *notNull) { ColumnReader::next(rowBatch, numValues, notNull); // update the notNull from the parent class - notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : 0; + notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr; StringVectorBatch& byteBatch = dynamic_cast(rowBatch); char *blob = dictionaryBlob.data(); int64_t *dictionaryOffsets = dictionaryOffset.data(); @@ -584,7 +584,7 @@ namespace orc { public: StringDirectColumnReader(const Type& type, StripeStreams& stipe); - ~StringDirectColumnReader(); + ~StringDirectColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -605,7 +605,7 @@ namespace orc { true), false, rleVersion, memoryPool); blobStream = stripe.getStream(columnId, proto::Stream_Kind_DATA, true); - lastBuffer = 0; + lastBuffer = nullptr; lastBufferLength = 0; } @@ -623,8 +623,8 @@ namespace orc { while (done < numValues) { uint64_t step = std::min(BUFFER_SIZE, static_cast(numValues - done)); - lengthRle->next(buffer, step, 0); - totalBytes += computeSize(buffer, 0, step); + lengthRle->next(buffer, step, nullptr); + totalBytes += computeSize(buffer, nullptr, step); done += step; } if (totalBytes <= lastBufferLength) { @@ -636,7 +636,7 @@ namespace orc { totalBytes -= lastBufferLength; blobStream->Skip(static_cast(totalBytes)); lastBufferLength = 0; - lastBuffer = 0; + lastBuffer = nullptr; } return numValues; } @@ -664,7 +664,7 @@ namespace orc { char *notNull) { ColumnReader::next(rowBatch, numValues, notNull); // update the notNull from the parent class - notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : 0; + notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr; StringVectorBatch& byteBatch = dynamic_cast(rowBatch); char **startPtr = byteBatch.data.data(); int64_t *lengthPtr = byteBatch.length.data(); @@ -756,7 +756,7 @@ namespace orc { public: StructColumnReader(const Type& type, StripeStreams& stipe); - ~StructColumnReader(); + ~StructColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -806,7 +806,7 @@ namespace orc { char *notNull) { ColumnReader::next(rowBatch, numValues, notNull); uint64_t i=0; - notNull = rowBatch.hasNulls? rowBatch.notNull.data() : 0; + notNull = rowBatch.hasNulls? rowBatch.notNull.data() : nullptr; for(std::vector::iterator ptr=children.begin(); ptr != children.end(); ++ptr, ++i) { (*ptr)->next(*(dynamic_cast(rowBatch).fields[i]), @@ -821,7 +821,7 @@ namespace orc { public: ListColumnReader(const Type& type, StripeStreams& stipe); - ~ListColumnReader(); + ~ListColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -860,7 +860,7 @@ namespace orc { uint64_t lengthsRead = 0; while (lengthsRead < numValues) { uint64_t chunk = std::min(numValues - lengthsRead, BUFFER_SIZE); - rle->next(buffer, chunk, 0); + rle->next(buffer, chunk, nullptr); for(size_t i=0; i < chunk; ++i) { childrenElements += static_cast(buffer[i]); } @@ -879,7 +879,7 @@ namespace orc { ColumnReader::next(rowBatch, numValues, notNull); ListVectorBatch &listBatch = dynamic_cast(rowBatch); int64_t* offsets = listBatch.offsets.data(); - notNull = listBatch.hasNulls ? listBatch.notNull.data() : 0; + notNull = listBatch.hasNulls ? listBatch.notNull.data() : nullptr; rle->next(offsets, numValues, notNull); uint64_t totalChildren = 0; if (notNull) { @@ -902,7 +902,7 @@ namespace orc { offsets[numValues] = static_cast(totalChildren); ColumnReader *childReader = child.get(); if (childReader) { - childReader->next(*(listBatch.elements.get()), totalChildren, 0); + childReader->next(*(listBatch.elements.get()), totalChildren, nullptr); } } @@ -914,7 +914,7 @@ namespace orc { public: MapColumnReader(const Type& type, StripeStreams& stipe); - ~MapColumnReader(); + ~MapColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -958,7 +958,7 @@ namespace orc { uint64_t lengthsRead = 0; while (lengthsRead < numValues) { uint64_t chunk = std::min(numValues - lengthsRead, BUFFER_SIZE); - rle->next(buffer, chunk, 0); + rle->next(buffer, chunk, nullptr); for(size_t i=0; i < chunk; ++i) { childrenElements += static_cast(buffer[i]); } @@ -982,7 +982,7 @@ namespace orc { ColumnReader::next(rowBatch, numValues, notNull); MapVectorBatch &mapBatch = dynamic_cast(rowBatch); int64_t* offsets = mapBatch.offsets.data(); - notNull = mapBatch.hasNulls ? mapBatch.notNull.data() : 0; + notNull = mapBatch.hasNulls ? mapBatch.notNull.data() : nullptr; rle->next(offsets, numValues, notNull); uint64_t totalChildren = 0; if (notNull) { @@ -1005,11 +1005,11 @@ namespace orc { offsets[numValues] = static_cast(totalChildren); ColumnReader *rawKeyReader = keyReader.get(); if (rawKeyReader) { - rawKeyReader->next(*(mapBatch.keys.get()), totalChildren, 0); + rawKeyReader->next(*(mapBatch.keys.get()), totalChildren, nullptr); } ColumnReader *rawElementReader = elementReader.get(); if (rawElementReader) { - rawElementReader->next(*(mapBatch.elements.get()), totalChildren, 0); + rawElementReader->next(*(mapBatch.elements.get()), totalChildren, nullptr); } } @@ -1022,7 +1022,7 @@ namespace orc { public: UnionColumnReader(const Type& type, StripeStreams& stipe); - ~UnionColumnReader(); + ~UnionColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -1067,14 +1067,14 @@ namespace orc { memset(counts, 0, sizeof(int64_t) * numChildren); while (lengthsRead < numValues) { uint64_t chunk = std::min(numValues - lengthsRead, BUFFER_SIZE); - rle->next(buffer, chunk, 0); + rle->next(buffer, chunk, nullptr); for(size_t i=0; i < chunk; ++i) { counts[static_cast(buffer[i])] += 1; } lengthsRead += chunk; } for(size_t i=0; i < numChildren; ++i) { - if (counts[i] != 0 && childrenReader[i] != NULL) { + if (counts[i] != 0 && childrenReader[i] != nullptr) { childrenReader[i]->skip(static_cast(counts[i])); } } @@ -1090,7 +1090,7 @@ namespace orc { int64_t* counts = childrenCounts.data(); memset(counts, 0, sizeof(int64_t) * numChildren); unsigned char* tags = unionBatch.tags.data(); - notNull = unionBatch.hasNulls ? unionBatch.notNull.data() : 0; + notNull = unionBatch.hasNulls ? unionBatch.notNull.data() : nullptr; rle->next(reinterpret_cast(tags), numValues, notNull); // set the offsets for each row if (notNull) { @@ -1180,7 +1180,7 @@ namespace orc { public: Decimal64ColumnReader(const Type& type, StripeStreams& stipe); - ~Decimal64ColumnReader(); + ~Decimal64ColumnReader() override; uint64_t skip(uint64_t numValues) override; @@ -1248,7 +1248,7 @@ namespace orc { uint64_t numValues, char *notNull) { ColumnReader::next(rowBatch, numValues, notNull); - notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : 0; + notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr; Decimal64VectorBatch &batch = dynamic_cast(rowBatch); int64_t* values = batch.values.data(); @@ -1295,7 +1295,7 @@ namespace orc { class Decimal128ColumnReader: public Decimal64ColumnReader { public: Decimal128ColumnReader(const Type& type, StripeStreams& stipe); - ~Decimal128ColumnReader(); + ~Decimal128ColumnReader() override; void next(ColumnVectorBatch& rowBatch, uint64_t numValues, @@ -1338,7 +1338,7 @@ namespace orc { uint64_t numValues, char *notNull) { ColumnReader::next(rowBatch, numValues, notNull); - notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : 0; + notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr; Decimal128VectorBatch &batch = dynamic_cast(rowBatch); Int128* values = batch.values.data(); @@ -1405,7 +1405,7 @@ namespace orc { public: DecimalHive11ColumnReader(const Type& type, StripeStreams& stipe); - ~DecimalHive11ColumnReader(); + ~DecimalHive11ColumnReader() override; void next(ColumnVectorBatch& rowBatch, uint64_t numValues, @@ -1429,7 +1429,7 @@ namespace orc { uint64_t numValues, char *notNull) { ColumnReader::next(rowBatch, numValues, notNull); - notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : 0; + notNull = rowBatch.hasNulls ? rowBatch.notNull.data() : nullptr; Decimal128VectorBatch &batch = dynamic_cast(rowBatch); Int128* values = batch.values.data(); diff --git a/c++/src/ColumnWriter.cc b/c++/src/ColumnWriter.cc index 9f9bb72607..9453180693 100644 --- a/c++/src/ColumnWriter.cc +++ b/c++/src/ColumnWriter.cc @@ -197,7 +197,7 @@ namespace orc { const Type& type, const StreamsFactory& factory, const WriterOptions& options); - ~StructColumnWriter(); + ~StructColumnWriter() override; virtual void add(ColumnVectorBatch& rowBatch, uint64_t offset, @@ -1532,7 +1532,7 @@ namespace orc { ListColumnWriter(const Type& type, const StreamsFactory& factory, const WriterOptions& options); - ~ListColumnWriter(); + ~ListColumnWriter() override; virtual void add(ColumnVectorBatch& rowBatch, uint64_t offset, @@ -1727,7 +1727,7 @@ namespace orc { MapColumnWriter(const Type& type, const StreamsFactory& factory, const WriterOptions& options); - ~MapColumnWriter(); + ~MapColumnWriter() override; virtual void add(ColumnVectorBatch& rowBatch, uint64_t offset, @@ -1958,7 +1958,7 @@ namespace orc { UnionColumnWriter(const Type& type, const StreamsFactory& factory, const WriterOptions& options); - ~UnionColumnWriter(); + ~UnionColumnWriter() override; virtual void add(ColumnVectorBatch& rowBatch, uint64_t offset, diff --git a/c++/src/ColumnWriter.hh b/c++/src/ColumnWriter.hh index a471b716a1..14fc54a295 100644 --- a/c++/src/ColumnWriter.hh +++ b/c++/src/ColumnWriter.hh @@ -52,7 +52,7 @@ namespace orc { */ class RowIndexPositionRecorder : public PositionRecorder { public: - virtual ~RowIndexPositionRecorder(); + virtual ~RowIndexPositionRecorder() override; RowIndexPositionRecorder(proto::RowIndexEntry& entry): rowIndexEntry(entry) {} diff --git a/c++/src/Compression.cc b/c++/src/Compression.cc index 114c55975e..b91f9326ec 100644 --- a/c++/src/Compression.cc +++ b/c++/src/Compression.cc @@ -269,9 +269,9 @@ DIAGNOSTIC_PUSH DIAGNOSTIC_IGNORE("-Wold-style-cast") void ZlibCompressionStream::init() { - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; + strm.zalloc = nullptr; + strm.zfree = nullptr; + strm.opaque = nullptr; if (deflateInit2(&strm, level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK) { @@ -292,7 +292,7 @@ DIAGNOSTIC_PUSH ZlibDecompressionStream(std::unique_ptr inStream, size_t blockSize, MemoryPool& pool); - virtual ~ZlibDecompressionStream(); + virtual ~ZlibDecompressionStream() override; virtual bool Next(const void** data, int*size) override; virtual void BackUp(int count) override; virtual bool Skip(int count) override; @@ -380,11 +380,11 @@ DIAGNOSTIC_IGNORE("-Wold-style-cast") blockSize(_blockSize), buffer(pool, _blockSize) { input.reset(inStream.release()); - zstream.next_in = Z_NULL; + zstream.next_in = nullptr; zstream.avail_in = 0; - zstream.zalloc = Z_NULL; - zstream.zfree = Z_NULL; - zstream.opaque = Z_NULL; + zstream.zalloc = nullptr; + zstream.zfree = nullptr; + zstream.opaque = nullptr; zstream.next_out = reinterpret_cast(buffer.data()); zstream.avail_out = static_cast(blockSize); int64_t result = inflateInit2(&zstream, -15); @@ -557,7 +557,7 @@ DIAGNOSTIC_POP size_t blockSize, MemoryPool& pool); - virtual ~BlockDecompressionStream() {} + virtual ~BlockDecompressionStream() override {} virtual bool Next(const void** data, int*size) override; virtual void BackUp(int count) override; virtual bool Skip(int count) override; @@ -652,11 +652,11 @@ DIAGNOSTIC_POP inputBuffer(pool, bufferSize), outputBuffer(pool, bufferSize), state(DECOMPRESS_HEADER), - outputBufferPtr(0), + outputBufferPtr(nullptr), outputBufferLength(0), remainingLength(0), - inputBufferPtr(0), - inputBufferPtrEnd(0), + inputBufferPtr(nullptr), + inputBufferPtrEnd(nullptr), bytesReturned(0) { input.reset(inStream.release()); } diff --git a/c++/src/MemoryPool.cc b/c++/src/MemoryPool.cc index 7fecf67d1e..14b7ebfb5e 100644 --- a/c++/src/MemoryPool.cc +++ b/c++/src/MemoryPool.cc @@ -33,7 +33,7 @@ namespace orc { class MemoryPoolImpl: public MemoryPool { public: - virtual ~MemoryPoolImpl(); + virtual ~MemoryPoolImpl() override; char* malloc(uint64_t size) override; void free(char* p) override; diff --git a/c++/src/OrcFile.cc b/c++/src/OrcFile.cc index 4a35d90158..3db98fecf9 100644 --- a/c++/src/OrcFile.cc +++ b/c++/src/OrcFile.cc @@ -52,7 +52,7 @@ namespace orc { totalLength = static_cast(fileStat.st_size); } - ~FileInputStream(); + ~FileInputStream() override; uint64_t getLength() const override { return totalLength; @@ -128,7 +128,7 @@ namespace orc { } } - ~FileOutputStream(); + ~FileOutputStream() override; uint64_t getLength() const override { return bytesWritten; diff --git a/c++/src/OrcHdfsFile.cc b/c++/src/OrcHdfsFile.cc index 8f51d5b918..58027c7a4b 100644 --- a/c++/src/OrcHdfsFile.cc +++ b/c++/src/OrcHdfsFile.cc @@ -161,7 +161,7 @@ namespace orc { return filename; } - ~HdfsFileInputStream(); + ~HdfsFileInputStream() override; }; HdfsFileInputStream::~HdfsFileInputStream() { diff --git a/c++/src/RLEv1.hh b/c++/src/RLEv1.hh index 6b0855e4f3..a4be19aae8 100644 --- a/c++/src/RLEv1.hh +++ b/c++/src/RLEv1.hh @@ -30,7 +30,7 @@ class RleEncoderV1 : public RleEncoder { public: RleEncoderV1(std::unique_ptr outStream, bool hasSigned); - ~RleEncoderV1(); + ~RleEncoderV1() override; /** * Encode the next batch of values. diff --git a/c++/src/RLEv2.cc b/c++/src/RLEv2.cc index 02f325f50d..10c6190ee5 100644 --- a/c++/src/RLEv2.cc +++ b/c++/src/RLEv2.cc @@ -140,7 +140,7 @@ void RleDecoderV2::seek(PositionProvider& location) { // move the input stream inputStream->seek(location); // clear state - bufferEnd = bufferStart = 0; + bufferEnd = bufferStart = nullptr; runRead = runLength = 0; // skip ahead the given number of records skip(location.next()); diff --git a/c++/src/Reader.cc b/c++/src/Reader.cc index 92f5f2138a..fd22f5f7b9 100644 --- a/c++/src/Reader.cc +++ b/c++/src/Reader.cc @@ -829,7 +829,7 @@ namespace orc { std::min(static_cast(data.capacity), rowsInCurrentStripe - currentRowInStripe); data.numElements = rowsToRead; - reader->next(data, rowsToRead, 0); + reader->next(data, rowsToRead, nullptr); // update row number previousRow = firstRowOfStripe[currentStripe] + currentRowInStripe; currentRowInStripe += rowsToRead; diff --git a/c++/src/Statistics.cc b/c++/src/Statistics.cc index e5e700df63..b7505117c0 100644 --- a/c++/src/Statistics.cc +++ b/c++/src/Statistics.cc @@ -309,10 +309,10 @@ namespace orc { const proto::TimestampStatistics& stats = pb.timestampstatistics(); _stats.setHasMinimum( stats.has_minimumutc() || - (stats.has_minimum() && (statContext.writerTimezone != NULL))); + (stats.has_minimum() && (statContext.writerTimezone != nullptr))); _stats.setHasMaximum( stats.has_maximumutc() || - (stats.has_maximum() && (statContext.writerTimezone != NULL))); + (stats.has_maximum() && (statContext.writerTimezone != nullptr))); _hasLowerBound = stats.has_minimumutc() || stats.has_minimum(); _hasUpperBound = stats.has_maximumutc() || stats.has_maximum(); diff --git a/c++/src/Statistics.hh b/c++/src/Statistics.hh index e878d48753..a1f1c35b72 100644 --- a/c++/src/Statistics.hh +++ b/c++/src/Statistics.hh @@ -36,8 +36,8 @@ namespace orc { struct StatContext { const bool correctStats; const Timezone* const writerTimezone; - StatContext() : correctStats(false), writerTimezone(NULL) {} - StatContext(bool cStat, const Timezone* const timezone = NULL) : + StatContext() : correctStats(false), writerTimezone(nullptr) {} + StatContext(bool cStat, const Timezone* const timezone = nullptr) : correctStats(cStat), writerTimezone(timezone) {} }; @@ -205,7 +205,7 @@ namespace orc { public: ColumnStatisticsImpl() { reset(); } ColumnStatisticsImpl(const proto::ColumnStatistics& stats); - virtual ~ColumnStatisticsImpl(); + virtual ~ColumnStatisticsImpl() override; uint64_t getNumberOfValues() const override { return _stats.getNumberOfValues(); @@ -257,7 +257,7 @@ namespace orc { BinaryColumnStatisticsImpl() { reset(); } BinaryColumnStatisticsImpl(const proto::ColumnStatistics& stats, const StatContext& statContext); - virtual ~BinaryColumnStatisticsImpl(); + virtual ~BinaryColumnStatisticsImpl() override; uint64_t getNumberOfValues() const override { return _stats.getNumberOfValues(); @@ -344,7 +344,7 @@ namespace orc { BooleanColumnStatisticsImpl() { reset(); } BooleanColumnStatisticsImpl(const proto::ColumnStatistics& stats, const StatContext& statContext); - virtual ~BooleanColumnStatisticsImpl(); + virtual ~BooleanColumnStatisticsImpl() override; bool hasCount() const override { return _hasCount; @@ -445,7 +445,7 @@ namespace orc { DateColumnStatisticsImpl() { reset(); } DateColumnStatisticsImpl(const proto::ColumnStatistics& stats, const StatContext& statContext); - virtual ~DateColumnStatisticsImpl(); + virtual ~DateColumnStatisticsImpl() override; bool hasMinimum() const override { return _stats.hasMinimum(); @@ -556,7 +556,7 @@ namespace orc { DecimalColumnStatisticsImpl() { reset(); } DecimalColumnStatisticsImpl(const proto::ColumnStatistics& stats, const StatContext& statContext); - virtual ~DecimalColumnStatisticsImpl(); + virtual ~DecimalColumnStatisticsImpl() override; bool hasMinimum() const override { return _stats.hasMinimum(); @@ -734,7 +734,7 @@ namespace orc { public: DoubleColumnStatisticsImpl() { reset(); } DoubleColumnStatisticsImpl(const proto::ColumnStatistics& stats); - virtual ~DoubleColumnStatisticsImpl(); + virtual ~DoubleColumnStatisticsImpl() override; bool hasMinimum() const override { return _stats.hasMinimum(); @@ -875,7 +875,7 @@ namespace orc { public: IntegerColumnStatisticsImpl() { reset(); } IntegerColumnStatisticsImpl(const proto::ColumnStatistics& stats); - virtual ~IntegerColumnStatisticsImpl(); + virtual ~IntegerColumnStatisticsImpl() override; bool hasMinimum() const override { return _stats.hasMinimum(); @@ -1033,7 +1033,7 @@ namespace orc { } StringColumnStatisticsImpl(const proto::ColumnStatistics& stats, const StatContext& statContext); - virtual ~StringColumnStatisticsImpl(); + virtual ~StringColumnStatisticsImpl() override; bool hasMinimum() const override { return _stats.hasMinimum(); @@ -1203,7 +1203,7 @@ namespace orc { TimestampColumnStatisticsImpl() { reset(); } TimestampColumnStatisticsImpl(const proto::ColumnStatistics& stats, const StatContext& statContext); - virtual ~TimestampColumnStatisticsImpl(); + virtual ~TimestampColumnStatisticsImpl() override; bool hasMinimum() const override { return _stats.hasMinimum(); @@ -1386,7 +1386,7 @@ namespace orc { return *it; } - virtual ~StatisticsImpl(); + virtual ~StatisticsImpl() override; uint32_t getNumberOfColumns() const override { return static_cast(colStats.size()); @@ -1425,7 +1425,7 @@ namespace orc { return rowIndexStats[columnId][rowIndex].get(); } - virtual ~StripeStatisticsImpl(); + virtual ~StripeStatisticsImpl() override; uint32_t getNumberOfRowIndexStats(uint32_t columnId) const override { return static_cast(rowIndexStats[columnId].size()); diff --git a/c++/src/StripeStream.hh b/c++/src/StripeStream.hh index 8f31397aba..777056426f 100644 --- a/c++/src/StripeStream.hh +++ b/c++/src/StripeStream.hh @@ -49,7 +49,7 @@ namespace orc { InputStream& input, const Timezone& writerTimezone); - virtual ~StripeStreamsImpl(); + virtual ~StripeStreamsImpl() override; virtual const std::vector getSelectedColumns() const override; @@ -92,7 +92,7 @@ namespace orc { // PASS } - ~StreamInformationImpl(); + ~StreamInformationImpl() override; StreamKind getKind() const override { return kind; @@ -150,7 +150,7 @@ namespace orc { // PASS } - virtual ~StripeInformationImpl() { + virtual ~StripeInformationImpl() override { // PASS } diff --git a/c++/src/Timezone.cc b/c++/src/Timezone.cc index bc2ffb623b..6083293059 100644 --- a/c++/src/Timezone.cc +++ b/c++/src/Timezone.cc @@ -238,7 +238,7 @@ namespace orc { } public: - virtual ~FutureRuleImpl(); + virtual ~FutureRuleImpl() override; bool isDefined() const override; const TimezoneVariant& getVariant(int64_t clk) const override; void print(std::ostream& out) const override; @@ -518,7 +518,7 @@ namespace orc { class Version1Parser: public VersionParser { public: - virtual ~Version1Parser(); + virtual ~Version1Parser() override; virtual uint64_t getVersion() const override { return 1; @@ -552,7 +552,7 @@ namespace orc { class Version2Parser: public VersionParser { public: - virtual ~Version2Parser(); + virtual ~Version2Parser() override; virtual uint64_t getVersion() const override { return 2; @@ -588,7 +588,7 @@ namespace orc { public: TimezoneImpl(const std::string& name, const std::vector bytes); - virtual ~TimezoneImpl(); + virtual ~TimezoneImpl() override; /** * Get the variant for the given time (time_t). diff --git a/c++/src/TypeImpl.hh b/c++/src/TypeImpl.hh index 3c3f739691..ee34f781a9 100644 --- a/c++/src/TypeImpl.hh +++ b/c++/src/TypeImpl.hh @@ -58,7 +58,7 @@ namespace orc { TypeImpl(TypeKind kind, uint64_t precision, uint64_t scale); - virtual ~TypeImpl(); + virtual ~TypeImpl() override; uint64_t getColumnId() const override; diff --git a/c++/src/io/InputStream.hh b/c++/src/io/InputStream.hh index 5ea8c7ea60..c6496d9634 100644 --- a/c++/src/io/InputStream.hh +++ b/c++/src/io/InputStream.hh @@ -72,7 +72,7 @@ namespace orc { SeekableArrayInputStream(const char* list, uint64_t length, uint64_t block_size = 0); - virtual ~SeekableArrayInputStream(); + virtual ~SeekableArrayInputStream() override; virtual bool Next(const void** data, int*size) override; virtual void BackUp(int count) override; virtual bool Skip(int count) override; @@ -101,7 +101,7 @@ namespace orc { uint64_t byteCount, MemoryPool& pool, uint64_t blockSize = 0); - virtual ~SeekableFileInputStream(); + virtual ~SeekableFileInputStream() override; virtual bool Next(const void** data, int*size) override; virtual void BackUp(int count) override; diff --git a/c++/src/io/OutputStream.hh b/c++/src/io/OutputStream.hh index 8ff2061c40..6d04629331 100644 --- a/c++/src/io/OutputStream.hh +++ b/c++/src/io/OutputStream.hh @@ -51,7 +51,7 @@ namespace orc { OutputStream * outStream, uint64_t capacity, uint64_t block_size); - virtual ~BufferedOutputStream(); + virtual ~BufferedOutputStream() override; virtual bool Next(void** data, int*size) override; virtual void BackUp(int count) override; diff --git a/c++/src/wrap/gtest-wrapper.h b/c++/src/wrap/gtest-wrapper.h index fb95a1dab4..a14f6c3898 100644 --- a/c++/src/wrap/gtest-wrapper.h +++ b/c++/src/wrap/gtest-wrapper.h @@ -26,7 +26,9 @@ DIAGNOSTIC_IGNORE("-Wsign-compare") DIAGNOSTIC_IGNORE("-Wconversion-null") DIAGNOSTIC_IGNORE("-Wexit-time-destructors") DIAGNOSTIC_IGNORE("-Wglobal-constructors") + DIAGNOSTIC_IGNORE("-Wunknown-warning-option") DIAGNOSTIC_IGNORE("-Wused-but-marked-unused") + DIAGNOSTIC_IGNORE("-Wzero-as-null-pointer-constant") #endif DIAGNOSTIC_PUSH diff --git a/c++/src/wrap/orc-proto-wrapper.cc b/c++/src/wrap/orc-proto-wrapper.cc index 7234b7fee7..8b10caee44 100644 --- a/c++/src/wrap/orc-proto-wrapper.cc +++ b/c++/src/wrap/orc-proto-wrapper.cc @@ -29,7 +29,9 @@ DIAGNOSTIC_IGNORE("-Wunused-parameter") DIAGNOSTIC_IGNORE("-Wnested-anon-types") DIAGNOSTIC_IGNORE("-Wreserved-id-macro") DIAGNOSTIC_IGNORE("-Wshorten-64-to-32") + DIAGNOSTIC_IGNORE("-Wunknown-warning-option") DIAGNOSTIC_IGNORE("-Wweak-vtables") + DIAGNOSTIC_IGNORE("-Wzero-as-null-pointer-constant") #endif #include "orc_proto.pb.cc" diff --git a/c++/src/wrap/orc-proto-wrapper.hh b/c++/src/wrap/orc-proto-wrapper.hh index 2f2304da87..5fc9558e63 100644 --- a/c++/src/wrap/orc-proto-wrapper.hh +++ b/c++/src/wrap/orc-proto-wrapper.hh @@ -27,7 +27,9 @@ DIAGNOSTIC_IGNORE("-Wunused-parameter") DIAGNOSTIC_IGNORE("-Wnested-anon-types") DIAGNOSTIC_IGNORE("-Wreserved-id-macro") DIAGNOSTIC_IGNORE("-Wshorten-64-to-32") + DIAGNOSTIC_IGNORE("-Wunknown-warning-option") DIAGNOSTIC_IGNORE("-Wweak-vtables") + DIAGNOSTIC_IGNORE("-Wzero-as-null-pointer-constant") #endif #include "orc_proto.pb.h" diff --git a/c++/test/MemoryInputStream.hh b/c++/test/MemoryInputStream.hh index 302a55128d..f0f13db559 100644 --- a/c++/test/MemoryInputStream.hh +++ b/c++/test/MemoryInputStream.hh @@ -34,7 +34,7 @@ namespace orc { name("MemoryInputStream") { } - ~MemoryInputStream(); + ~MemoryInputStream() override; virtual uint64_t getLength() const override { return size; diff --git a/c++/test/MemoryOutputStream.hh b/c++/test/MemoryOutputStream.hh index 99751e558d..6b23a34eb9 100644 --- a/c++/test/MemoryOutputStream.hh +++ b/c++/test/MemoryOutputStream.hh @@ -33,7 +33,7 @@ namespace orc { length = 0; } - virtual ~MemoryOutputStream(); + virtual ~MemoryOutputStream() override; virtual uint64_t getLength() const override { return length; diff --git a/c++/test/TestColumnReader.cc b/c++/test/TestColumnReader.cc index 011b04dedd..58d9871fce 100644 --- a/c++/test/TestColumnReader.cc +++ b/c++/test/TestColumnReader.cc @@ -37,7 +37,7 @@ namespace orc { class MockStripeStreams: public StripeStreams { public: - ~MockStripeStreams(); + ~MockStripeStreams() override; std::unique_ptr getStream(uint64_t columnId, proto::Stream_Kind kind, bool stream) const override; diff --git a/docker/ubuntu16-clang5/Dockerfile b/docker/ubuntu16-clang5/Dockerfile new file mode 100644 index 0000000000..f21c91f78f --- /dev/null +++ b/docker/ubuntu16-clang5/Dockerfile @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ORC compile for Ubuntu 16 (clang 5) +# + +FROM ubuntu:16.04 +MAINTAINER Owen O'Malley + +RUN apt-get update +RUN apt-get install -y wget software-properties-common +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - +RUN apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" +RUN apt-get update +RUN apt-get install -y \ + cmake \ + default-jdk \ + clang-5.0 \ + git \ + libsasl2-dev \ + libssl-dev \ + make \ + maven \ + tzdata + +ENV CC=clang-5.0 +ENV CXX=clang++-5.0 + +WORKDIR /root + +CMD git clone https://github.com/apache/orc.git -b master && \ + mkdir orc/build && \ + cd orc/build && \ + cmake .. && \ + make package test-out diff --git a/tools/src/FileMemory.cc b/tools/src/FileMemory.cc index 7298a38fe9..cc5cdaabe0 100644 --- a/tools/src/FileMemory.cc +++ b/tools/src/FileMemory.cc @@ -54,7 +54,7 @@ class TestMemoryPool: public orc::MemoryPool { } TestMemoryPool(): totalMemory(0), maxMemory(0) {} - ~TestMemoryPool(); + ~TestMemoryPool() override; }; TestMemoryPool::~TestMemoryPool() {} diff --git a/tools/src/FileStatistics.cc b/tools/src/FileStatistics.cc index f8b57b314c..b0bc62632f 100644 --- a/tools/src/FileStatistics.cc +++ b/tools/src/FileStatistics.cc @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) { {"withIndex", no_argument, ORC_NULLPTR, 'i'}, {ORC_NULLPTR, 0, ORC_NULLPTR, 0} }; - const char* filename = NULL; + const char* filename = nullptr; bool withIndex = false; bool helpFlag = false; int opt; diff --git a/tools/test/gzip.cc b/tools/test/gzip.cc index 462eca30f0..c5ada8b3b6 100644 --- a/tools/test/gzip.cc +++ b/tools/test/gzip.cc @@ -34,12 +34,12 @@ namespace orc { if (file == nullptr) { throw std::runtime_error("can't open " + filename); } - stream.zalloc = Z_NULL; - stream.zfree = Z_NULL; - stream.opaque = Z_NULL; + stream.zalloc = nullptr; + stream.zfree = nullptr; + stream.opaque = nullptr; stream.avail_in = 0; stream.avail_out = 1; - stream.next_in = Z_NULL; + stream.next_in = nullptr; int ret = inflateInit2(&stream, 16+MAX_WBITS); if (ret != Z_OK) { throw std::runtime_error("zlib failed initialization for " + filename);