iceberg-cpp
Loading...
Searching...
No Matches
update_sort_order.h
Go to the documentation of this file.
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 <memory>
23#include <string_view>
24#include <vector>
25
27#include "iceberg/sort_field.h"
28#include "iceberg/type_fwd.h"
30
33
34namespace iceberg {
35
37class ICEBERG_EXPORT UpdateSortOrder : public PendingUpdate {
38 public:
39 static Result<std::shared_ptr<UpdateSortOrder>> Make(
40 std::shared_ptr<TransactionContext> ctx);
41
42 ~UpdateSortOrder() override;
43
50 UpdateSortOrder& AddSortField(const std::shared_ptr<Term>& term,
51 SortDirection direction, NullOrder null_order);
52
59 UpdateSortOrder& AddSortFieldByName(std::string_view name, SortDirection direction,
60 NullOrder null_order);
61
66 UpdateSortOrder& CaseSensitive(bool case_sensitive);
67
68 Kind kind() const final { return Kind::kUpdateSortOrder; }
69 bool IsRetryable() const override { return true; }
70
72 Result<std::shared_ptr<SortOrder>> Apply();
73
74 private:
75 explicit UpdateSortOrder(std::shared_ptr<TransactionContext> ctx);
76
77 std::vector<SortField> sort_fields_;
78 bool case_sensitive_ = true;
79};
80
81} // namespace iceberg
Base class for all kinds of table metadata updates.
Definition pending_update.h:41
Updating table sort order with a newly created order.
Definition update_sort_order.h:37
Kind kind() const final
Return the kind of this pending update.
Definition update_sort_order.h:68
bool IsRetryable() const override
Whether this update can be retried after a commit conflict.
Definition update_sort_order.h:69
SortDirection
Sort direction in a partition, either ascending or descending.
Definition sort_field.h:38
NullOrder
Definition sort_field.h:63