Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 508D5200B26 for ; Mon, 13 Jun 2016 04:40:56 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4F074160A2C; Mon, 13 Jun 2016 02:40:56 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 05F24160A5D for ; Mon, 13 Jun 2016 04:40:53 +0200 (CEST) Received: (qmail 40957 invoked by uid 500); 13 Jun 2016 02:40:53 -0000 Mailing-List: contact commits-help@hawq.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hawq.incubator.apache.org Delivered-To: mailing list commits@hawq.incubator.apache.org Received: (qmail 40948 invoked by uid 99); 13 Jun 2016 02:40:53 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2016 02:40:53 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A2F79C2EC5 for ; Mon, 13 Jun 2016 02:40:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id koJRLMMnloMS for ; Mon, 13 Jun 2016 02:40:41 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with SMTP id B2C5A60E57 for ; Mon, 13 Jun 2016 02:40:14 +0000 (UTC) Received: (qmail 37111 invoked by uid 99); 13 Jun 2016 02:40:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2016 02:40:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 45873E094C; Mon, 13 Jun 2016 02:40:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: huor@apache.org To: commits@hawq.incubator.apache.org Date: Mon, 13 Jun 2016 02:40:58 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [48/51] [abbrv] [partial] incubator-hawq git commit: HAWQ-795. Import apache/orc into depends folder. archived-at: Mon, 13 Jun 2016 02:40:56 -0000 http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/CMakeLists.txt b/depends/thirdparty/orc/c++/include/CMakeLists.txt new file mode 100644 index 0000000..3891e71 --- /dev/null +++ b/depends/thirdparty/orc/c++/include/CMakeLists.txt @@ -0,0 +1,83 @@ +# Licensed 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. + +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS} ${WARN_FLAGS}") + +INCLUDE(CheckCXXSourceCompiles) + +CHECK_CXX_SOURCE_COMPILES(" + #include + struct A { + A(std::initializer_list list); + }; + int main(int,char*[]){ + }" + ORC_CXX_HAS_INITIALIZER_LIST +) + +CHECK_CXX_SOURCE_COMPILES(" + int main(int,char*[]) noexcept { + return 0; + }" + ORC_CXX_HAS_NOEXCEPT +) + +CHECK_CXX_SOURCE_COMPILES(" + int main(int,char* argv[]){ + return argv[0] != nullptr; + }" + ORC_CXX_HAS_NULLPTR +) + +CHECK_CXX_SOURCE_COMPILES(" + struct A { + virtual ~A(); + virtual void foo(); + }; + struct B: public A { + virtual void foo() override; + }; + int main(int,char*[]){ + }" + ORC_CXX_HAS_OVERRIDE +) + +CHECK_CXX_SOURCE_COMPILES(" + #include + int main(int,char* []){ + std::unique_ptr ptr(new int); + }" + ORC_CXX_HAS_UNIQUE_PTR +) + +CHECK_CXX_SOURCE_COMPILES(" + #include + int main(int, char*[]) { }" + ORC_CXX_HAS_CSTDINT +) + +configure_file ( + "orc/orc-config.hh.in" + "${CMAKE_CURRENT_BINARY_DIR}/orc/orc-config.hh" + ) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/orc/orc-config.hh" + "orc/ColumnPrinter.hh" + "orc/Int128.hh" + "orc/MemoryPool.hh" + "orc/OrcFile.hh" + "orc/Reader.hh" + "orc/Type.hh" + "orc/Vector.hh" + DESTINATION "include/orc" + ) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/orc/ColumnPrinter.hh ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/orc/ColumnPrinter.hh b/depends/thirdparty/orc/c++/include/orc/ColumnPrinter.hh new file mode 100644 index 0000000..aa19214 --- /dev/null +++ b/depends/thirdparty/orc/c++/include/orc/ColumnPrinter.hh @@ -0,0 +1,51 @@ +/** + * 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. + */ + +#ifndef ORC_COLUMN_PRINTER_HH +#define ORC_COLUMN_PRINTER_HH + +#include "orc/orc-config.hh" +#include "orc/OrcFile.hh" +#include "orc/Vector.hh" + +#include +#include +#include +#include +#include + +namespace orc { + + class ColumnPrinter { + protected: + std::string &buffer; + bool hasNulls ; + const char* notNull; + + public: + ColumnPrinter(std::string&); + virtual ~ColumnPrinter(); + virtual void printRow(uint64_t rowId) = 0; + // should be called once at the start of each batch of rows + virtual void reset(const ColumnVectorBatch& batch); + }; + + ORC_UNIQUE_PTR createColumnPrinter(std::string&, + const Type* type); +} +#endif http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/orc/Int128.hh ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/orc/Int128.hh b/depends/thirdparty/orc/c++/include/orc/Int128.hh new file mode 100644 index 0000000..70793dc --- /dev/null +++ b/depends/thirdparty/orc/c++/include/orc/Int128.hh @@ -0,0 +1,336 @@ +/** + * 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. + */ + +#ifndef ORC_INT_128 +#define ORC_INT_128 + +#include "orc/orc-config.hh" + +#include +#include + +namespace orc { + + /** + * Represents a signed 128-bit integer in two's complement. + * Calculations wrap around and overflow is ignored. + * + * For a discussion of the algorithms, look at Knuth's volume 2, + * Semi-numerical Algorithms section 4.3.1. + * + */ + class Int128 { + public: + Int128() { + highbits = 0; + lowbits = 0; + } + + /** + * Convert a signed 64 bit value into an Int128. + */ + Int128(int64_t right) { + if (right >= 0) { + highbits = 0; + lowbits = static_cast(right); + } else { + highbits = -1; + lowbits = static_cast(right); + } + } + + /** + * Create from the twos complement representation. + */ + Int128(int64_t high, uint64_t low) { + highbits = high; + lowbits = low; + } + + /** + * Parse the number from a base 10 string representation. + */ + explicit Int128(const std::string&); + + /** + * Maximum positive value allowed by the type. + */ + static Int128 maximumValue(); + + /** + * Minimum negative value allowed by the type. + */ + static Int128 minimumValue(); + + Int128& negate() { + lowbits = ~lowbits + 1; + highbits = ~highbits; + if (lowbits == 0) { + highbits += 1; + } + return *this; + } + + Int128& abs() { + if (highbits < 0) { + negate(); + } + return *this; + } + + Int128& invert() { + lowbits = ~lowbits; + highbits = ~highbits; + return *this; + } + + /** + * Add a number to this one. The result is truncated to 128 bits. + * @param right the number to add + * @return *this + */ + Int128& operator+=(const Int128 &right) { + uint64_t sum = lowbits + right.lowbits; + highbits += right.highbits; + if (sum < lowbits) { + highbits += 1; + } + lowbits = sum; + return *this; + } + + /** + * Subtract a number from this one. The result is truncated to 128 bits. + * @param right the number to subtract + * @return *this + */ + Int128& operator-=(const Int128 &right) { + uint64_t diff = lowbits - right.lowbits; + highbits -= right.highbits; + if (diff > lowbits) { + highbits -= 1; + } + lowbits = diff; + return *this; + } + + /** + * Multiply this number by a number. The result is truncated to 128 bits. + * @param right the number to multiply by + * @return *this + */ + Int128& operator*=(const Int128 &right); + + /** + * Divide this number by right and return the result. This operation is + * not destructive. + * + * The answer rounds to zero. Signs work like: + * 21 / 5 -> 4, 1 + * -21 / 5 -> -4, -1 + * 21 / -5 -> -4, 1 + * -21 / -5 -> 4, -1 + * @param right the number to divide by + * @param remainder the remainder after the division + */ + Int128 divide(const Int128 &right, Int128& remainder) const; + + /** + * Logical or between two Int128. + * @param right the number to or in + * @return *this + */ + Int128& operator|=(const Int128 &right) { + lowbits |= right.lowbits; + highbits |= right.highbits; + return *this; + } + + /** + * Logical and between two Int128. + * @param right the number to and in + * @return *this + */ + Int128& operator&=(const Int128 &right) { + lowbits &= right.lowbits; + highbits &= right.highbits; + return *this; + } + + /** + * Shift left by the given number of bits. + * Values larger than 2**127 will shift into the sign bit. + */ + Int128& operator<<=(uint32_t bits) { + if (bits != 0) { + if (bits < 64) { + highbits <<= bits; + highbits |= (lowbits >> (64 - bits)); + lowbits <<= bits; + } else if (bits < 128) { + highbits = static_cast(lowbits) << (bits - 64); + lowbits = 0; + } else { + highbits = 0; + lowbits = 0; + } + } + return *this; + } + + /** + * Shift right by the given number of bits. Negative values will + * sign extend and fill with one bits. + */ + Int128& operator>>=(uint32_t bits) { + if (bits != 0) { + if (bits < 64) { + lowbits >>= bits; + lowbits |= static_cast(highbits << (64 - bits)); + highbits = static_cast + (static_cast(highbits) >> bits); + } else if (bits < 128) { + lowbits = static_cast(highbits >> (bits - 64)); + highbits = highbits >= 0 ? 0 : -1l; + } else { + highbits = highbits >= 0 ? 0 : -1l; + lowbits = static_cast(highbits); + } + } + return *this; + } + + bool operator==(const Int128& right) const { + return highbits == right.highbits && lowbits == right.lowbits; + } + + bool operator!=(const Int128& right) const { + return highbits != right.highbits || lowbits != right.lowbits; + } + + bool operator<(const Int128 &right) const { + if (highbits == right.highbits) { + return lowbits < right.lowbits; + } else { + return highbits < right.highbits; + } + } + + bool operator<=(const Int128 &right) const { + if (highbits == right.highbits) { + return lowbits <= right.lowbits; + } else { + return highbits <= right.highbits; + } + } + + bool operator>(const Int128 &right) const { + if (highbits == right.highbits) { + return lowbits > right.lowbits; + } else { + return highbits > right.highbits; + } + } + + bool operator>=(const Int128 &right) const { + if (highbits == right.highbits) { + return lowbits >= right.lowbits; + } else { + return highbits >= right.highbits; + } + } + + uint32_t hash() const { + return static_cast(highbits >> 32) ^ + static_cast(highbits) ^ + static_cast(lowbits >> 32) ^ + static_cast(lowbits); + } + + /** + * Does this value fit into a long? + */ + bool fitsInLong() const { + switch (highbits) { + case 0: + return !(lowbits & LONG_SIGN_BIT); + case -1: + return lowbits & LONG_SIGN_BIT; + default: + return false; + } + } + + /** + * Convert the value to a long and + */ + int64_t toLong() const { + if (fitsInLong()) { + return static_cast(lowbits); + } + throw std::range_error("Int128 too large to convert to long"); + } + + /** + * Return the base 10 string representation of the integer. + */ + std::string toString() const; + + /** + * Return the base 10 string representation with a decimal point, + * the given number of places after the decimal. + */ + std::string toDecimalString(int32_t scale=0) const; + + /** + * Return the base 16 string representation of the two's complement with + * a prefix of "0x". + * Int128(-1).toHexString() = "0xffffffffffffffffffffffffffffffff". + */ + std::string toHexString() const; + + /** + * Get the high bits of the twos complement representation of the number. + */ + int64_t getHighBits() { + return highbits; + } + + /** + * Get the low bits of the twos complement representation of the number. + */ + uint64_t getLowBits() { + return lowbits; + } + + /** + * Represent the absolute number as a list of uint32. + * Visible for testing only. + * @param array the array that is set to the value of the number + * @param wasNegative set to true if the original number was negative + * @return the number of elements that were set in the array (1 to 4) + */ + int64_t fillInArray(uint32_t* array, bool &wasNegative) const; + + private: + static const uint64_t LONG_SIGN_BIT = 0x8000000000000000u; + int64_t highbits; + uint64_t lowbits; + }; +} +#endif http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/orc/MemoryPool.hh ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/orc/MemoryPool.hh b/depends/thirdparty/orc/c++/include/orc/MemoryPool.hh new file mode 100644 index 0000000..4673f69 --- /dev/null +++ b/depends/thirdparty/orc/c++/include/orc/MemoryPool.hh @@ -0,0 +1,82 @@ +/** + * 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. + */ + +#ifndef MEMORYPOOL_HH_ +#define MEMORYPOOL_HH_ + +#include "orc/orc-config.hh" + +#include + +namespace orc { + + class MemoryPool { + public: + virtual ~MemoryPool(); + + virtual char* malloc(uint64_t size) = 0; + virtual void free(char* p) = 0; + }; + MemoryPool* getDefaultPool(); + + template + class DataBuffer { + private: + MemoryPool& memoryPool; + T* buf; + // current size + uint64_t currentSize; + // maximal capacity (actual allocated memory) + uint64_t currentCapacity; + + // not implemented + DataBuffer(DataBuffer& buffer); + DataBuffer& operator=(DataBuffer& buffer); + + public: + DataBuffer(MemoryPool& pool, uint64_t _size = 0); + virtual ~DataBuffer(); + + T* data() { + return buf; + } + + const T* data() const { + return buf; + } + + uint64_t size() { + return currentSize; + } + + uint64_t capacity() { + return currentCapacity; + } + + T& operator[](uint64_t i) { + return buf[i]; + } + + void reserve(uint64_t _size); + void resize(uint64_t _size); + }; + +} // namespace orc + + +#endif /* MEMORYPOOL_HH_ */ http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/orc/OrcFile.hh ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/orc/OrcFile.hh b/depends/thirdparty/orc/c++/include/orc/OrcFile.hh new file mode 100644 index 0000000..f8f13fb --- /dev/null +++ b/depends/thirdparty/orc/c++/include/orc/OrcFile.hh @@ -0,0 +1,83 @@ +/** + * 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. + */ + +#ifndef ORC_FILE_HH +#define ORC_FILE_HH + +#include + +#include "orc/orc-config.hh" +#include "orc/Reader.hh" + +/** /file orc/OrcFile.hh + @brief The top level interface to ORC. +*/ + +namespace orc { + + /** + * An abstract interface for providing ORC readers a stream of bytes. + */ + class InputStream { + public: + virtual ~InputStream(); + + /** + * Get the total length of the file in bytes. + */ + virtual uint64_t getLength() const = 0; + + /** + * Get the natural size for reads. + * @return the number of bytes that should be read at once + */ + virtual uint64_t getNaturalReadSize() const = 0; + + /** + * Read length bytes from the file starting at offset into + * the buffer starting at buf. + * @param buf the starting position of a buffer. + * @param length the number of bytes to read. + * @param offset the position in the stream to read from. + */ + virtual void read(void* buf, + uint64_t length, + uint64_t offset) = 0; + + /** + * Get the name of the stream for error messages. + */ + virtual const std::string& getName() const = 0; + }; + + /** + * Create a stream to a local file. + * @param path the name of the file in the local file system + */ + ORC_UNIQUE_PTR readLocalFile(const std::string& path); + + /** + * Create a reader to the for the ORC file. + * @param stream the stream to read + * @param options the options for reading the file + */ + ORC_UNIQUE_PTR createReader(ORC_UNIQUE_PTR stream, + const ReaderOptions& options); +} + +#endif http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/orc/Reader.hh ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/orc/Reader.hh b/depends/thirdparty/orc/c++/include/orc/Reader.hh new file mode 100644 index 0000000..fd2e708 --- /dev/null +++ b/depends/thirdparty/orc/c++/include/orc/Reader.hh @@ -0,0 +1,867 @@ +/** + * 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. + */ + +#ifndef ORC_READER_HH +#define ORC_READER_HH + +#include "orc/orc-config.hh" +#include "orc/Type.hh" +#include "orc/Vector.hh" + +#include +#include +#include + +namespace orc { + + // classes that hold data members so we can maintain binary compatibility + struct ReaderOptionsPrivate; + + enum CompressionKind { + CompressionKind_NONE = 0, + CompressionKind_ZLIB = 1, + CompressionKind_SNAPPY = 2, + CompressionKind_LZO = 3, + CompressionKind_LZ4 = 4, + CompressionKind_ZSTD = 5 + }; + + /** + * Get the name of the CompressionKind. + */ + std::string compressionKindToString(CompressionKind kind); + + enum WriterVersion { + WriterVersion_ORIGINAL = 0, + WriterVersion_HIVE_8732 = 1, + WriterVersion_HIVE_4243 = 2 + }; + + /** + * Get the name of the WriterVersion. + */ + std::string writerVersionToString(WriterVersion kind); + + /** + * Statistics that are available for all types of columns. + */ + class ColumnStatistics { + public: + virtual ~ColumnStatistics(); + + /** + * Get the number of values in this column. It will differ from the number + * of rows because of NULL values and repeated values. + * @return the number of values + */ + virtual uint64_t getNumberOfValues() const = 0; + + /** + * print out statistics of column if any + */ + virtual std::string toString() const = 0; + }; + + /** + * Statistics for binary columns. + */ + class BinaryColumnStatistics: public ColumnStatistics { + public: + virtual ~BinaryColumnStatistics(); + + /** + * check whether column has total length + * @return true if has total length + */ + virtual bool hasTotalLength() const = 0; + + virtual uint64_t getTotalLength() const = 0; + }; + + /** + * Statistics for boolean columns. + */ + class BooleanColumnStatistics: public ColumnStatistics { + public: + virtual ~BooleanColumnStatistics(); + + /** + * check whether column has true/false count + * @return true if has true/false count + */ + virtual bool hasCount() const = 0; + + virtual uint64_t getFalseCount() const = 0; + virtual uint64_t getTrueCount() const = 0; + }; + + /** + * Statistics for date columns. + */ + class DateColumnStatistics: public ColumnStatistics { + public: + virtual ~DateColumnStatistics(); + + /** + * check whether column has minimum + * @return true if has minimum + */ + virtual bool hasMinimum() const = 0; + + /** + * check whether column has maximum + * @return true if has maximum + */ + virtual bool hasMaximum() const = 0; + + /** + * Get the minimum value for the column. + * @return minimum value + */ + virtual int32_t getMinimum() const = 0; + + /** + * Get the maximum value for the column. + * @return maximum value + */ + virtual int32_t getMaximum() const = 0; + }; + + /** + * Statistics for decimal columns. + */ + class DecimalColumnStatistics: public ColumnStatistics { + public: + virtual ~DecimalColumnStatistics(); + + /** + * check whether column has minimum + * @return true if has minimum + */ + virtual bool hasMinimum() const = 0; + + /** + * check whether column has maximum + * @return true if has maximum + */ + virtual bool hasMaximum() const = 0; + + /** + * check whether column has sum + * @return true if has sum + */ + virtual bool hasSum() const = 0; + + /** + * Get the minimum value for the column. + * @return minimum value + */ + virtual Decimal getMinimum() const = 0; + + /** + * Get the maximum value for the column. + * @return maximum value + */ + virtual Decimal getMaximum() const = 0; + + /** + * Get the sum for the column. + * @return sum of all the values + */ + virtual Decimal getSum() const = 0; + }; + + /** + * Statistics for float and double columns. + */ + class DoubleColumnStatistics: public ColumnStatistics { + public: + virtual ~DoubleColumnStatistics(); + + /** + * check whether column has minimum + * @return true if has minimum + */ + virtual bool hasMinimum() const = 0; + + /** + * check whether column has maximum + * @return true if has maximum + */ + virtual bool hasMaximum() const = 0; + + /** + * check whether column has sum + * @return true if has sum + */ + virtual bool hasSum() const = 0; + + /** + * Get the smallest value in the column. Only defined if getNumberOfValues + * is non-zero. + * @return the minimum + */ + virtual double getMinimum() const = 0; + + /** + * Get the largest value in the column. Only defined if getNumberOfValues + * is non-zero. + * @return the maximum + */ + virtual double getMaximum() const = 0; + + /** + * Get the sum of the values in the column. + * @return the sum + */ + virtual double getSum() const = 0; + }; + + /** + * Statistics for all of the integer columns, such as byte, short, int, and + * long. + */ + class IntegerColumnStatistics: public ColumnStatistics { + public: + virtual ~IntegerColumnStatistics(); + + /** + * check whether column has minimum + * @return true if has minimum + */ + virtual bool hasMinimum() const = 0; + + /** + * check whether column has maximum + * @return true if has maximum + */ + virtual bool hasMaximum() const = 0; + + /** + * check whether column has sum + * @return true if has sum + */ + virtual bool hasSum() const = 0; + + /** + * Get the smallest value in the column. Only defined if getNumberOfValues + * is non-zero. + * @return the minimum + */ + virtual int64_t getMinimum() const = 0; + + /** + * Get the largest value in the column. Only defined if getNumberOfValues + * is non-zero. + * @return the maximum + */ + virtual int64_t getMaximum() const = 0; + + /** + * Get the sum of the column. Only valid if isSumDefined returns true. + * @return the sum of the column + */ + virtual int64_t getSum() const = 0; + }; + + /** + * Statistics for string columns. + */ + class StringColumnStatistics: public ColumnStatistics { + public: + virtual ~StringColumnStatistics(); + + /** + * check whether column has minimum + * @return true if has minimum + */ + virtual bool hasMinimum() const = 0; + + /** + * check whether column has maximum + * @return true if has maximum + */ + virtual bool hasMaximum() const = 0; + + /** + * check whether column + * @return true if has maximum + */ + virtual bool hasTotalLength() const = 0; + + /** + * Get the minimum value for the column. + * @return minimum value + */ + virtual std::string getMinimum() const = 0; + + /** + * Get the maximum value for the column. + * @return maximum value + */ + virtual std::string getMaximum() const = 0; + + /** + * Get the total length of all values. + * @return total length of all the values + */ + virtual uint64_t getTotalLength() const = 0; + }; + + /** + * Statistics for timestamp columns. + */ + class TimestampColumnStatistics: public ColumnStatistics { + public: + virtual ~TimestampColumnStatistics(); + + /** + * check whether column minimum + * @return true if has minimum + */ + virtual bool hasMinimum() const = 0; + + /** + * check whether column maximum + * @return true if has maximum + */ + virtual bool hasMaximum() const = 0; + + /** + * Get the minimum value for the column. + * @return minimum value + */ + virtual int64_t getMinimum() const = 0; + + /** + * Get the maximum value for the column. + * @return maximum value + */ + virtual int64_t getMaximum() const = 0; + }; + + enum StreamKind { + StreamKind_PRESENT = 0, + StreamKind_DATA = 1, + StreamKind_LENGTH = 2, + StreamKind_DICTIONARY_DATA = 3, + StreamKind_DICTIONARY_COUNT = 4, + StreamKind_SECONDARY = 5, + StreamKind_ROW_INDEX = 6, + StreamKind_BLOOM_FILTER = 7 + }; + + /** + * Get the string representation of the StreamKind. + */ + std::string streamKindToString(StreamKind kind); + + class StreamInformation { + public: + virtual ~StreamInformation(); + + virtual StreamKind getKind() const = 0; + virtual uint64_t getColumnId() const = 0; + virtual uint64_t getOffset() const = 0; + virtual uint64_t getLength() const = 0; + }; + + enum ColumnEncodingKind { + ColumnEncodingKind_DIRECT = 0, + ColumnEncodingKind_DICTIONARY = 1, + ColumnEncodingKind_DIRECT_V2 = 2, + ColumnEncodingKind_DICTIONARY_V2 = 3 + }; + + std::string columnEncodingKindToString(ColumnEncodingKind kind); + + class StripeInformation { + public: + virtual ~StripeInformation(); + + /** + * Get the byte offset of the start of the stripe. + * @return the bytes from the start of the file + */ + virtual uint64_t getOffset() const = 0; + + /** + * Get the total length of the stripe in bytes. + * @return the number of bytes in the stripe + */ + virtual uint64_t getLength() const = 0; + + /** + * Get the length of the stripe's indexes. + * @return the number of bytes in the index + */ + virtual uint64_t getIndexLength() const = 0; + + /** + * Get the length of the stripe's data. + * @return the number of bytes in the stripe + */ + virtual uint64_t getDataLength()const = 0; + + /** + * Get the length of the stripe's tail section, which contains its index. + * @return the number of bytes in the tail + */ + virtual uint64_t getFooterLength() const = 0; + + /** + * Get the number of rows in the stripe. + * @return a count of the number of rows + */ + virtual uint64_t getNumberOfRows() const = 0; + + /** + * Get the number of streams in the stripe. + */ + virtual uint64_t getNumberOfStreams() const = 0; + + /** + * Get the StreamInformation for the given stream. + */ + virtual ORC_UNIQUE_PTR + getStreamInformation(uint64_t streamId) const = 0; + + /** + * Get the column encoding for the given column. + * @param colId the columnId + */ + virtual ColumnEncodingKind getColumnEncoding(uint64_t colId) const = 0; + + /** + * Get the dictionary size. + * @param colId the columnId + * @return the size of the dictionary or 0 if there isn't one + */ + virtual uint64_t getDictionarySize(uint64_t colId) const = 0; + + /** + * Get the writer timezone. + */ + virtual const std::string& getWriterTimezone() const = 0; + }; + + class Statistics { + public: + virtual ~Statistics(); + + /** + * Get the statistics of colId column. + * @return one column's statistics + */ + virtual const ColumnStatistics* getColumnStatistics(uint32_t colId + ) const = 0; + + /** + * Get the number of columns + * @return the number of columns + */ + virtual uint32_t getNumberOfColumns() const = 0; + }; + + + /** + * Options for creating a Reader. + */ + class ReaderOptions { + private: + ORC_UNIQUE_PTR privateBits; + + public: + ReaderOptions(); + ReaderOptions(const ReaderOptions&); + ReaderOptions(ReaderOptions&); + ReaderOptions& operator=(const ReaderOptions&); + virtual ~ReaderOptions(); + + /** + * For files that have structs as the top-level object, select the fields + * to read. The first field is 0, the second 1, and so on. By default, + * all columns are read. This option clears any previous setting of + * the selected columns. + * @param include a list of fields to read + * @return this + */ + ReaderOptions& include(const std::list& include); + + /** + * For files that have structs as the top-level object, select the fields + * to read by name. By default, all columns are read. This option clears + * any previous setting of the selected columns. + * @param include a list of fields to read + * @return this + */ + ReaderOptions& include(const std::list& include); + + /** + * Set the section of the file to process. + * @param offset the starting byte offset + * @param length the number of bytes to read + * @return this + */ + ReaderOptions& range(uint64_t offset, uint64_t length); + + /** + * For Hive 0.11 (and 0.12) decimals, the precision was unlimited + * and thus may overflow the 38 digits that is supported. If one + * of the Hive 0.11 decimals is too large, the reader may either convert + * the value to NULL or throw an exception. That choice is controlled + * by this setting. + * + * Defaults to true. + * + * @param shouldThrow should the reader throw a ParseError? + * @return returns *this + */ + ReaderOptions& throwOnHive11DecimalOverflow(bool shouldThrow); + + /** + * For Hive 0.11 (and 0.12) written decimals, which have unlimited + * scale and precision, the reader forces the scale to a consistent + * number that is configured. This setting changes the scale that is + * forced upon these old decimals. See also throwOnHive11DecimalOverflow. + * + * Defaults to 6. + * + * @param forcedScale the scale that will be forced on Hive 0.11 decimals + * @return returns *this + */ + ReaderOptions& forcedScaleOnHive11Decimal(int32_t forcedScale); + + /** + * Set the location of the tail as defined by the logical length of the + * file. + */ + ReaderOptions& setTailLocation(uint64_t offset); + + /** + * Set the stream to use for printing warning or error messages. + */ + ReaderOptions& setErrorStream(std::ostream& stream); + + /** + * Open the file used a serialized copy of the file tail. + * + * When one process opens the file and other processes need to read + * the rows, we want to enable clients to just read the tail once. + * By passing the string returned by Reader.getSerializedFileTail(), to + * this function, the second reader will not need to read the file tail + * from disk. + * + * @param serialization the bytes of the serialized tail to use + */ + ReaderOptions& setSerializedFileTail(const std::string& serialization); + + /** + * Set the memory allocator. + */ + ReaderOptions& setMemoryPool(MemoryPool& pool); + + /** + * Were the include indexes set? + */ + bool getIndexesSet() const; + + /** + * Get the list of selected columns to read. All children of the selected + * columns are also selected. + */ + const std::list& getInclude() const; + + /** + * Were the include names set? + */ + bool getNamesSet() const; + + /** + * Get the list of selected columns to read. All children of the selected + * columns are also selected. + */ + const std::list& getIncludeNames() const; + + /** + * Get the start of the range for the data being processed. + * @return if not set, return 0 + */ + uint64_t getOffset() const; + + /** + * Get the end of the range for the data being processed. + * @return if not set, return the maximum long + */ + uint64_t getLength() const; + + /** + * Get the desired tail location. + * @return if not set, return the maximum long. + */ + uint64_t getTailLocation() const; + + /** + * Should the reader throw a ParseError when a Hive 0.11 decimal is + * larger than the supported 38 digits of precision? Otherwise, the + * data item is replaced by a NULL. + */ + bool getThrowOnHive11DecimalOverflow() const; + + /** + * What scale should all Hive 0.11 decimals be normalized to? + */ + int32_t getForcedScaleOnHive11Decimal() const; + + /** + * Get the stream to write warnings or errors to. + */ + std::ostream* getErrorStream() const; + + /** + * Get the memory allocator. + */ + MemoryPool* getMemoryPool() const; + + /** + * Get the serialized file tail that the user passed in. + */ + std::string getSerializedFileTail() const; + }; + + /** + * The interface for reading ORC files. + * This is an an abstract class that will subclassed as necessary. + */ + class Reader { + public: + virtual ~Reader(); + + /** + * Get the format version of the file. Currently known values are: + * "0.11" and "0.12" + * @return the version string + */ + virtual std::string getFormatVersion() const = 0; + + /** + * Get the number of rows in the file. + * @return the number of rows + */ + virtual uint64_t getNumberOfRows() const = 0; + + /** + * Get the user metadata keys. + * @return the set of metadata keys + */ + virtual std::list getMetadataKeys() const = 0; + + /** + * Get a user metadata value. + * @param key a key given by the user + * @return the bytes associated with the given key + */ + virtual std::string getMetadataValue(const std::string& key) const = 0; + + /** + * Did the user set the given metadata value. + * @param key the key to check + * @return true if the metadata value was set + */ + virtual bool hasMetadataValue(const std::string& key) const = 0; + + /** + * Get the compression kind. + * @return the kind of compression in the file + */ + virtual CompressionKind getCompression() const = 0; + + /** + * Get the buffer size for the compression. + * @return number of bytes to buffer for the compression codec. + */ + virtual uint64_t getCompressionSize() const = 0; + + /** + * Get the version of the writer. + * @return the version of the writer. + */ + virtual WriterVersion getWriterVersion() const = 0; + + /** + * Get the number of rows per a entry in the row index. + * @return the number of rows per an entry in the row index or 0 if there + * is no row index. + */ + virtual uint64_t getRowIndexStride() const = 0; + + /** + * Get the number of stripes in the file. + * @return the number of stripes + */ + virtual uint64_t getNumberOfStripes() const = 0; + + /** + * Get the information about a stripe. + * @param stripeIndex the stripe 0 to N-1 to get information about + * @return the information about that stripe + */ + virtual ORC_UNIQUE_PTR + getStripe(uint64_t stripeIndex) const = 0; + + /** + * Get the number of stripe statistics in the file. + * @return the number of stripe statistics + */ + virtual uint64_t getNumberOfStripeStatistics() const = 0; + + /** + * Get the statistics about a stripe. + * @param stripeIndex the stripe 0 to N-1 to get statistics about + * @return the statistics about that stripe + */ + virtual ORC_UNIQUE_PTR + getStripeStatistics(uint64_t stripeIndex) const = 0; + + /** + * Get the length of the data stripes in the file. + * @return the number of bytes in stripes + */ + virtual uint64_t getContentLength() const = 0; + + /** + * Get the length of the file stripe statistics + * @return the number of compressed bytes in the file stripe statistics + */ + virtual uint64_t getStripeStatisticsLength() const = 0; + + /** + * Get the length of the file footer + * @return the number of compressed bytes in the file footer + */ + virtual uint64_t getFileFooterLength() const = 0; + + /** + * Get the length of the file postscript + * @return the number of bytes in the file postscript + */ + virtual uint64_t getFilePostscriptLength() const = 0; + + /** + * Get the total length of the file. + * @return the number of bytes in the file + */ + virtual uint64_t getFileLength() const = 0; + + /** + * Get the statistics about the columns in the file. + * @return the information about the column + */ + virtual ORC_UNIQUE_PTR getStatistics() const = 0; + + /** + * Get the statistics about a single column in the file. + * @return the information about the column + */ + virtual ORC_UNIQUE_PTR + getColumnStatistics(uint32_t columnId) const = 0; + + /** + * Get the type of the rows in the file. The top level is typically a + * struct. + * @return the root type + */ + virtual const Type& getType() const = 0; + + /** + * Get the selected type of the rows in the file. The file's row type + * is projected down to just the selected columns. Thus, if the file's + * type is struct and the selected + * columns are "col0,col2" the selected type would be + * struct. + * @return the root type + */ + virtual const Type& getSelectedType() const = 0; + + /** + * Get the selected columns of the file. + */ + virtual const std::vector getSelectedColumns() const = 0; + + /** + * Create a row batch for reading the selected columns of this file. + * @param size the number of rows to read + * @return a new ColumnVectorBatch to read into + */ + virtual ORC_UNIQUE_PTR createRowBatch(uint64_t size + ) const = 0; + + /** + * Read the next row batch from the current position. + * Caller must look at numElements in the row batch to determine how + * many rows were read. + * @param data the row batch to read into. + * @return true if a non-zero number of rows were read or false if the + * end of the file was reached. + */ + virtual bool next(ColumnVectorBatch& data) = 0; + + /** + * Get the row number of the first row in the previously read batch. + * @return the row number of the previous batch. + */ + virtual uint64_t getRowNumber() const = 0; + + /** + * Seek to a given row. + * @param rowNumber the next row the reader should return + */ + virtual void seekToRow(uint64_t rowNumber) = 0; + + /** + * Get the name of the input stream. + */ + virtual const std::string& getStreamName() const = 0; + + /** + * check file has correct column statistics + */ + virtual bool hasCorrectStatistics() const = 0; + + /** + * Get the serialized file tail. + * Usefull if another reader of the same file wants to avoid re-reading + * the file tail. See ReaderOptions.setSerializedFileTail(). + * @return a string of bytes with the file tail + */ + virtual std::string getSerializedFileTail() const = 0; + + /** + * Estimate an upper bound on heap memory allocation by the Reader + * based on the information in the file footer. + * The bound is less tight if only few columns are read or compression is + * used. + * @param stripeIx index of the stripe to be read (if not specified, + * all stripes are considered). + * @return upper bound on memory use + */ + virtual uint64_t getMemoryUse(int stripeIx=-1) = 0; + }; +} + +#endif http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/orc/Type.hh ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/orc/Type.hh b/depends/thirdparty/orc/c++/include/orc/Type.hh new file mode 100644 index 0000000..25b8f53 --- /dev/null +++ b/depends/thirdparty/orc/c++/include/orc/Type.hh @@ -0,0 +1,105 @@ +/** + * 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. + */ + +#ifndef ORC_TYPE_HH +#define ORC_TYPE_HH + +#include "orc/orc-config.hh" +#include "orc/Vector.hh" +#include "MemoryPool.hh" + +namespace orc { + + enum TypeKind { + BOOLEAN = 0, + BYTE = 1, + SHORT = 2, + INT = 3, + LONG = 4, + FLOAT = 5, + DOUBLE = 6, + STRING = 7, + BINARY = 8, + TIMESTAMP = 9, + LIST = 10, + MAP = 11, + STRUCT = 12, + UNION = 13, + DECIMAL = 14, + DATE = 15, + VARCHAR = 16, + CHAR = 17 + }; + + class Type { + public: + virtual ~Type(); + virtual uint64_t getColumnId() const = 0; + virtual uint64_t getMaximumColumnId() const = 0; + virtual TypeKind getKind() const = 0; + virtual uint64_t getSubtypeCount() const = 0; + virtual const Type* getSubtype(uint64_t childId) const = 0; + virtual const std::string& getFieldName(uint64_t childId) const = 0; + virtual uint64_t getMaximumLength() const = 0; + virtual uint64_t getPrecision() const = 0; + virtual uint64_t getScale() const = 0; + virtual std::string toString() const = 0; + + /** + * Create a row batch for this type. + */ + virtual ORC_UNIQUE_PTR createRowBatch(uint64_t size, + MemoryPool& pool + ) const = 0; + + /** + * Add a new field to a struct type. + * @param fieldName the name of the new field + * @param fieldType the type of the new field + * @return a reference to the struct type + */ + virtual Type* addStructField(const std::string& fieldName, + ORC_UNIQUE_PTR fieldType) = 0; + + /** + * Add a new child to a union type. + * @param fieldType the type of the new field + * @return a reference to the union type + */ + virtual Type* addUnionChild(ORC_UNIQUE_PTR fieldType) = 0; + }; + + const int64_t DEFAULT_DECIMAL_SCALE = 18; + const int64_t DEFAULT_DECIMAL_PRECISION = 38; + + ORC_UNIQUE_PTR createPrimitiveType(TypeKind kind); + ORC_UNIQUE_PTR createCharType(TypeKind kind, + uint64_t maxLength); + ORC_UNIQUE_PTR + createDecimalType(uint64_t precision= + DEFAULT_DECIMAL_PRECISION, + uint64_t scale=DEFAULT_DECIMAL_SCALE); + + ORC_UNIQUE_PTR createStructType(); + ORC_UNIQUE_PTR createListType(ORC_UNIQUE_PTR elements); + ORC_UNIQUE_PTR createMapType(ORC_UNIQUE_PTR key, + ORC_UNIQUE_PTR value); + ORC_UNIQUE_PTR createUnionType(); + +} +#endif http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/orc/Vector.hh ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/orc/Vector.hh b/depends/thirdparty/orc/c++/include/orc/Vector.hh new file mode 100644 index 0000000..8f6a0da --- /dev/null +++ b/depends/thirdparty/orc/c++/include/orc/Vector.hh @@ -0,0 +1,266 @@ +/** + * 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. + */ + +#ifndef ORC_VECTOR_HH +#define ORC_VECTOR_HH + +#include "orc/orc-config.hh" +#include "MemoryPool.hh" +#include "Int128.hh" + +#include +#include +#include +#include +#include +#include +#include + +namespace orc { + + /** + * The base class for each of the column vectors. This class handles + * the generic attributes such as number of elements, capacity, and + * notNull vector. + */ + struct ColumnVectorBatch { + ColumnVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~ColumnVectorBatch(); + + // the number of slots available + uint64_t capacity; + // the number of current occupied slots + uint64_t numElements; + // an array of capacity length marking non-null values + DataBuffer notNull; + // whether there are any null values + bool hasNulls; + + // custom memory pool + MemoryPool& memoryPool; + + /** + * Generate a description of this vector as a string. + */ + virtual std::string toString() const = 0; + + /** + * Change the number of slots to at least the given capacity. + * This function is not recursive into subtypes. + */ + virtual void resize(uint64_t capacity); + + /** + * Heap memory used by the batch. + */ + virtual uint64_t getMemoryUsage(); + + /** + * Check whether the batch length varies depending on data. + */ + virtual bool hasVariableLength(); + + private: + ColumnVectorBatch(const ColumnVectorBatch&); + ColumnVectorBatch& operator=(const ColumnVectorBatch&); + }; + + struct LongVectorBatch: public ColumnVectorBatch { + LongVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~LongVectorBatch(); + + DataBuffer data; + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + }; + + struct DoubleVectorBatch: public ColumnVectorBatch { + DoubleVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~DoubleVectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + + DataBuffer data; + }; + + struct StringVectorBatch: public ColumnVectorBatch { + StringVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~StringVectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + + // pointers to the start of each string + DataBuffer data; + // the length of each string + DataBuffer length; + }; + + struct StructVectorBatch: public ColumnVectorBatch { + StructVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~StructVectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + bool hasVariableLength(); + + std::vector fields; + }; + + struct ListVectorBatch: public ColumnVectorBatch { + ListVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~ListVectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + bool hasVariableLength(); + + /** + * The offset of the first element of each list. + * The length of list i is startOffset[i+1] - startOffset[i]. + */ + DataBuffer offsets; + + // the concatenated elements + ORC_UNIQUE_PTR elements; + }; + + struct MapVectorBatch: public ColumnVectorBatch { + MapVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~MapVectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + bool hasVariableLength(); + + /** + * The offset of the first element of each list. + * The length of list i is startOffset[i+1] - startOffset[i]. + */ + DataBuffer offsets; + + // the concatenated keys + ORC_UNIQUE_PTR keys; + // the concatenated elements + ORC_UNIQUE_PTR elements; + }; + + struct UnionVectorBatch: public ColumnVectorBatch { + UnionVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~UnionVectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + bool hasVariableLength(); + + /** + * For each value, which element of children has the value. + */ + DataBuffer tags; + + /** + * For each value, the index inside of the child ColumnVectorBatch. + */ + DataBuffer offsets; + + // the sub-columns + std::vector children; + }; + + struct Decimal { + Decimal(const Int128& value, int32_t scale); + explicit Decimal(const std::string& value); + + std::string toString() const; + Int128 value; + int32_t scale; + }; + + struct Decimal64VectorBatch: public ColumnVectorBatch { + Decimal64VectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~Decimal64VectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + + // total number of digits + int32_t precision; + // the number of places after the decimal + int32_t scale; + + // the numeric values + DataBuffer values; + + protected: + /** + * Contains the scales that were read from the file. Should NOT be + * used. + */ + DataBuffer readScales; + friend class Decimal64ColumnReader; + }; + + struct Decimal128VectorBatch: public ColumnVectorBatch { + Decimal128VectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~Decimal128VectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + + // total number of digits + int32_t precision; + // the number of places after the decimal + int32_t scale; + + // the numeric values + DataBuffer values; + + protected: + /** + * Contains the scales that were read from the file. Should NOT be + * used. + */ + DataBuffer readScales; + friend class Decimal128ColumnReader; + friend class DecimalHive11ColumnReader; + }; + + /** + * A column vector batch for storing timestamp values. + * The timestamps are stored split into the time_t value (seconds since + * 1 Jan 1970 00:00:00) and the nanoseconds within the time_t value. + */ + struct TimestampVectorBatch: public ColumnVectorBatch { + TimestampVectorBatch(uint64_t capacity, MemoryPool& pool); + virtual ~TimestampVectorBatch(); + std::string toString() const; + void resize(uint64_t capacity); + uint64_t getMemoryUsage(); + + // the number of seconds past 1 Jan 1970 00:00 UTC (aka time_t) + DataBuffer data; + + // the nanoseconds of each value + DataBuffer nanoseconds; + }; + +} + +#endif http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/include/orc/orc-config.hh.in ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/include/orc/orc-config.hh.in b/depends/thirdparty/orc/c++/include/orc/orc-config.hh.in new file mode 100644 index 0000000..56db946 --- /dev/null +++ b/depends/thirdparty/orc/c++/include/orc/orc-config.hh.in @@ -0,0 +1,78 @@ +/* + * Licensed 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. + */ + +#ifndef ORC_CONFIG_HH +#define ORC_CONFIG_HH + +#define ORC_VERSION "@ORC_VERSION@" + +#cmakedefine ORC_CXX_HAS_CSTDINT +#cmakedefine ORC_CXX_HAS_INITIALIZER_LIST +#cmakedefine ORC_CXX_HAS_NOEXCEPT +#cmakedefine ORC_CXX_HAS_NULLPTR +#cmakedefine ORC_CXX_HAS_OVERRIDE +#cmakedefine ORC_CXX_HAS_UNIQUE_PTR + +#ifdef ORC_CXX_HAS_CSTDINT + #include +#else + #include +#endif + +#ifdef ORC_CXX_HAS_NOEXCEPT + #define ORC_NOEXCEPT noexcept +#else + #define ORC_NOEXCEPT throw () +#endif + +#ifdef ORC_CXX_HAS_NULLPTR + #define ORC_NULLPTR nullptr +#else + namespace orc { + class nullptr_t { + public: + template + operator T*() const { + return 0; + } + + template + operator T C::*() const { + return 0; + } + private: + void operator&() const; // whose address can't be taken + }; + const nullptr_t nullptr = {}; + } + #define ORC_NULLPTR orc::nullptr +#endif + +#ifdef ORC_CXX_HAS_OVERRIDE + #define ORC_OVERRIDE override +#else + #define ORC_OVERRIDE +#endif + +#ifdef ORC_CXX_HAS_UNIQUE_PTR + #define ORC_UNIQUE_PTR std::unique_ptr +#else + #define ORC_UNIQUE_PTR std::auto_ptr + namespace std { + template + inline T move(T& x) { return x; } + } +#endif + +#endif http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/libs/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/libs/CMakeLists.txt b/depends/thirdparty/orc/c++/libs/CMakeLists.txt new file mode 100644 index 0000000..7d8fa22 --- /dev/null +++ b/depends/thirdparty/orc/c++/libs/CMakeLists.txt @@ -0,0 +1,16 @@ +# Licensed 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. + +add_subdirectory(gmock-${GMOCK_VERSION}) +add_subdirectory(zlib-${ZLIB_VERSION}) +add_subdirectory(protobuf-${PROTOBUF_VERSION}) +add_subdirectory(snappy-${SNAPPY_VERSION}) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CHANGES ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CHANGES b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CHANGES new file mode 100644 index 0000000..d6f2f76 --- /dev/null +++ b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CHANGES @@ -0,0 +1,126 @@ +Changes for 1.7.0: + +* All new improvements in Google Test 1.7.0. +* New feature: matchers DoubleNear(), FloatNear(), + NanSensitiveDoubleNear(), NanSensitiveFloatNear(), + UnorderedElementsAre(), UnorderedElementsAreArray(), WhenSorted(), + WhenSortedBy(), IsEmpty(), and SizeIs(). +* Improvement: Google Mock can now be built as a DLL. +* Improvement: when compiled by a C++11 compiler, matchers AllOf() + and AnyOf() can accept an arbitrary number of matchers. +* Improvement: when compiled by a C++11 compiler, matchers + ElementsAreArray() can accept an initializer list. +* Improvement: when exceptions are enabled, a mock method with no + default action now throws instead crashing the test. +* Improvement: added class testing::StringMatchResultListener to aid + definition of composite matchers. +* Improvement: function return types used in MOCK_METHOD*() macros can + now contain unprotected commas. +* Improvement (potentially breaking): EXPECT_THAT() and ASSERT_THAT() + are now more strict in ensuring that the value type and the matcher + type are compatible, catching potential bugs in tests. +* Improvement: Pointee() now works on an optional. +* Improvement: the ElementsAreArray() matcher can now take a vector or + iterator range as input, and makes a copy of its input elements + before the conversion to a Matcher. +* Improvement: the Google Mock Generator can now generate mocks for + some class templates. +* Bug fix: mock object destruction triggerred by another mock object's + destruction no longer hangs. +* Improvement: Google Mock Doctor works better with newer Clang and + GCC now. +* Compatibility fixes. +* Bug/warning fixes. + +Changes for 1.6.0: + +* Compilation is much faster and uses much less memory, especially + when the constructor and destructor of a mock class are moved out of + the class body. +* New matchers: Pointwise(), Each(). +* New actions: ReturnPointee() and ReturnRefOfCopy(). +* CMake support. +* Project files for Visual Studio 2010. +* AllOf() and AnyOf() can handle up-to 10 arguments now. +* Google Mock doctor understands Clang error messages now. +* SetArgPointee<> now accepts string literals. +* gmock_gen.py handles storage specifier macros and template return + types now. +* Compatibility fixes. +* Bug fixes and implementation clean-ups. +* Potentially incompatible changes: disables the harmful 'make install' + command in autotools. + +Potentially breaking changes: + +* The description string for MATCHER*() changes from Python-style + interpolation to an ordinary C++ string expression. +* SetArgumentPointee is deprecated in favor of SetArgPointee. +* Some non-essential project files for Visual Studio 2005 are removed. + +Changes for 1.5.0: + + * New feature: Google Mock can be safely used in multi-threaded tests + on platforms having pthreads. + * New feature: function for printing a value of arbitrary type. + * New feature: function ExplainMatchResult() for easy definition of + composite matchers. + * The new matcher API lets user-defined matchers generate custom + explanations more directly and efficiently. + * Better failure messages all around. + * NotNull() and IsNull() now work with smart pointers. + * Field() and Property() now work when the matcher argument is a pointer + passed by reference. + * Regular expression matchers on all platforms. + * Added GCC 4.0 support for Google Mock Doctor. + * Added gmock_all_test.cc for compiling most Google Mock tests + in a single file. + * Significantly cleaned up compiler warnings. + * Bug fixes, better test coverage, and implementation clean-ups. + + Potentially breaking changes: + + * Custom matchers defined using MatcherInterface or MakePolymorphicMatcher() + need to be updated after upgrading to Google Mock 1.5.0; matchers defined + using MATCHER or MATCHER_P* aren't affected. + * Dropped support for 'make install'. + +Changes for 1.4.0 (we skipped 1.2.* and 1.3.* to match the version of +Google Test): + + * Works in more environments: Symbian and minGW, Visual C++ 7.1. + * Lighter weight: comes with our own implementation of TR1 tuple (no + more dependency on Boost!). + * New feature: --gmock_catch_leaked_mocks for detecting leaked mocks. + * New feature: ACTION_TEMPLATE for defining templatized actions. + * New feature: the .After() clause for specifying expectation order. + * New feature: the .With() clause for for specifying inter-argument + constraints. + * New feature: actions ReturnArg(), ReturnNew(...), and + DeleteArg(). + * New feature: matchers Key(), Pair(), Args<...>(), AllArgs(), IsNull(), + and Contains(). + * New feature: utility class MockFunction, useful for checkpoints, etc. + * New feature: functions Value(x, m) and SafeMatcherCast(m). + * New feature: copying a mock object is rejected at compile time. + * New feature: a script for fusing all Google Mock and Google Test + source files for easy deployment. + * Improved the Google Mock doctor to diagnose more diseases. + * Improved the Google Mock generator script. + * Compatibility fixes for Mac OS X and gcc. + * Bug fixes and implementation clean-ups. + +Changes for 1.1.0: + + * New feature: ability to use Google Mock with any testing framework. + * New feature: macros for easily defining new matchers + * New feature: macros for easily defining new actions. + * New feature: more container matchers. + * New feature: actions for accessing function arguments and throwing + exceptions. + * Improved the Google Mock doctor script for diagnosing compiler errors. + * Bug fixes and implementation clean-ups. + +Changes for 1.0.0: + + * Initial Open Source release of Google Mock http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CMakeLists.txt b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CMakeLists.txt new file mode 100644 index 0000000..9453dff --- /dev/null +++ b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CMakeLists.txt @@ -0,0 +1,165 @@ +######################################################################## +# CMake build script for Google Mock. +# +# To run the tests for Google Mock itself on Linux, use 'make test' or +# ctest. You can select which tests to run using 'ctest -R regex'. +# For more options, run 'ctest --help'. + +# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to +# make it prominent in the GUI. +option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) + +option(gmock_build_tests "Build all of Google Mock's own tests." OFF) + +# A directory to find Google Test sources. +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt") + set(gtest_dir gtest) +else() + set(gtest_dir ../gtest) +endif() + +# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). +include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL) + +if (COMMAND pre_project_set_up_hermetic_build) + # Google Test also calls hermetic setup functions from add_subdirectory, + # although its changes will not affect things at the current scope. + pre_project_set_up_hermetic_build() +endif() + +######################################################################## +# +# Project-wide settings + +# Name of the project. +# +# CMake files in this project can refer to the root source directory +# as ${gmock_SOURCE_DIR} and to the root binary directory as +# ${gmock_BINARY_DIR}. +# Language "C" is required for find_package(Threads). +project(gmock CXX C) +cmake_minimum_required(VERSION 2.6.2) + +if (COMMAND set_up_hermetic_build) + set_up_hermetic_build() +endif() + +# Instructs CMake to process Google Test's CMakeLists.txt and add its +# targets to the current scope. We are placing Google Test's binary +# directory in a subdirectory of our own as VC compilation may break +# if they are the same (the default). +add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest") + +# Although Google Test's CMakeLists.txt calls this function, the +# changes there don't affect the current scope. Therefore we have to +# call it again here. +config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake + +# Adds Google Mock's and Google Test's header directories to the search path. +include_directories("${gmock_SOURCE_DIR}/include" + "${gmock_SOURCE_DIR}" + "${gtest_SOURCE_DIR}/include" + # This directory is needed to build directly from Google + # Test sources. + "${gtest_SOURCE_DIR}") + +######################################################################## +# +# Defines the gmock & gmock_main libraries. User tests should link +# with one of them. + +# Google Mock libraries. We build them using more strict warnings than what +# are used for other targets, to ensure that Google Mock can be compiled by +# a user aggressive about warnings. +cxx_library(gmock + "${cxx_strict}" + "${gtest_dir}/src/gtest-all.cc" + src/gmock-all.cc) + +######################################################################## +# +# Google Mock's own tests. +# +# You can skip this section if you aren't interested in testing +# Google Mock itself. +# +# The tests are not built by default. To build them, set the +# gmock_build_tests option to ON. You can do it by running ccmake +# or specifying the -Dgmock_build_tests=ON flag when running cmake. + +if (gmock_build_tests) + # This must be set in the root directory for the tests to be run by + # 'make test' or ctest. + enable_testing() + + ############################################################ + # C++ tests built with standard compiler flags. + + cxx_test(gmock-actions_test gmock_main) + cxx_test(gmock-cardinalities_test gmock_main) + cxx_test(gmock_ex_test gmock_main) + cxx_test(gmock-generated-actions_test gmock_main) + cxx_test(gmock-generated-function-mockers_test gmock_main) + cxx_test(gmock-generated-internal-utils_test gmock_main) + cxx_test(gmock-generated-matchers_test gmock_main) + cxx_test(gmock-internal-utils_test gmock_main) + cxx_test(gmock-matchers_test gmock_main) + cxx_test(gmock-more-actions_test gmock_main) + cxx_test(gmock-nice-strict_test gmock_main) + cxx_test(gmock-port_test gmock_main) + cxx_test(gmock-spec-builders_test gmock_main) + cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc) + cxx_test(gmock_test gmock_main) + + if (CMAKE_USE_PTHREADS_INIT) + cxx_test(gmock_stress_test gmock) + endif() + + # gmock_all_test is commented to save time building and running tests. + # Uncomment if necessary. + # cxx_test(gmock_all_test gmock_main) + + ############################################################ + # C++ tests built with non-standard compiler flags. + + cxx_library(gmock_main_no_exception "${cxx_no_exception}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" + gmock_main_no_exception test/gmock-more-actions_test.cc) + + cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}" + gmock_main_no_rtti test/gmock-spec-builders_test.cc) + + cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}" + gmock_main_use_own_tuple test/gmock-spec-builders_test.cc) + + cxx_shared_library(shared_gmock_main "${cxx_default}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + # Tests that a binary can be built with Google Mock as a shared library. On + # some system configurations, it may not possible to run the binary without + # knowing more details about the system configurations. We do not try to run + # this binary. To get a more robust shared library coverage, configure with + # -DBUILD_SHARED_LIBS=ON. + cxx_executable_with_flags(shared_gmock_test_ "${cxx_default}" + shared_gmock_main test/gmock-spec-builders_test.cc) + set_target_properties(shared_gmock_test_ + PROPERTIES + COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") + + ############################################################ + # Python tests. + + cxx_executable(gmock_leak_test_ test gmock_main) + py_test(gmock_leak_test) + + cxx_executable(gmock_output_test_ test gmock) + py_test(gmock_output_test) +endif() http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CONTRIBUTORS ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CONTRIBUTORS b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CONTRIBUTORS new file mode 100644 index 0000000..6e9ae36 --- /dev/null +++ b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/CONTRIBUTORS @@ -0,0 +1,40 @@ +# This file contains a list of people who've made non-trivial +# contribution to the Google C++ Mocking Framework project. People +# who commit code to the project are encouraged to add their names +# here. Please keep the list sorted by first names. + +Benoit Sigoure +Bogdan Piloca +Chandler Carruth +Dave MacLachlan +David Anderson +Dean Sturtevant +Gene Volovich +Hal Burch +Jeffrey Yasskin +Jim Keller +Joe Walnes +Jon Wray +Keir Mierle +Keith Ray +Kostya Serebryany +Lev Makhlis +Manuel Klimek +Mario Tanev +Mark Paskin +Markus Heule +Matthew Simmons +Mike Bland +Neal Norwitz +Nermin Ozkiranartli +Owen Carlsen +Paneendra Ba +Paul Menage +Piotr Kaminski +Russ Rufer +Sverre Sundsdal +Takeshi Yoshino +Vadim Berman +Vlad Losev +Wolfgang Klier +Zhanyong Wan http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/libs/gmock-1.7.0/LICENSE ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/libs/gmock-1.7.0/LICENSE b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/LICENSE new file mode 100644 index 0000000..1941a11 --- /dev/null +++ b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/LICENSE @@ -0,0 +1,28 @@ +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b93df00/depends/thirdparty/orc/c++/libs/gmock-1.7.0/Makefile.am ---------------------------------------------------------------------- diff --git a/depends/thirdparty/orc/c++/libs/gmock-1.7.0/Makefile.am b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/Makefile.am new file mode 100644 index 0000000..0eb7bd8 --- /dev/null +++ b/depends/thirdparty/orc/c++/libs/gmock-1.7.0/Makefile.am @@ -0,0 +1,216 @@ +# Automake file + +# Nonstandard package files for distribution. +EXTRA_DIST = LICENSE + +# We may need to build our internally packaged gtest. If so, it will be +# included in the 'subdirs' variable. +SUBDIRS = $(subdirs) + +# This is generated by the configure script, so clean it for distribution. +DISTCLEANFILES = scripts/gmock-config + +# We define the global AM_CPPFLAGS as everything we compile includes from these +# directories. +AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I$(srcdir)/include + +# Modifies compiler and linker flags for pthreads compatibility. +if HAVE_PTHREADS + AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1 + AM_LIBS = @PTHREAD_LIBS@ +endif + +# Build rules for libraries. +lib_LTLIBRARIES = lib/libgmock.la lib/libgmock_main.la + +lib_libgmock_la_SOURCES = src/gmock-all.cc + +pkginclude_HEADERS = \ + include/gmock/gmock-actions.h \ + include/gmock/gmock-cardinalities.h \ + include/gmock/gmock-generated-actions.h \ + include/gmock/gmock-generated-function-mockers.h \ + include/gmock/gmock-generated-matchers.h \ + include/gmock/gmock-generated-nice-strict.h \ + include/gmock/gmock-matchers.h \ + include/gmock/gmock-more-actions.h \ + include/gmock/gmock-more-matchers.h \ + include/gmock/gmock-spec-builders.h \ + include/gmock/gmock.h + +pkginclude_internaldir = $(pkgincludedir)/internal +pkginclude_internal_HEADERS = \ + include/gmock/internal/gmock-generated-internal-utils.h \ + include/gmock/internal/gmock-internal-utils.h \ + include/gmock/internal/gmock-port.h + +lib_libgmock_main_la_SOURCES = src/gmock_main.cc +lib_libgmock_main_la_LIBADD = lib/libgmock.la + +# Build rules for tests. Automake's naming for some of these variables isn't +# terribly obvious, so this is a brief reference: +# +# TESTS -- Programs run automatically by "make check" +# check_PROGRAMS -- Programs built by "make check" but not necessarily run + +TESTS= +check_PROGRAMS= +AM_LDFLAGS = $(GTEST_LDFLAGS) + +# This exercises all major components of Google Mock. It also +# verifies that libgmock works. +TESTS += test/gmock-spec-builders_test +check_PROGRAMS += test/gmock-spec-builders_test +test_gmock_spec_builders_test_SOURCES = test/gmock-spec-builders_test.cc +test_gmock_spec_builders_test_LDADD = $(GTEST_LIBS) lib/libgmock.la + +# This tests using Google Mock in multiple translation units. It also +# verifies that libgmock_main and libgmock work. +TESTS += test/gmock_link_test +check_PROGRAMS += test/gmock_link_test +test_gmock_link_test_SOURCES = \ + test/gmock_link2_test.cc \ + test/gmock_link_test.cc \ + test/gmock_link_test.h +test_gmock_link_test_LDADD = $(GTEST_LIBS) lib/libgmock_main.la lib/libgmock.la + +if HAVE_PYTHON + # Tests that fused gmock files compile and work. + TESTS += test/gmock_fused_test + check_PROGRAMS += test/gmock_fused_test + test_gmock_fused_test_SOURCES = \ + fused-src/gmock-gtest-all.cc \ + fused-src/gmock/gmock.h \ + fused-src/gmock_main.cc \ + fused-src/gtest/gtest.h \ + test/gmock_test.cc + test_gmock_fused_test_CPPFLAGS = -I"$(srcdir)/fused-src" +endif + +# Google Mock source files that we don't compile directly. +GMOCK_SOURCE_INGLUDES = \ + src/gmock-cardinalities.cc \ + src/gmock-internal-utils.cc \ + src/gmock-matchers.cc \ + src/gmock-spec-builders.cc \ + src/gmock.cc + +EXTRA_DIST += $(GMOCK_SOURCE_INGLUDES) + +# C++ tests that we don't compile using autotools. +EXTRA_DIST += \ + test/gmock-actions_test.cc \ + test/gmock_all_test.cc \ + test/gmock-cardinalities_test.cc \ + test/gmock_ex_test.cc \ + test/gmock-generated-actions_test.cc \ + test/gmock-generated-function-mockers_test.cc \ + test/gmock-generated-internal-utils_test.cc \ + test/gmock-generated-matchers_test.cc \ + test/gmock-internal-utils_test.cc \ + test/gmock-matchers_test.cc \ + test/gmock-more-actions_test.cc \ + test/gmock-nice-strict_test.cc \ + test/gmock-port_test.cc \ + test/gmock_stress_test.cc + +# Python tests, which we don't run using autotools. +EXTRA_DIST += \ + test/gmock_leak_test.py \ + test/gmock_leak_test_.cc \ + test/gmock_output_test.py \ + test/gmock_output_test_.cc \ + test/gmock_output_test_golden.txt \ + test/gmock_test_utils.py + +# Nonstandard package files for distribution. +EXTRA_DIST += \ + CHANGES \ + CONTRIBUTORS \ + make/Makefile + +# Pump scripts for generating Google Mock headers. +# TODO(chandlerc@google.com): automate the generation of *.h from *.h.pump. +EXTRA_DIST += \ + include/gmock/gmock-generated-actions.h.pump \ + include/gmock/gmock-generated-function-mockers.h.pump \ + include/gmock/gmock-generated-matchers.h.pump \ + include/gmock/gmock-generated-nice-strict.h.pump \ + include/gmock/internal/gmock-generated-internal-utils.h.pump + +# Script for fusing Google Mock and Google Test source files. +EXTRA_DIST += scripts/fuse_gmock_files.py + +# The Google Mock Generator tool from the cppclean project. +EXTRA_DIST += \ + scripts/generator/LICENSE \ + scripts/generator/README \ + scripts/generator/README.cppclean \ + scripts/generator/cpp/__init__.py \ + scripts/generator/cpp/ast.py \ + scripts/generator/cpp/gmock_class.py \ + scripts/generator/cpp/keywords.py \ + scripts/generator/cpp/tokenize.py \ + scripts/generator/cpp/utils.py \ + scripts/generator/gmock_gen.py + +# CMake scripts. +EXTRA_DIST += \ + CMakeLists.txt + +# Microsoft Visual Studio 2005 projects. +EXTRA_DIST += \ + msvc/2005/gmock.sln \ + msvc/2005/gmock.vcproj \ + msvc/2005/gmock_config.vsprops \ + msvc/2005/gmock_main.vcproj \ + msvc/2005/gmock_test.vcproj + +# Microsoft Visual Studio 2010 projects. +EXTRA_DIST += \ + msvc/2010/gmock.sln \ + msvc/2010/gmock.vcxproj \ + msvc/2010/gmock_config.props \ + msvc/2010/gmock_main.vcxproj \ + msvc/2010/gmock_test.vcxproj + +if HAVE_PYTHON +# gmock_test.cc does not really depend on files generated by the +# fused-gmock-internal rule. However, gmock_test.o does, and it is +# important to include test/gmock_test.cc as part of this rule in order to +# prevent compiling gmock_test.o until all dependent files have been +# generated. +$(test_gmock_fused_test_SOURCES): fused-gmock-internal + +# TODO(vladl@google.com): Find a way to add Google Tests's sources here. +fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \ + $(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \ + $(lib_libgmock_main_la_SOURCES) \ + scripts/fuse_gmock_files.py + mkdir -p "$(srcdir)/fused-src" + chmod -R u+w "$(srcdir)/fused-src" + rm -f "$(srcdir)/fused-src/gtest/gtest.h" + rm -f "$(srcdir)/fused-src/gmock/gmock.h" + rm -f "$(srcdir)/fused-src/gmock-gtest-all.cc" + "$(srcdir)/scripts/fuse_gmock_files.py" "$(srcdir)/fused-src" + cp -f "$(srcdir)/src/gmock_main.cc" "$(srcdir)/fused-src" + +maintainer-clean-local: + rm -rf "$(srcdir)/fused-src" +endif + +# Death tests may produce core dumps in the build directory. In case +# this happens, clean them to keep distcleancheck happy. +CLEANFILES = core + +# Disables 'make install' as installing a compiled version of Google +# Mock can lead to undefined behavior due to violation of the +# One-Definition Rule. + +install-exec-local: + echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system." + false + +install-data-local: + echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system." + false