From 9b77ec6500523af7cc39d136dc588e7ca3742e11 Mon Sep 17 00:00:00 2001 From: mwish Date: Sat, 7 Oct 2023 23:30:01 +0800 Subject: [PATCH 1/2] Parquet: tiny fix DCHECK in dictionary --- cpp/src/parquet/encoding.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cpp/src/parquet/encoding.cc b/cpp/src/parquet/encoding.cc index 931b9fd10729f..04765971e9bb0 100644 --- a/cpp/src/parquet/encoding.cc +++ b/cpp/src/parquet/encoding.cc @@ -442,7 +442,13 @@ class DictEncoderImpl : public EncoderImpl, virtual public DictEncoder { dict_encoded_size_(0), memo_table_(pool, kInitialHashTableSize) {} - ~DictEncoderImpl() override { DCHECK(buffered_indices_.empty()); } + ~DictEncoderImpl() override { +#ifndef NDEBUG + if (!buffered_indices_.empty()) { + ARROW_LOG(WARNING) << "DictEncoderImpl destroyed without flushing or closing"; + } +#endif + } int dict_encoded_size() const override { return dict_encoded_size_; } From 5d76b89f585e590bf2951e268511317e14badc00 Mon Sep 17 00:00:00 2001 From: mwish Date: Thu, 19 Oct 2023 22:55:49 +0800 Subject: [PATCH 2/2] remove dtor for DictEncoderImpl --- cpp/src/parquet/encoding.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cpp/src/parquet/encoding.cc b/cpp/src/parquet/encoding.cc index 6a5e03d869f95..5221f2588c0d3 100644 --- a/cpp/src/parquet/encoding.cc +++ b/cpp/src/parquet/encoding.cc @@ -442,13 +442,7 @@ class DictEncoderImpl : public EncoderImpl, virtual public DictEncoder { dict_encoded_size_(0), memo_table_(pool, kInitialHashTableSize) {} - ~DictEncoderImpl() override { -#ifndef NDEBUG - if (!buffered_indices_.empty()) { - ARROW_LOG(WARNING) << "DictEncoderImpl destroyed without flushing or closing"; - } -#endif - } + ~DictEncoderImpl() = default; int dict_encoded_size() const override { return dict_encoded_size_; }