Skip to content

Commit 6660e84

Browse files
authored
GH-47317: [C++][C++23][Gandiva] Use pointer for Cache test (#47318)
### Rationale for this change `gandiva::Cache` requires pointer type for value type. ### What changes are included in this PR? Use `std::shared_ptr<std::string>` not `std::string` for `ValueType`. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #47317 Authored-by: Sutou Kouhei <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent bebfa97 commit 6660e84

File tree

3 files changed

+159
-5
lines changed

3 files changed

+159
-5
lines changed

.github/workflows/cpp_extra.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ jobs:
126126
title: AMD64 Ubuntu Meson
127127
# TODO: We should remove this "continue-on-error: true" once GH-47207 is resolved
128128
- continue-on-error: true
129+
envs:
130+
- DEBIAN=13
129131
image: debian-cpp
130132
run-options: >-
131133
-e CMAKE_CXX_STANDARD=23
@@ -158,10 +160,16 @@ jobs:
158160
env:
159161
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
160162
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
163+
ENVS: ${{ toJSON(matrix.envs) }}
161164
run: |
162165
# GH-40558: reduce ASLR to avoid ASAN/LSAN crashes
163166
sudo sysctl -w vm.mmap_rnd_bits=28
164167
source ci/scripts/util_enable_core_dumps.sh
168+
if [ "${ENVS}" != "null" ]; then
169+
echo "${ENVS}" | jq -r '.[]' | while read env; do
170+
echo "${env}" >> .env
171+
done
172+
fi
165173
archery docker run ${{ matrix.run-options || '' }} ${{ matrix.image }}
166174
- name: Docker Push
167175
if: >-

ci/docker/debian-13-cpp.dockerfile

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
ARG arch=amd64
19+
FROM ${arch}/debian:13
20+
ARG arch
21+
22+
ENV DEBIAN_FRONTEND noninteractive
23+
24+
ARG llvm
25+
RUN apt-get update -y -q && \
26+
apt-get install -y -q --no-install-recommends \
27+
apt-transport-https \
28+
ca-certificates \
29+
gnupg \
30+
lsb-release \
31+
wget && \
32+
if [ ${llvm} -ge 20 ]; then \
33+
wget -O /usr/share/keyrings/llvm-snapshot.asc \
34+
https://apt.llvm.org/llvm-snapshot.gpg.key && \
35+
(echo "Types: deb"; \
36+
echo "URIs: https://apt.llvm.org/$(lsb_release --codename --short)/"; \
37+
echo "Suites: llvm-toolchain-$(lsb_release --codename --short)-${llvm}"; \
38+
echo "Components: main"; \
39+
echo "Signed-By: /usr/share/keyrings/llvm-snapshot.asc") | \
40+
tee /etc/apt/sources.list.d/llvm.sources; \
41+
fi && \
42+
apt-get update -y -q && \
43+
apt-get install -y -q --no-install-recommends \
44+
autoconf \
45+
ccache \
46+
clang-${llvm} \
47+
cmake \
48+
curl \
49+
g++ \
50+
gcc \
51+
gdb \
52+
git \
53+
libbenchmark-dev \
54+
libboost-filesystem-dev \
55+
libboost-system-dev \
56+
libbrotli-dev \
57+
libbz2-dev \
58+
libc-ares-dev \
59+
libcurl4-openssl-dev \
60+
libgflags-dev \
61+
libgmock-dev \
62+
libgoogle-glog-dev \
63+
libgrpc++-dev \
64+
libidn2-dev \
65+
libkrb5-dev \
66+
libldap-dev \
67+
liblz4-dev \
68+
libnghttp2-dev \
69+
libprotobuf-dev \
70+
libprotoc-dev \
71+
libpsl-dev \
72+
libre2-dev \
73+
librtmp-dev \
74+
libsnappy-dev \
75+
libsqlite3-dev \
76+
libssh-dev \
77+
libssh2-1-dev \
78+
libssl-dev \
79+
libthrift-dev \
80+
libutf8proc-dev \
81+
libxml2-dev \
82+
libxsimd-dev \
83+
libzstd-dev \
84+
llvm-${llvm}-dev \
85+
make \
86+
ninja-build \
87+
nlohmann-json3-dev \
88+
npm \
89+
opentelemetry-cpp-dev \
90+
pkg-config \
91+
protobuf-compiler-grpc \
92+
python3-dev \
93+
python3-pip \
94+
python3-venv \
95+
rapidjson-dev \
96+
rsync \
97+
tzdata \
98+
zlib1g-dev && \
99+
apt-get clean && \
100+
rm -rf /var/lib/apt/lists/*
101+
102+
COPY ci/scripts/install_minio.sh /arrow/ci/scripts/
103+
RUN /arrow/ci/scripts/install_minio.sh latest /usr/local
104+
105+
COPY ci/scripts/install_gcs_testbench.sh /arrow/ci/scripts/
106+
RUN /arrow/ci/scripts/install_gcs_testbench.sh default
107+
108+
COPY ci/scripts/install_azurite.sh /arrow/ci/scripts/
109+
RUN /arrow/ci/scripts/install_azurite.sh
110+
111+
COPY ci/scripts/install_sccache.sh /arrow/ci/scripts/
112+
RUN /arrow/ci/scripts/install_sccache.sh unknown-linux-musl /usr/local/bin
113+
114+
# Prioritize system packages and local installation.
115+
ENV ARROW_ACERO=ON \
116+
ARROW_AZURE=ON \
117+
ARROW_BUILD_TESTS=ON \
118+
ARROW_DATASET=ON \
119+
ARROW_DEPENDENCY_SOURCE=SYSTEM \
120+
ARROW_DATASET=ON \
121+
ARROW_FLIGHT=ON \
122+
ARROW_FLIGHT_SQL=ON \
123+
ARROW_GANDIVA=ON \
124+
ARROW_GCS=ON \
125+
ARROW_HOME=/usr/local \
126+
ARROW_JEMALLOC=ON \
127+
ARROW_ORC=ON \
128+
ARROW_PARQUET=ON \
129+
ARROW_S3=ON \
130+
ARROW_SUBSTRAIT=ON \
131+
ARROW_USE_CCACHE=ON \
132+
ARROW_WITH_BROTLI=ON \
133+
ARROW_WITH_BZ2=ON \
134+
ARROW_WITH_LZ4=ON \
135+
ARROW_WITH_OPENTELEMETRY=ON \
136+
ARROW_WITH_SNAPPY=ON \
137+
ARROW_WITH_ZLIB=ON \
138+
ARROW_WITH_ZSTD=ON \
139+
AWSSDK_SOURCE=BUNDLED \
140+
Azure_SOURCE=BUNDLED \
141+
google_cloud_cpp_storage_SOURCE=BUNDLED \
142+
ORC_SOURCE=BUNDLED \
143+
PATH=/usr/lib/ccache/:$PATH \
144+
PYTHON=python3

cpp/src/gandiva/cache_test.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ class TestCacheKey {
3535
};
3636

3737
TEST(TestCache, TestGetPut) {
38-
Cache<TestCacheKey, std::string> cache(2);
39-
cache.PutObjectCode(TestCacheKey(1), "hello");
40-
cache.PutObjectCode(TestCacheKey(2), "world");
41-
ASSERT_EQ(cache.GetObjectCode(TestCacheKey(1)), "hello");
42-
ASSERT_EQ(cache.GetObjectCode(TestCacheKey(2)), "world");
38+
Cache<TestCacheKey, std::shared_ptr<std::string>> cache(2);
39+
auto hello = std::make_shared<std::string>("hello");
40+
cache.PutObjectCode(TestCacheKey(1), hello);
41+
auto world = std::make_shared<std::string>("world");
42+
cache.PutObjectCode(TestCacheKey(2), world);
43+
ASSERT_EQ(cache.GetObjectCode(TestCacheKey(1)), hello);
44+
ASSERT_EQ(cache.GetObjectCode(TestCacheKey(2)), world);
4345
}
4446

4547
namespace {

0 commit comments

Comments
 (0)