Skip to content

Commit e1513de

Browse files
authored
branch-2.0 [fix](arrow) fix arrow parquet writer exception handling (#50191)
see apache/arrow#35520
1 parent e8553f8 commit e1513de

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

.github/workflows/build-thirdparty.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
'autoconf'
8888
'libtool-bin'
8989
'pkg-config'
90-
'cmake'
90+
'cmake=3.22.1-1ubuntu1.22.04.2'
9191
'ninja-build'
9292
'ccache'
9393
'python-is-python3'
@@ -107,6 +107,7 @@ jobs:
107107
)
108108
109109
sudo apt update
110+
sudo apt-cache policy cmake
110111
sudo DEBIAN_FRONTEND=noninteractive apt install --yes "${packages[@]}"
111112
112113
mkdir -p "${DEFAULT_DIR}"
@@ -153,7 +154,6 @@ jobs:
153154
'coreutils'
154155
'gnu-getopt'
155156
'python@3'
156-
'cmake'
157157
'ninja'
158158
'ccache'
159159
'bison'
@@ -167,8 +167,16 @@ jobs:
167167
'llvm@16'
168168
)
169169
170+
# Install packages except cmake
170171
brew install "${packages[@]}" || true
171172
173+
# Install specific version of cmake
174+
brew unlink cmake || true
175+
wget https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-macos-universal.tar.gz
176+
tar -xzf cmake-3.22.1-macos-universal.tar.gz
177+
sudo cp -r cmake-3.22.1-macos-universal/CMake.app/Contents/* /usr/local/
178+
cmake --version
179+
172180
- name: Build
173181
run: |
174182
export MACOSX_DEPLOYMENT_TARGET=12.0
@@ -204,7 +212,6 @@ jobs:
204212
'coreutils'
205213
'gnu-getopt'
206214
'python@3'
207-
'cmake'
208215
'ninja'
209216
'ccache'
210217
'bison'
@@ -218,8 +225,16 @@ jobs:
218225
'llvm@16'
219226
)
220227
228+
# Install packages except cmake
221229
brew install "${packages[@]}" || true
222230
231+
# Install specific version of cmake
232+
brew unlink cmake || true
233+
wget https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-macos-universal.tar.gz
234+
tar -xzf cmake-3.22.1-macos-universal.tar.gz
235+
sudo cp -r cmake-3.22.1-macos-universal/CMake.app/Contents/* /usr/local/
236+
cmake --version
237+
223238
- name: Build
224239
run: |
225240
export MACOSX_DEPLOYMENT_TARGET=12.0

thirdparty/download-thirdparty.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ if [[ "${ARROW_SOURCE}" == "apache-arrow-7.0.0" ]]; then
329329
cd "${TP_SOURCE_DIR}/${ARROW_SOURCE}"
330330
if [[ ! -f "${PATCHED_MARK}" ]]; then
331331
patch -p1 <"${TP_PATCH_DIR}/apache-arrow-7.0.0.patch"
332+
patch -p1 <"${TP_PATCH_DIR}/apache-arrow-7.0.0-exception-handling.patch"
332333
touch "${PATCHED_MARK}"
333334
fi
334335
cd -
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/cpp/src/parquet/file_writer.cc b/cpp/src/parquet/file_writer.cc
2+
index deac9586e..572e8bde7 100644
3+
--- a/cpp/src/parquet/file_writer.cc
4+
+++ b/cpp/src/parquet/file_writer.cc
5+
@@ -181,15 +181,13 @@ class RowGroupSerializer : public RowGroupWriter::Contents {
6+
closed_ = true;
7+
CheckRowsWritten();
8+
9+
- for (size_t i = 0; i < column_writers_.size(); i++) {
10+
- if (column_writers_[i]) {
11+
- total_bytes_written_ += column_writers_[i]->Close();
12+
- column_writers_[i].reset();
13+
+ auto column_writers = std::move(column_writers_);
14+
+ for (size_t i = 0; i < column_writers.size(); i++) {
15+
+ if (column_writers[i]) {
16+
+ total_bytes_written_ += column_writers[i]->Close();
17+
}
18+
}
19+
20+
- column_writers_.clear();
21+
-
22+
// Ensures all columns have been written
23+
metadata_->set_num_rows(num_rows_);
24+
metadata_->Finish(total_bytes_written_, row_group_ordinal_);

0 commit comments

Comments
 (0)