Skip to content

Commit d6f4175

Browse files
committed
refactor: suppress warnings
1 parent 68eeb2c commit d6f4175

25 files changed

+191
-150
lines changed

src/iceberg/catalog/memory/in_memory_catalog.cc

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -384,23 +384,25 @@ Result<std::vector<TableIdentifier>> InMemoryCatalog::ListTables(
384384
}
385385

386386
Result<std::unique_ptr<Table>> InMemoryCatalog::CreateTable(
387-
const TableIdentifier& identifier, const Schema& schema, const PartitionSpec& spec,
388-
const std::string& location,
389-
const std::unordered_map<std::string, std::string>& properties) {
387+
[[maybe_unused]] const TableIdentifier& identifier,
388+
[[maybe_unused]] const Schema& schema, [[maybe_unused]] const PartitionSpec& spec,
389+
[[maybe_unused]] const std::string& location,
390+
[[maybe_unused]] const std::unordered_map<std::string, std::string>& properties) {
390391
return NotImplemented("create table");
391392
}
392393

393394
Result<std::unique_ptr<Table>> InMemoryCatalog::UpdateTable(
394-
const TableIdentifier& identifier,
395-
const std::vector<std::unique_ptr<TableRequirement>>& requirements,
396-
const std::vector<std::unique_ptr<TableUpdate>>& updates) {
395+
[[maybe_unused]] const TableIdentifier& identifier,
396+
[[maybe_unused]] const std::vector<std::unique_ptr<TableRequirement>>& requirements,
397+
[[maybe_unused]] const std::vector<std::unique_ptr<TableUpdate>>& updates) {
397398
return NotImplemented("update table");
398399
}
399400

400401
Result<std::shared_ptr<Transaction>> InMemoryCatalog::StageCreateTable(
401-
const TableIdentifier& identifier, const Schema& schema, const PartitionSpec& spec,
402-
const std::string& location,
403-
const std::unordered_map<std::string, std::string>& properties) {
402+
[[maybe_unused]] const TableIdentifier& identifier,
403+
[[maybe_unused]] const Schema& schema, [[maybe_unused]] const PartitionSpec& spec,
404+
[[maybe_unused]] const std::string& location,
405+
[[maybe_unused]] const std::unordered_map<std::string, std::string>& properties) {
404406
return NotImplemented("stage create table");
405407
}
406408

@@ -409,14 +411,15 @@ Result<bool> InMemoryCatalog::TableExists(const TableIdentifier& identifier) con
409411
return root_namespace_->TableExists(identifier);
410412
}
411413

