diff --git a/cpp/src/gandiva/cache.h b/cpp/src/gandiva/cache.h index 83ffa9b9a64aa..5d2647b35f859 100644 --- a/cpp/src/gandiva/cache.h +++ b/cpp/src/gandiva/cache.h @@ -17,6 +17,8 @@ #pragma once +#include +#include #include #include "gandiva/lru_cache.h" @@ -26,7 +28,12 @@ namespace gandiva { template class Cache { public: - explicit Cache(size_t capacity = CACHE_SIZE) : cache_(capacity) {} + explicit Cache(size_t capacity) : cache_(capacity) { + std::cout << "Creating gandiva cache with capacity: " << capacity << std::endl; + } + + Cache() : Cache(GetCapacity()) {} + ValueType GetModule(KeyType cache_key) { arrow::util::optional result; mtx_.lock(); @@ -42,8 +49,24 @@ class Cache { } private: + static int GetCapacity() { + int capacity; + const char* env_cache_size = std::getenv("GANDIVA_CACHE_SIZE"); + if (env_cache_size != nullptr) { + capacity = std::atoi(env_cache_size); + if (capacity <= 0) { + std::cout << "Invalid cache size provided. Using default cache size." + << std::endl; + capacity = DEFAULT_CACHE_SIZE; + } + } else { + capacity = DEFAULT_CACHE_SIZE; + } + return capacity; + } + LruCache cache_; - static const int CACHE_SIZE = 250; + static const int DEFAULT_CACHE_SIZE = 500; std::mutex mtx_; }; } // namespace gandiva diff --git a/cpp/src/gandiva/lru_cache.h b/cpp/src/gandiva/lru_cache.h index 6602116b0a06b..c5c82942f79a0 100644 --- a/cpp/src/gandiva/lru_cache.h +++ b/cpp/src/gandiva/lru_cache.h @@ -18,6 +18,7 @@ #pragma once #include +#include #include #include @@ -107,6 +108,7 @@ class LruCache { private: void evict() { + std::cout << "Evicted a cache item from the lru cache" << std::endl; // evict item from the end of most recently used list typename list_type::iterator i = --lru_list_.end(); map_.erase(*i); diff --git a/dev/tasks/gandiva-jars/build-cpp-linux.sh b/dev/tasks/gandiva-jars/build-cpp-linux.sh index 61c82495af37a..04a7d12c1737a 100755 --- a/dev/tasks/gandiva-jars/build-cpp-linux.sh +++ b/dev/tasks/gandiva-jars/build-cpp-linux.sh @@ -30,10 +30,11 @@ PIP="${CPYTHON_PATH}/bin/pip" ARROW_BUILD_DIR=/tmp/arrow-build mkdir -p "${ARROW_BUILD_DIR}" pushd "${ARROW_BUILD_DIR}" +ls /tmp/arrow-build PATH="${CPYTHON_PATH}/bin:${PATH}" -cmake -DCMAKE_BUILD_TYPE=Release \ +cmake -DCMAKE_BUILD_TYPE=Debug \ -DARROW_DEPENDENCY_SOURCE="SYSTEM" \ -DZLIB_ROOT=/usr/local \ -DCMAKE_INSTALL_PREFIX=/arrow-dist \ @@ -63,9 +64,12 @@ cmake -DCMAKE_BUILD_TYPE=Release \ -DBOOST_ROOT=/arrow_boost_dist \ -GNinja /arrow/cpp ninja install -ninja test + +ls ./debug +cp ./debug/gandiva-precompiled-test /io/dist popd # copy the library to distribution cp -L /arrow-dist/lib/libgandiva_jni.so /io/dist +cp -L /arrow-dist/lib/libarrow.so.100.0.0 /io/dist diff --git a/dev/tasks/gandiva-jars/build-cpp-osx.sh b/dev/tasks/gandiva-jars/build-cpp-osx.sh index 870a14a013267..ef4e52b92207c 100755 --- a/dev/tasks/gandiva-jars/build-cpp-osx.sh +++ b/dev/tasks/gandiva-jars/build-cpp-osx.sh @@ -29,7 +29,7 @@ pushd cpp -DARROW_GANDIVA=ON \ -DARROW_GANDIVA_JAVA=ON \ -DARROW_GANDIVA_STATIC_LIBSTDCPP=ON \ - -DARROW_BUILD_TESTS=ON \ + -DARROW_BUILD_TESTS=OFF \ -DARROW_BUILD_UTILITIES=OFF \ -DPARQUET_BUILD_ENCRYPTION=OFF \ -DARROW_PARQUET=OFF \ @@ -44,7 +44,6 @@ pushd cpp cmake $CMAKE_FLAGS .. make -j4 - ctest cp -L release/libgandiva_jni.dylib $TRAVIS_BUILD_DIR/dist popd diff --git a/dev/tasks/gandiva-jars/build-java.sh b/dev/tasks/gandiva-jars/build-java.sh index bba7adfd8e113..de91a49a8cdca 100755 --- a/dev/tasks/gandiva-jars/build-java.sh +++ b/dev/tasks/gandiva-jars/build-java.sh @@ -55,10 +55,8 @@ pushd java fi # build the entire project - mvn clean install -q -DskipTests -P arrow-jni -Darrow.cpp.build.dir=$CPP_BUILD_DIR - # test only gandiva - mvn test -q -P arrow-jni -pl gandiva -Dgandiva.cpp.build.dir=$CPP_BUILD_DIR - + mvn clean install -DskipTests -P arrow-jni -Darrow.cpp.build.dir=$CPP_BUILD_DIR + # copy the jars to distribution folder find gandiva/target/ -name "*.jar" -not -name "*tests*" -exec cp {} $CPP_BUILD_DIR \; popd diff --git a/dev/tasks/gandiva-jars/travis.linux.yml b/dev/tasks/gandiva-jars/travis.linux.yml index c53e9138e7e5d..50f5d6e401433 100644 --- a/dev/tasks/gandiva-jars/travis.linux.yml +++ b/dev/tasks/gandiva-jars/travis.linux.yml @@ -60,7 +60,6 @@ script: - mkdir -p dist # please refer to README for steps to update this image - docker run -v $PWD:/io -v $PWD:/arrow quay.io/prudhvi/arrow:buildGandivaDocker /io/dev/tasks/gandiva-jars/build-cpp-linux.sh || travis_terminate 1 - - dev/tasks/gandiva-jars/build-java.sh || travis_terminate 1 # deploy using crossbow - > python3 dev/tasks/crossbow.py @@ -69,4 +68,4 @@ script: upload-artifacts --sha {{ task.branch }} --tag {{ task.tag }} - --pattern "dist/*.jar" + --pattern "dist/libarrow.so.100.0.0"