iceberg-cpp
Loading...
Searching...
No Matches
partition_summary_internal.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
22#include "iceberg/expression/literal.h"
23#include "iceberg/result.h"
24#include "iceberg/type_fwd.h"
25
26namespace iceberg {
27
30 public:
31 explicit PartitionFieldStats(const std::shared_ptr<Type>& type) : type_(type) {}
32
34 Status Update(const Literal& value);
35
37 Result<PartitionFieldSummary> Finish() const;
38
39 const std::shared_ptr<Type>& type() const { return type_; }
40
41 private:
42 const std::shared_ptr<Type>& type_{nullptr};
43 bool contains_null_{false};
44 bool contains_nan_{false};
45 std::optional<Literal> lower_bound_;
46 std::optional<Literal> upper_bound_;
47};
48
52 public:
54 explicit PartitionSummary(std::vector<PartitionFieldStats> field_stats)
55 : field_stats_(std::move(field_stats)) {}
56
58 explicit PartitionSummary(const StructType& partition_type);
59
61 Status Update(const PartitionValues& partition_values);
62
64 Result<std::vector<PartitionFieldSummary>> Summaries() const;
65
66 private:
67 std::vector<PartitionFieldStats> field_stats_;
68};
69
70} // namespace iceberg
Literal is a literal value that is associated with a primitive type.
Definition literal.h:39
Statistics for a partition field.
Definition partition_summary_internal.h:29
Result< PartitionFieldSummary > Finish() const
Finish the partition field stats and produce the partition field summary.
Definition partition_summary.cc:58
Status Update(const Literal &value)
Update the partition field stats with a new partition field value.
Definition partition_summary.cc:33
Maintains statistics for each partition field and produces the partition field summaries.
Definition partition_summary_internal.h:51
PartitionSummary(std::vector< PartitionFieldStats > field_stats)
Create a PartitionSummary with the given field stats.
Definition partition_summary_internal.h:54
Result< std::vector< PartitionFieldSummary > > Summaries() const
Get the list of partition field summaries.
Definition partition_summary.cc:94
Status Update(const PartitionValues &partition_values)
Update the partition summary with partition values.
Definition partition_summary.cc:78
StructLike wrapper for a vector of literals that represent partition values.
Definition partition_values.h:36
A data type representing a struct with nested fields.
Definition type.h:108
STL namespace.