mapleFU commented on code in PR #37400: URL: https://github.com/apache/arrow/pull/37400#discussion_r1664336805
########## cpp/src/parquet/bloom_filter_builder.cc: ########## @@ -0,0 +1,158 @@ +// 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 +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// This module defines an abstract interface for iterating through pages in a +// Parquet column chunk within a row group. It could be extended in the future +// to iterate through all data pages in all chunks in a file. + +#include "parquet/bloom_filter_builder.h" + +#include <map> +#include <utility> +#include <vector> + +#include "arrow/io/interfaces.h" + +#include "parquet/bloom_filter.h" +#include "parquet/exception.h" +#include "parquet/metadata.h" +#include "parquet/properties.h" + +namespace parquet::internal { + +namespace { +/// Column encryption for bloom filter is not implemented yet. +class BloomFilterBuilderImpl : public BloomFilterBuilder { + public: + explicit BloomFilterBuilderImpl(const SchemaDescriptor* schema, + const WriterProperties* properties) + : schema_(schema), properties_(properties) {} + /// Append a new row group to host all incoming bloom filters. + void AppendRowGroup() override; + + BloomFilter* GetOrCreateBloomFilter(int32_t column_ordinal) override; + + /// Serialize all bloom filters with header and bitset in the order of row group and + /// column id. The side effect is that it deletes all bloom filters after they have + /// been flushed. + void WriteTo(::arrow::io::OutputStream* sink, BloomFilterLocation* location) override; + + BloomFilterBuilderImpl(const BloomFilterBuilderImpl&) = delete; + BloomFilterBuilderImpl(BloomFilterBuilderImpl&&) = default; + + private: + /// Make sure column ordinal is not out of bound and the builder is in good state. + void CheckState(int32_t column_ordinal) const { + if (finished_) { + throw ParquetException("BloomFilterBuilder is already finished."); Review Comment: Updated -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org