Repository: orc Updated Branches: refs/heads/master 0e6f71f80 -> 7dc9dbb86
ORC-334: [C++] Add AppVeyor support for integration on windows Fixes #265 Signed-off-by: Deepak Majeti <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/orc/repo Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/7dc9dbb8 Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/7dc9dbb8 Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/7dc9dbb8 Branch: refs/heads/master Commit: 7dc9dbb86c3fa203f1bb1e1959bc0313a63a5fc8 Parents: 0e6f71f Author: rip-nsk <[email protected]> Authored: Thu May 3 16:15:40 2018 -0700 Committer: Deepak Majeti <[email protected]> Committed: Mon May 14 22:43:26 2018 -0400 ---------------------------------------------------------------------- appveyor.yml | 45 ++++++++++++++++++++++++++++ c++/include/orc/Common.hh | 4 +-- c++/src/Adaptor.hh.in | 8 +++++ c++/src/Timezone.cc | 8 +++-- c++/test/CreateTestFiles.cc | 8 ++--- c++/test/TestColumnReader.cc | 2 +- c++/test/TestDecompression.cc | 2 +- cmake_modules/ThirdpartyToolchain.cmake | 12 ++++++++ 8 files changed, 79 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/orc/blob/7dc9dbb8/appveyor.yml ---------------------------------------------------------------------- diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..ddb66e9 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,45 @@ +# 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. + +# Operating system (build VM template) +# os: Visual Studio 2017 + +environment: + matrix: + - JOB: Visual Studio 2015 + CMAKE_GENERATOR: Visual Studio 14 2015 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + +platform: + - x64 + +configuration: + - Debug + +build_script: + - mkdir build + - cd build + - if "%platform%"=="x64" set CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64 + - cmake .. -G "%CMAKE_GENERATOR%" + -DCMAKE_BUILD_TYPE=%CONFIGURATION% + -DBUILD_CPP_TESTS=ON + -DBUILD_LIBHDFSPP=OFF + -DBUILD_TOOLS=OFF + -DBUILD_JAVA=OFF + - set TZDIR=C:/projects/orc/build/tzdata_ep-prefix/src/tzdata_ep/share/zoneinfo + - cmake --build . --config %CONFIGURATION% + - ctest -VV -C %CONFIGURATION% http://git-wip-us.apache.org/repos/asf/orc/blob/7dc9dbb8/c++/include/orc/Common.hh ---------------------------------------------------------------------- diff --git a/c++/include/orc/Common.hh b/c++/include/orc/Common.hh index 46ba8e2..b23d019 100644 --- a/c++/include/orc/Common.hh +++ b/c++/include/orc/Common.hh @@ -76,7 +76,7 @@ namespace orc { CompressionKind_LZO = 3, CompressionKind_LZ4 = 4, CompressionKind_ZSTD = 5, - CompressionKind_MAX = INT64_MAX + CompressionKind_MAX = INT32_MAX }; /** @@ -92,7 +92,7 @@ namespace orc { WriterVersion_HIVE_13083 = 4, WriterVersion_ORC_101 = 5, WriterVersion_ORC_135 = 6, - WriterVersion_MAX = INT64_MAX + WriterVersion_MAX = INT32_MAX }; /** http://git-wip-us.apache.org/repos/asf/orc/blob/7dc9dbb8/c++/src/Adaptor.hh.in ---------------------------------------------------------------------- diff --git a/c++/src/Adaptor.hh.in b/c++/src/Adaptor.hh.in index 3f5c451..d725742 100644 --- a/c++/src/Adaptor.hh.in +++ b/c++/src/Adaptor.hh.in @@ -34,6 +34,14 @@ #include "orc/orc-config.hh" #include <string> +#ifdef _MSC_VER +#include <BaseTsd.h> +typedef SSIZE_T ssize_t; +#define timegm(tm) _mkgmtime(tm) +#define gmtime_r(timep, result) (gmtime_s(result, timep) ? NULL : result) +#define asctime_r(tm, buf) (asctime_s(buf, 26, tm) ? NULL : buf) +#endif + #ifndef HAS_STOLL // A poor man's stoll that converts str to a long long int base 10 namespace std { http://git-wip-us.apache.org/repos/asf/orc/blob/7dc9dbb8/c++/src/Timezone.cc ---------------------------------------------------------------------- diff --git a/c++/src/Timezone.cc b/c++/src/Timezone.cc index 42e8121..318e5bc 100644 --- a/c++/src/Timezone.cc +++ b/c++/src/Timezone.cc @@ -710,7 +710,11 @@ namespace orc { * Get the local timezone. */ const Timezone& getLocalTimezone() { +#ifdef _MSC_VER + return getTimezoneByName("UTC"); +#else return getTimezoneByFilename(LOCAL_TIMEZONE); +#endif } /** @@ -744,8 +748,8 @@ namespace orc { for(uint64_t variant=0; variant < variantCount; ++variant) { variants[variant].gmtOffset = static_cast<int32_t>(decode32(ptr + variantOffset + 6 * variant)); - variants[variant].isDst = ptr[variantOffset + 6 * variant + 4]; - uint nameStart = ptr[variantOffset + 6 * variant + 5]; + variants[variant].isDst = ptr[variantOffset + 6 * variant + 4] != 0; + uint64_t nameStart = ptr[variantOffset + 6 * variant + 5]; if (nameStart >= nameCount) { std::stringstream buffer; buffer << "name out of range in variant " << variant http://git-wip-us.apache.org/repos/asf/orc/blob/7dc9dbb8/c++/test/CreateTestFiles.cc ---------------------------------------------------------------------- diff --git a/c++/test/CreateTestFiles.cc b/c++/test/CreateTestFiles.cc index 8bd96b0..2550802 100644 --- a/c++/test/CreateTestFiles.cc +++ b/c++/test/CreateTestFiles.cc @@ -31,8 +31,8 @@ void writeCustomOrcFile(const std::string& filename, const orc::proto::Metadata& metadata, const orc::proto::Footer& footer, - const std::vector<uint>& version, - uint writerVersion) { + const std::vector<std::uint32_t>& version, + std::uint32_t writerVersion) { std::fstream output(filename.c_str(), std::ios::out | std::ios::trunc | std::ios::binary); output << "ORC"; @@ -48,7 +48,7 @@ void writeCustomOrcFile(const std::string& filename, ps.set_footerlength(static_cast<uint64_t>(footer.ByteSize())); ps.set_compression(orc::proto::NONE); ps.set_compressionblocksize(64*1024); - for(uint i=0; i < version.size(); ++i) { + for(size_t i=0; i < version.size(); ++i) { ps.add_version(version[i]); } ps.set_metadatalength(static_cast<uint64_t>(metadata.ByteSize())); @@ -76,7 +76,7 @@ void writeVersion1999() { orc::proto::ColumnStatistics* stats = footer.add_statistics(); stats->set_numberofvalues(0); stats->set_hasnull(false); - std::vector<uint> version; + std::vector<std::uint32_t> version; version.push_back(19); version.push_back(99); writeCustomOrcFile("version1999.orc", meta, footer, version, 1); http://git-wip-us.apache.org/repos/asf/orc/blob/7dc9dbb8/c++/test/TestColumnReader.cc ---------------------------------------------------------------------- diff --git a/c++/test/TestColumnReader.cc b/c++/test/TestColumnReader.cc index 36d168a..c67229a 100644 --- a/c++/test/TestColumnReader.cc +++ b/c++/test/TestColumnReader.cc @@ -4302,7 +4302,7 @@ TEST(TestColumnReader, testUnionWithManyVariants) { // for variant in range(0, 130): // [variant & 0x3f, (variant & 0x3f) + 1, (variant & 0x3f) + 2] unsigned char buffer[3 * 130]; - for(uint variant = 0; variant < 130; ++variant) { + for(size_t variant = 0; variant < 130; ++variant) { buffer[3 * variant] = 0x00; buffer[3 * variant + 1] = 0x01; buffer[3 * variant + 2] = static_cast<unsigned char>((variant * 2) & 0x7f); http://git-wip-us.apache.org/repos/asf/orc/blob/7dc9dbb8/c++/test/TestDecompression.cc ---------------------------------------------------------------------- diff --git a/c++/test/TestDecompression.cc b/c++/test/TestDecompression.cc index 5d01bde..c29fa9a 100644 --- a/c++/test/TestDecompression.cc +++ b/c++/test/TestDecompression.cc @@ -374,7 +374,7 @@ namespace orc { TEST_F(TestDecompression, testLzoLong) { // set up a framed lzo buffer with 100,000 'a' unsigned char buffer[482]; - bzero(buffer, ARRAY_SIZE(buffer)); + memset(buffer, 0, ARRAY_SIZE(buffer)); // header buffer[0] = 190; buffer[1] = 3; http://git-wip-us.apache.org/repos/asf/orc/blob/7dc9dbb8/cmake_modules/ThirdpartyToolchain.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake index 676ec7f..7309826 100644 --- a/cmake_modules/ThirdpartyToolchain.cmake +++ b/cmake_modules/ThirdpartyToolchain.cmake @@ -166,6 +166,18 @@ if (LZ4_VENDORED) endif () # ---------------------------------------------------------------------- +# IANA - Time Zone Database + +if (WIN32) + ExternalProject_Add(tzdata_ep + URL "ftp://cygwin.osuosl.org/pub/cygwin/noarch/release/tzdata/tzdata-2018c-1.tar.xz" + URL_HASH MD5=F69FCA5C906FAFF02462D3D06F28267C + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "") +endif () + +# ---------------------------------------------------------------------- # GoogleTest (gtest now includes gmock) if (BUILD_CPP_TESTS)