412-
Status InMemoryCatalog::DropTable(const TableIdentifier& identifier, bool purge) {
414+
Status InMemoryCatalog::DropTable(const TableIdentifier& identifier,
415+
[[maybe_unused]] bool purge) {
413416
std::unique_lock lock(mutex_);
414417
// TODO(Guotao): Delete all metadata files if purge is true.
415418
return root_namespace_->UnregisterTable(identifier);
416419
}
417420

418-
Status InMemoryCatalog::RenameTable(const TableIdentifier& from,
419-
const TableIdentifier& to) {
421+
Status InMemoryCatalog::RenameTable([[maybe_unused]] const TableIdentifier& from,
422+
[[maybe_unused]] const TableIdentifier& to) {
420423
std::unique_lock lock(mutex_);
421424
return NotImplemented("rename table");
422425
}
@@ -455,7 +458,8 @@ Result<std::shared_ptr<Table>> InMemoryCatalog::RegisterTable(
455458
}
456459

457460
std::unique_ptr<Catalog::TableBuilder> InMemoryCatalog::BuildTable(
458-
const TableIdentifier& identifier, const Schema& schema) const {
461+
[[maybe_unused]] const TableIdentifier& identifier,
462+
[[maybe_unused]] const Schema& schema) const {
459463
throw IcebergError("not implemented");
460464
}
461465

src/iceberg/catalog/rest/types.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ namespace iceberg::rest {
3939

4040
/// \brief Server-provided configuration for the catalog.
4141
struct ICEBERG_REST_EXPORT CatalogConfig {
42-
std::unordered_map<std::string, std::string> defaults; // required
43-
std::unordered_map<std::string, std::string> overrides; // required
44-
std::vector<std::string> endpoints;
42+
std::unordered_map<std::string, std::string> defaults{}; // required
43+
std::unordered_map<std::string, std::string> overrides{}; // required
44+
std::vector<std::string> endpoints{};
4545

4646
/// \brief Validates the CatalogConfig.
4747
Status Validate() const {
@@ -58,7 +58,7 @@ struct ICEBERG_REST_EXPORT ErrorModel {
5858
std::string message; // required
5959
std::string type; // required
6060
uint32_t code; // required
61-
std::vector<std::string> stack;
61+
std::vector<std::string> stack{};
6262

6363
/// \brief Validates the ErrorModel.
6464
Status Validate() const {
@@ -88,16 +88,16 @@ struct ICEBERG_REST_EXPORT ErrorResponse {
8888
/// \brief Request to create a namespace.
8989
struct ICEBERG_REST_EXPORT CreateNamespaceRequest {
9090
Namespace namespace_; // required
91-
std::unordered_map<std::string, std::string> properties;
91+
std::unordered_map<std::string, std::string> properties{};
9292

9393
/// \brief Validates the CreateNamespaceRequest.
9494
Status Validate() const { return {}; }
9595
};
9696

9797
/// \brief Update or delete namespace properties request.
9898
struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesRequest {
99-
std::vector<std::string> removals;
100-
std::unordered_map<std::string, std::string> updates;
99+
std::vector<std::string> removals{};
100+
std::unordered_map<std::string, std::string> updates{};
101101

102102
/// \brief Validates the UpdateNamespacePropertiesRequest.
103103
Status Validate() const {
@@ -171,7 +171,7 @@ using LoadTableResponse = LoadTableResult;
171171
/// \brief Response body for listing namespaces.
172172
struct ICEBERG_REST_EXPORT ListNamespacesResponse {
173173
PageToken next_page_token;
174-
std::vector<Namespace> namespaces;
174+
std::vector<Namespace> namespaces{};
175175

176176
/// \brief Validates the ListNamespacesResponse.
177177
Status Validate() const { return {}; }
@@ -180,7 +180,7 @@ struct ICEBERG_REST_EXPORT ListNamespacesResponse {
180180
/// \brief Response body after creating a namespace.
181181
struct ICEBERG_REST_EXPORT CreateNamespaceResponse {
182182
Namespace namespace_; // required
183-
std::unordered_map<std::string, std::string> properties;
183+
std::unordered_map<std::string, std::string> properties{};
184184

185185
/// \brief Validates the CreateNamespaceResponse.
186186
Status Validate() const { return {}; }
@@ -189,17 +189,17 @@ struct ICEBERG_REST_EXPORT CreateNamespaceResponse {
189189
/// \brief Response body for loading namespace properties.
190190
struct ICEBERG_REST_EXPORT GetNamespaceResponse {
191191
Namespace namespace_; // required
192-
std::unordered_map<std::string, std::string> properties;
192+
std::unordered_map<std::string, std::string> properties{};
193193

194194
/// \brief Validates the GetNamespaceResponse.
195195
Status Validate() const { return {}; }
196196
};
197197

198198
/// \brief Response body after updating namespace properties.
199199
struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse {
200-
std::vector<std::string> updated; // required
201-
std::vector<std::string> removed; // required
202-
std::vector<std::string> missing;
200+
std::vector<std::string> updated{}; // required
201+
std::vector<std::string> removed{}; // required
202+
std::vector<std::string> missing{};
203203

204204
/// \brief Validates the UpdateNamespacePropertiesResponse.
205205
Status Validate() const { return {}; }
@@ -208,7 +208,7 @@ struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse {
208208
/// \brief Response body for listing tables in a namespace.
209209
struct ICEBERG_REST_EXPORT ListTablesResponse {
210210
PageToken next_page_token;
211-
std::vector<TableIdentifier> identifiers;
211+
std::vector<TableIdentifier> identifiers{};
212212

213213
/// \brief Validates the ListTablesResponse.
214214
Status Validate() const { return {}; }

src/iceberg/expression/binder.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ Result<bool> IsBoundVisitor::Or(bool left_result, bool right_result) {
8484
return left_result && right_result;
8585
}
8686

87-
Result<bool> IsBoundVisitor::Predicate(const std::shared_ptr<BoundPredicate>& pred) {
87+
Result<bool> IsBoundVisitor::Predicate(
88+
[[maybe_unused]] const std::shared_ptr<BoundPredicate>& pred) {
8889
return true;
8990
}
9091

91-
Result<bool> IsBoundVisitor::Predicate(const std::shared_ptr<UnboundPredicate>& pred) {
92+
Result<bool> IsBoundVisitor::Predicate(
93+
[[maybe_unused]] const std::shared_ptr<UnboundPredicate>& pred) {
9294
return false;
9395
}
9496

src/iceberg/expression/expression.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ICEBERG_EXPORT Expression : public util::Formattable {
7575
/// \brief Returns whether this expression will accept the same values as another.
7676
/// \param other another expression
7777
/// \return true if the expressions are equivalent
78-
virtual bool Equals(const Expression& other) const {
78+
virtual bool Equals([[maybe_unused]] const Expression& other) const {
7979
// only bound predicates can be equivalent
8080
return false;
8181
}

src/iceberg/expression/expression_visitor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ class ICEBERG_EXPORT BoundVisitor : public ExpressionVisitor<R> {
9999

100100
/// \brief Visit an IS_NAN unary predicate.
101101
/// \param term The bound term being tested
102-
virtual Result<R> IsNaN(const std::shared_ptr<BoundTerm>& term) {
102+
virtual Result<R> IsNaN([[maybe_unused]] const std::shared_ptr<BoundTerm>& term) {
103103
return NotSupported("IsNaN operation is not supported by this visitor");
104104
}
105105

106106
/// \brief Visit a NOT_NAN unary predicate.
107107
/// \param term The bound term being tested
108-
virtual Result<R> NotNaN(const std::shared_ptr<BoundTerm>& term) {
108+
virtual Result<R> NotNaN([[maybe_unused]] const std::shared_ptr<BoundTerm>& term) {
109109
return NotSupported("NotNaN operation is not supported by this visitor");
110110
}
111111

src/iceberg/expression/expressions.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ std::shared_ptr<NamedReference> Expressions::Ref(std::string name) {
372372
return ref;
373373
}
374374

375-
Literal Expressions::Lit(Literal::Value value, std::shared_ptr<PrimitiveType> type) {
375+
Literal Expressions::Lit([[maybe_unused]] Literal::Value value,
376+
[[maybe_unused]] std::shared_ptr<PrimitiveType> type) {
376377
throw ExpressionError("Literal creation is not implemented");
377378
}
378379

src/iceberg/expression/literal.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Result<Literal> LiteralCaster::CastFromBinary(
245245
switch (target_type->type_id()) {
246246
case TypeId::kFixed: {
247247
auto target_fixed_type = internal::checked_pointer_cast<FixedType>(target_type);
248-
if (binary_val.size() == target_fixed_type->length()) {
248+
if (binary_val.size() == static_cast<size_t>(target_fixed_type->length())) {
249249
return Literal::Fixed(std::move(binary_val));
250250
}
251251
return InvalidArgument("Failed to cast Binary with length {} to Fixed({})",
@@ -505,8 +505,8 @@ bool Literal::IsAboveMax() const { return std::holds_alternative<AboveMax>(value
505505
bool Literal::IsNull() const { return std::holds_alternative<std::monostate>(value_); }
506506

507507
bool Literal::IsNaN() const {
508-
return std::holds_alternative<float>(value_) && std::isnan(std::get<float>(value_)) ||
509-
std::holds_alternative<double>(value_) && std::isnan(std::get<double>(value_));
508+
return (std::holds_alternative<float>(value_) && std::isnan(std::get<float>(value_))) ||
509+
(std::holds_alternative<double>(value_) && std::isnan(std::get<double>(value_)));
510510
}
511511

512512
// LiteralCaster implementation

src/iceberg/file_io.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class ICEBERG_EXPORT FileIO {
4949
/// the length to read, e.g. S3 `GetObject` has a Range parameter.
5050
/// \return The content of the file if the read succeeded, an error code if the read
5151
/// failed.
52-
virtual Result<std::string> ReadFile(const std::string& file_location,
53-
std::optional<size_t> length) {
52+
virtual Result<std::string> ReadFile([[maybe_unused]] const std::string& file_location,
53+
[[maybe_unused]] std::optional<size_t> length) {
5454
// We provide a default implementation to avoid Windows linker error LNK2019.
5555
return NotImplemented("ReadFile not implemented");
5656
}
@@ -62,15 +62,16 @@ class ICEBERG_EXPORT FileIO {
6262
/// \param overwrite If true, overwrite the file if it exists. If false, fail if the
6363
/// file exists.
6464
/// \return void if the write succeeded, an error code if the write failed.
65-
virtual Status WriteFile(const std::string& file_location, std::string_view content) {
65+
virtual Status WriteFile([[maybe_unused]] const std::string& file_location,
66+
[[maybe_unused]] std::string_view content) {
6667
return NotImplemented("WriteFile not implemented");
6768
}
6869

6970
/// \brief Delete a file at the given location.
7071
///
7172
/// \param file_location The location of the file to delete.
7273
/// \return void if the delete succeeded, an error code if the delete failed.
73-
virtual Status DeleteFile(const std::string& file_location) {
74+
virtual Status DeleteFile([[maybe_unused]] const std::string& file_location) {
7475
return NotImplemented("DeleteFile not implemented");
7576
}
7677
};

src/iceberg/file_reader.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,23 @@ class ReaderProperties : public ConfigBase<ReaderProperties> {
8787
/// \brief Options for creating a reader.
8888
struct ICEBERG_EXPORT ReaderOptions {
8989
/// \brief The path to the file to read.
90-
std::string path;
90+
std::string path{};
9191
/// \brief The total length of the file.
92-
std::optional<size_t> length;
92+
std::optional<size_t> length{};
9393
/// \brief The split to read.
94-
std::optional<Split> split;
94+
std::optional<Split> split{};
9595
/// \brief FileIO instance to open the file. Reader implementations should down cast it
9696
/// to the specific FileIO implementation. By default, the `iceberg-bundle` library uses
9797
/// `ArrowFileSystemFileIO` as the default implementation.
98-
std::shared_ptr<class FileIO> io;
98+
std::shared_ptr<class FileIO> io{};
9999
/// \brief The projection schema to read from the file. This field is required.
100-
std::shared_ptr<class Schema> projection;
100+
std::shared_ptr<class Schema> projection{};
101101
/// \brief The filter to apply to the data. Reader implementations may ignore this if
102102
/// the file format does not support filtering.
103-
std::shared_ptr<class Expression> filter;
103+
std::shared_ptr<class Expression> filter{};
104104
/// \brief Name mapping for schema evolution compatibility. Used when reading files
105105
/// that may have different field names than the current schema.
106-
std::shared_ptr<class NameMapping> name_mapping;
106+
std::shared_ptr<class NameMapping> name_mapping{};
107107
/// \brief Format-specific or implementation-specific properties.
108108
std::shared_ptr<ReaderProperties> properties = ReaderProperties::default_properties();
109109
};

src/iceberg/manifest_adapter.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,14 @@ ManifestEntryAdapter::~ManifestEntryAdapter() {
164164
Status ManifestEntryAdapter::AppendPartitionValues(
165165
ArrowArray* array, const std::shared_ptr<StructType>& partition_type,
166166
const std::vector<Literal>& partition_values) {
167-
if (array->n_children != partition_type->fields().size()) [[unlikely]] {
167+
auto fields = partition_type->fields();
168+
auto num_fields = static_cast<int64_t>(fields.size());
169+
if (array->n_children != num_fields) [[unlikely]] {
168170
return InvalidArrowData("Arrow array of partition does not match partition type.");
169171
}
170-
if (partition_values.size() != partition_type->fields().size()) [[unlikely]] {
172+
if (partition_values.size() != fields.size()) [[unlikely]] {
171173
return InvalidArrowData("Literal list of partition does not match partition type.");
172174
}
173-
auto fields = partition_type->fields();
174175

175176
for (size_t i = 0; i < fields.size(); i++) {
176177
const auto& partition_value = partition_values[i];

0 commit comments

Comments
 (0)