Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORC-418. Fix broken docker builds. #328

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions c++/include/orc/Exceptions.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace orc {
public:
explicit NotImplementedYet(const std::string& what_arg);
explicit NotImplementedYet(const char* what_arg);
virtual ~NotImplementedYet() noexcept;
virtual ~NotImplementedYet() ORC_NOEXCEPT;
NotImplementedYet(const NotImplementedYet&);
private:
NotImplementedYet& operator=(const NotImplementedYet&);
Expand All @@ -40,7 +40,7 @@ namespace orc {
public:
explicit ParseError(const std::string& what_arg);
explicit ParseError(const char* what_arg);
virtual ~ParseError() noexcept;
virtual ~ParseError() ORC_NOEXCEPT;
ParseError(const ParseError&);
private:
ParseError& operator=(const ParseError&);
Expand All @@ -50,7 +50,7 @@ namespace orc {
public:
explicit InvalidArgument(const std::string& what_arg);
explicit InvalidArgument(const char* what_arg);
virtual ~InvalidArgument() noexcept;
virtual ~InvalidArgument() ORC_NOEXCEPT;
InvalidArgument(const InvalidArgument&);
private:
InvalidArgument& operator=(const InvalidArgument&);
Expand Down
2 changes: 2 additions & 0 deletions c++/src/Adaptor.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#cmakedefine HAS_STRPTIME
#cmakedefine HAS_STOLL
#cmakedefine HAS_DIAGNOSTIC_PUSH
#cmakedefine HAS_DOUBLE_TO_STRING
#cmakedefine HAS_INT64_TO_STRING
#cmakedefine HAS_PRE_1970
#cmakedefine HAS_POST_2038
#cmakedefine HAS_STD_ISNAN
Expand Down
21 changes: 20 additions & 1 deletion c++/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ CHECK_CXX_SOURCE_COMPILES("
NEEDS_REDUNDANT_MOVE
)

CHECK_CXX_SOURCE_COMPILES("
#include<string>
int main(int, char *[]) {
double d = 5;
std::to_string(d);
}"
HAS_DOUBLE_TO_STRING
)

CHECK_CXX_SOURCE_COMPILES("
#include<cstdint>
#include<string>
int main(int, char *[]) {
int64_t d = 5;
std::to_string(d);
}"
HAS_INT64_TO_STRING
)

INCLUDE(CheckCXXSourceRuns)

CHECK_CXX_SOURCE_RUNS("
Expand Down Expand Up @@ -204,4 +223,4 @@ target_link_libraries (orc
${LIBHDFSPP_LIBRARIES}
)

install(TARGETS orc DESTINATION lib)
install(TARGETS orc DESTINATION lib)
6 changes: 3 additions & 3 deletions c++/src/Exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace orc {
// PASS
}

NotImplementedYet::~NotImplementedYet() noexcept {
NotImplementedYet::~NotImplementedYet() ORC_NOEXCEPT {
// PASS
}

Expand All @@ -53,7 +53,7 @@ namespace orc {
// PASS
}

ParseError::~ParseError() noexcept {
ParseError::~ParseError() ORC_NOEXCEPT {
// PASS
}

Expand All @@ -72,7 +72,7 @@ namespace orc {
// PASS
}

InvalidArgument::~InvalidArgument() noexcept {
InvalidArgument::~InvalidArgument() ORC_NOEXCEPT {
// PASS
}
}
10 changes: 5 additions & 5 deletions c++/src/RLEv1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@

namespace orc {

const int MINIMUM_REPEAT = 3;
const int MAXIMUM_REPEAT = 127 + MINIMUM_REPEAT;
const uint64_t MINIMUM_REPEAT = 3;
const uint64_t MAXIMUM_REPEAT = 127 + MINIMUM_REPEAT;

const int64_t BASE_128_MASK = 0x7f;

const int MAX_DELTA = 127;
const int MIN_DELTA = -128;
const int MAX_LITERAL_SIZE = 128;
const int64_t MAX_DELTA = 127;
const int64_t MIN_DELTA = -128;
const uint64_t MAX_LITERAL_SIZE = 128;

RleEncoderV1::RleEncoderV1(
std::unique_ptr<BufferedOutputStream> outStream,
Expand Down
2 changes: 1 addition & 1 deletion c++/src/RLEv1.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public:
private:
int64_t delta;
bool repeat;
int tailRunLength;
uint64_t tailRunLength;

void write(int64_t val) override;
void writeValues();
Expand Down
28 changes: 25 additions & 3 deletions c++/src/RleEncoderV2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@

namespace orc {

#ifdef HAS_DOUBLE_TO_STRING
std::string to_string(double val) {
return std::to_string(val);
}
#else
std::string to_string(double val) {
return std::to_string(static_cast<long double>(val));
}
#endif

#ifdef HAS_INT64_TO_STRING
std::string to_string(int64_t val) {
return std::to_string(val);
}
#else
std::string to_string(int64_t val) {
return std::to_string(static_cast<long long int>(val));
}
#endif

/**
* Compute the bits required to represent pth percentile value
* @param data - array
Expand All @@ -34,7 +54,7 @@ namespace orc {
*/
uint32_t RleEncoderV2::percentileBits(int64_t* data, size_t offset, size_t length, double p, bool reuseHist) {
if ((p > 1.0) || (p <= 0.0)) {
throw InvalidArgument("Invalid p value: " + std::to_string(p));
throw InvalidArgument("Invalid p value: " + to_string(p));
}

if (!reuseHist) {
Expand Down Expand Up @@ -342,11 +362,13 @@ void RleEncoderV2::determineEncoding(EncodingOption& option) {
// fixed values run >10 which cannot be encoded with SHORT_REPEAT
if (option.min == max) {
if (!option.isFixedDelta) {
throw InvalidArgument(std::to_string(option.min) + "==" + std::to_string(max) + ", isFixedDelta cannot be false");
throw InvalidArgument(to_string(option.min) + "==" +
to_string(max) + ", isFixedDelta cannot be false");
}

if(currDelta != 0) {
throw InvalidArgument(std::to_string(option.min) + "==" + std::to_string(max) + ", currDelta should be zero");
throw InvalidArgument(to_string(option.min) + "==" +
to_string(max) + ", currDelta should be zero");
}
option.fixedDelta = 0;
option.encoding = DELTA;
Expand Down
2 changes: 1 addition & 1 deletion c++/test/TestRleEncoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace orc {
virtual void SetUp();

protected:
bool alignBitpacking = true;
bool alignBitpacking;
std::unique_ptr<RleEncoder> getEncoder(RleVersion version,
MemoryOutputStream& memStream,
bool isSigned);
Expand Down
4 changes: 3 additions & 1 deletion c++/test/TestWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ namespace orc {
virtual void SetUp();

protected:
FileVersion fileVersion = FileVersion::v_0_11();
FileVersion fileVersion;
public:
WriterTest(): fileVersion(FileVersion::v_0_11()) {}
};

void WriterTest::SetUp() {
Expand Down
2 changes: 2 additions & 0 deletions cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ else ()
set(LZ4_INCLUDE_DIR "${LZ4_PREFIX}/include")
set(LZ4_STATIC_LIB "${LZ4_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}lz4${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(LZ4_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LZ4_PREFIX}
-DCMAKE_INSTALL_LIBDIR=lib
-DBUILD_SHARED_LIBS=OFF)

if (CMAKE_VERSION VERSION_GREATER "3.7")
Expand Down Expand Up @@ -237,6 +238,7 @@ else ()
set(PROTOBUF_PREFIX "${THIRDPARTY_DIR}/protobuf_ep-install")
set(PROTOBUF_INCLUDE_DIR "${PROTOBUF_PREFIX}/include")
set(PROTOBUF_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PROTOBUF_PREFIX}
-DCMAKE_INSTALL_LIBDIR=lib
-DBUILD_SHARED_LIBS=OFF
-Dprotobuf_BUILD_TESTS=OFF)
if (MSVC)
Expand Down
1 change: 1 addition & 0 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
logs
4 changes: 4 additions & 0 deletions docker/README
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ To run the docker scripts:
1. cd $os
2. docker build -t orc-$os .
3. docker run orc-$os

To clean up docker:
1. docker container prune
2. docker image prune
21 changes: 19 additions & 2 deletions docker/centos6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ RUN yum install -y \
gcc-c++ \
gettext-devel \
git \
java-1.7.0-openjdk \
java-1.7.0-openjdk-devel \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel \
libtool \
make \
openssl-devel \
tar \
Expand All @@ -42,6 +43,22 @@ WORKDIR /root
RUN wget "https://www.apache.org/dyn/closer.lua?action=download&filename=/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" -O maven.tgz
RUN tar xzf maven.tgz
RUN ln -s /root/apache-maven-3.3.9/bin/mvn /usr/bin/mvn
# install a local build of protobuf
RUN wget "https://github.com/protocolbuffers/protobuf/archive/v2.5.0.tar.gz" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to make these version numbers as parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dockerfiles by design aren't parameterized. They are designed to be concrete steps to build the image. On the plus side, the current linux distros don't need the legacy versions of protobuf or snappy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we could use sed or something to do it, but I think it is less confusing to hard code it.

-O protobuf.tgz
RUN tar xzf protobuf.tgz
RUN cd protobuf-2.5.0 && \
autoreconf -f -i -Wall,no-obsolete && \
./configure && \
make install
# install a local build of snappy
RUN wget "https://github.com/google/snappy/archive/1.1.3.tar.gz" \
-O snappy.tgz
RUN tar xzf snappy.tgz
RUN cd snappy-1.1.3 && \
./autogen.sh && \
./configure && \
make install

CMD git clone https://github.com/apache/orc.git -b master && \
mkdir orc/build && \
Expand Down
15 changes: 13 additions & 2 deletions docker/centos7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,27 @@ RUN yum install -y \
gcc-c++ \
gettext-devel \
git \
java-1.7.0-openjdk \
java-1.7.0-openjdk-devel \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel \
libtool \
make \
maven \
openssl-devel \
tar \
wget \
which \
zlib-devel

ENV TZ=America/Los_Angeles
WORKDIR /root
# install a local build of snappy
RUN wget "https://github.com/google/snappy/archive/1.1.3.tar.gz" \
-O snappy.tgz
RUN tar xzf snappy.tgz
RUN cd snappy-1.1.3 && \
./autogen.sh && \
./configure && \
make install

CMD git clone https://github.com/apache/orc.git -b master && \
mkdir orc/build && \
Expand Down
19 changes: 18 additions & 1 deletion docker/debian8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,36 @@
FROM debian:8
MAINTAINER Owen O'Malley <owen@hortonworks.com>

RUN echo "deb http://ftp.debian.org/debian jessie-backports main" \
>> /etc/apt/sources.list

RUN apt-get update
RUN apt-get install -y \
autoconf \
cmake \
gcc \
g++ \
git \
libsasl2-dev \
libssl-dev \
libtool \
make \
maven \
openjdk-7-jdk
pkg-config \
wget
RUN apt-get -t jessie-backports install -y openjdk-8-jdk
RUN update-alternatives --set java \
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

WORKDIR /root
# install a local build of snappy
RUN wget "https://github.com/google/snappy/archive/1.1.3.tar.gz" \
-O snappy.tgz
RUN tar xzf snappy.tgz
RUN cd snappy-1.1.3 && \
./autogen.sh && \
./configure && \
make install

CMD git clone https://github.com/apache/orc.git -b master && \
mkdir orc/build && \
Expand Down
6 changes: 6 additions & 0 deletions docker/os-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
centos6
centos7
debian8
ubuntu12
ubuntu14
ubuntu16
31 changes: 8 additions & 23 deletions docker/debian7/Dockerfile → docker/reinit.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
# 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
Expand All @@ -14,26 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# ORC compile for Debian 7
#

FROM debian:7
MAINTAINER Owen O'Malley <owen@hortonworks.com>

RUN apt-get update
RUN apt-get install -y \
cmake \
gcc \
g++ \
git \
make \
maven \
openjdk-7-jdk

WORKDIR /root

CMD git clone https://github.com/apache/orc.git -b master && \
mkdir orc/build && \
cd orc/build && \
cmake .. && \
make package test-out
start=`date`
for os in `cat os-list.txt`; do
echo "Re-initialize $os"
( cd $os && docker build --no-cache -t "orc-$os" . )
done
echo "Start: $start"
echo "End:" `date`
Loading