Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/iceberg/catalog/memory/in_memory_catalog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -509,14 +509,15 @@ Result<bool> InMemoryCatalog::TableExists(const TableIdentifier& identifier) con
return root_namespace_->TableExists(identifier);
}

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

Status InMemoryCatalog::RenameTable(const TableIdentifier& from,
const TableIdentifier& to) {
Status InMemoryCatalog::RenameTable([[maybe_unused]] const TableIdentifier& from,
[[maybe_unused]] const TableIdentifier& to) {
std::unique_lock lock(mutex_);
return NotImplemented("rename table");
}
Expand Down
52 changes: 26 additions & 26 deletions src/iceberg/catalog/rest/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ namespace iceberg::rest {

/// \brief Server-provided configuration for the catalog.
struct ICEBERG_REST_EXPORT CatalogConfig {
std::unordered_map<std::string, std::string> defaults; // required
std::unordered_map<std::string, std::string> overrides; // required
std::vector<Endpoint> endpoints;
std::unordered_map<std::string, std::string> defaults{}; // required
std::unordered_map<std::string, std::string> overrides{}; // required
std::vector<Endpoint> endpoints{};

/// \brief Validates the CatalogConfig.
Status Validate() const { return {}; }
Expand All @@ -54,7 +54,7 @@ struct ICEBERG_REST_EXPORT ErrorResponse {
uint32_t code; // required
std::string type; // required
std::string message; // required
std::vector<std::string> stack;
std::vector<std::string> stack{};

/// \brief Validates the ErrorResponse.
Status Validate() const {
Expand All @@ -77,7 +77,7 @@ struct ICEBERG_REST_EXPORT ErrorResponse {
/// \brief Request to create a namespace.
struct ICEBERG_REST_EXPORT CreateNamespaceRequest {
Namespace namespace_; // required
std::unordered_map<std::string, std::string> properties;
std::unordered_map<std::string, std::string> properties{};

/// \brief Validates the CreateNamespaceRequest.
Status Validate() const { return {}; }
Expand All @@ -87,8 +87,8 @@ struct ICEBERG_REST_EXPORT CreateNamespaceRequest {

/// \brief Update or delete namespace properties request.
struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesRequest {
std::vector<std::string> removals;
std::unordered_map<std::string, std::string> updates;
std::vector<std::string> removals{};
std::unordered_map<std::string, std::string> updates{};

/// \brief Validates the UpdateNamespacePropertiesRequest.
Status Validate() const {
Expand Down Expand Up @@ -142,13 +142,13 @@ struct ICEBERG_REST_EXPORT RenameTableRequest {

/// \brief Request to create a table.
struct ICEBERG_REST_EXPORT CreateTableRequest {
std::string name; // required
std::string location;
std::shared_ptr<Schema> schema; // required
std::shared_ptr<PartitionSpec> partition_spec;
std::shared_ptr<SortOrder> write_order;
std::string name = ""; // required
std::string location = "";
std::shared_ptr<Schema> schema = nullptr; // required
std::shared_ptr<PartitionSpec> partition_spec = nullptr;
std::shared_ptr<SortOrder> write_order = nullptr;
bool stage_create = false;
std::unordered_map<std::string, std::string> properties;
std::unordered_map<std::string, std::string> properties{};

/// \brief Validates the CreateTableRequest.
Status Validate() const {
Expand All @@ -169,9 +169,9 @@ using PageToken = std::string;

/// \brief Result body for table create/load/register APIs.
struct ICEBERG_REST_EXPORT LoadTableResult {
std::string metadata_location;
std::shared_ptr<TableMetadata> metadata; // required
std::unordered_map<std::string, std::string> config;
std::string metadata_location = "";
std::shared_ptr<TableMetadata> metadata = nullptr; // required
std::unordered_map<std::string, std::string> config{};
// TODO(Li Feiyang): Add std::shared_ptr<StorageCredential> storage_credential;

/// \brief Validates the LoadTableResult.
Expand All @@ -194,7 +194,7 @@ using LoadTableResponse = LoadTableResult;
/// \brief Response body for listing namespaces.
struct ICEBERG_REST_EXPORT ListNamespacesResponse {
PageToken next_page_token;
std::vector<Namespace> namespaces;
std::vector<Namespace> namespaces{};

/// \brief Validates the ListNamespacesResponse.
Status Validate() const { return {}; }
Expand All @@ -205,7 +205,7 @@ struct ICEBERG_REST_EXPORT ListNamespacesResponse {
/// \brief Response body after creating a namespace.
struct ICEBERG_REST_EXPORT CreateNamespaceResponse {
Namespace namespace_; // required
std::unordered_map<std::string, std::string> properties;
std::unordered_map<std::string, std::string> properties{};

/// \brief Validates the CreateNamespaceResponse.
Status Validate() const { return {}; }
Expand All @@ -216,7 +216,7 @@ struct ICEBERG_REST_EXPORT CreateNamespaceResponse {
/// \brief Response body for loading namespace properties.
struct ICEBERG_REST_EXPORT GetNamespaceResponse {
Namespace namespace_; // required
std::unordered_map<std::string, std::string> properties;
std::unordered_map<std::string, std::string> properties{};

/// \brief Validates the GetNamespaceResponse.
Status Validate() const { return {}; }
Expand All @@ -226,9 +226,9 @@ struct ICEBERG_REST_EXPORT GetNamespaceResponse {

/// \brief Response body after updating namespace properties.
struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse {
std::vector<std::string> updated; // required
std::vector<std::string> removed; // required
std::vector<std::string> missing;
std::vector<std::string> updated{}; // required
std::vector<std::string> removed{}; // required
std::vector<std::string> missing{};

/// \brief Validates the UpdateNamespacePropertiesResponse.
Status Validate() const { return {}; }
Expand All @@ -239,7 +239,7 @@ struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse {
/// \brief Response body for listing tables in a namespace.
struct ICEBERG_REST_EXPORT ListTablesResponse {
PageToken next_page_token;
std::vector<TableIdentifier> identifiers;
std::vector<TableIdentifier> identifiers{};

/// \brief Validates the ListTablesResponse.
Status Validate() const { return {}; }
Expand All @@ -249,9 +249,9 @@ struct ICEBERG_REST_EXPORT ListTablesResponse {

/// \brief Request to commit changes to a table.
struct ICEBERG_REST_EXPORT CommitTableRequest {
TableIdentifier identifier;
std::vector<std::shared_ptr<TableRequirement>> requirements; // required
std::vector<std::shared_ptr<TableUpdate>> updates; // required
TableIdentifier identifier{};
std::vector<std::shared_ptr<TableRequirement>> requirements{}; // required
std::vector<std::shared_ptr<TableUpdate>> updates{}; // required

/// \brief Validates the CommitTableRequest.
Status Validate() const { return {}; }
Expand Down
11 changes: 7 additions & 4 deletions src/iceberg/expression/binder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,23 @@ Result<bool> IsBoundVisitor::Or(bool left_result, bool right_result) {
return left_result && right_result;
}

Result<bool> IsBoundVisitor::Predicate(const std::shared_ptr<BoundPredicate>& pred) {
Result<bool> IsBoundVisitor::Predicate(
[[maybe_unused]] const std::shared_ptr<BoundPredicate>& pred) {
return true;
}

Result<bool> IsBoundVisitor::Predicate(const std::shared_ptr<UnboundPredicate>& pred) {
Result<bool> IsBoundVisitor::Predicate(
[[maybe_unused]] const std::shared_ptr<UnboundPredicate>& pred) {
return false;
}

Result<bool> IsBoundVisitor::Aggregate(const std::shared_ptr<BoundAggregate>& aggregate) {
Result<bool> IsBoundVisitor::Aggregate(
[[maybe_unused]] const std::shared_ptr<BoundAggregate>& aggregate) {
return true;
}

Result<bool> IsBoundVisitor::Aggregate(
const std::shared_ptr<UnboundAggregate>& aggregate) {
[[maybe_unused]] const std::shared_ptr<UnboundAggregate>& aggregate) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/iceberg/expression/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ICEBERG_EXPORT Expression : public util::Formattable {
/// \brief Returns whether this expression will accept the same values as another.
/// \param other another expression
/// \return true if the expressions are equivalent
virtual bool Equals(const Expression& other) const {
virtual bool Equals([[maybe_unused]] const Expression& other) const {
// only bound predicates can be equivalent
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/iceberg/expression/expression_visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ class ICEBERG_EXPORT BoundVisitor : public ExpressionVisitor<R> {

/// \brief Visit an IS_NAN bound expression.
/// \param expr The bound expression being tested
virtual Result<R> IsNaN(const std::shared_ptr<Bound>& expr) {
virtual Result<R> IsNaN([[maybe_unused]] const std::shared_ptr<Bound>& expr) {
return NotSupported("IsNaN operation is not supported by this visitor");
}

/// \brief Visit a NOT_NAN bound expression.
/// \param expr The bound expression being tested
virtual Result<R> NotNaN(const std::shared_ptr<Bound>& expr) {
virtual Result<R> NotNaN([[maybe_unused]] const std::shared_ptr<Bound>& expr) {
return NotSupported("NotNaN operation is not supported by this visitor");
}

Expand Down
3 changes: 2 additions & 1 deletion src/iceberg/expression/expressions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ std::shared_ptr<NamedReference> Expressions::Ref(std::string name) {
return ref;
}

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

Expand Down
8 changes: 5 additions & 3 deletions src/iceberg/expression/inclusive_metrics_evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
return kRowsMightMatch;
}

Result<bool> NotEq(const std::shared_ptr<Bound>& expr, const Literal& lit) override {
Result<bool> NotEq([[maybe_unused]] const std::shared_ptr<Bound>& expr,
[[maybe_unused]] const Literal& lit) override {
// because the bounds are not necessarily a min or max value, this cannot be answered
// using them. notEq(col, X) with (X, Y) doesn't guarantee that X is a value in col.
return kRowsMightMatch;
Expand Down Expand Up @@ -267,8 +268,9 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
return kRowsMightMatch;
}

Result<bool> NotIn(const std::shared_ptr<Bound>& expr,
const BoundSetPredicate::LiteralSet& literal_set) override {
Result<bool> NotIn(
[[maybe_unused]] const std::shared_ptr<Bound>& expr,
[[maybe_unused]] const BoundSetPredicate::LiteralSet& literal_set) override {
// because the bounds are not necessarily a min or max value, this cannot be answered
// using them. notIn(col, {X, ...}) with (X, Y) doesn't guarantee that X is a value in
// col.
Expand Down
7 changes: 4 additions & 3 deletions src/iceberg/expression/literal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <concepts>
#include <cstdint>
#include <string>
#include <utility>

#include "iceberg/util/checked_cast.h"
#include "iceberg/util/conversions.h"
Expand Down Expand Up @@ -245,7 +246,7 @@ Result<Literal> LiteralCaster::CastFromBinary(
switch (target_type->type_id()) {
case TypeId::kFixed: {
auto target_fixed_type = internal::checked_pointer_cast<FixedType>(target_type);
if (binary_val.size() == target_fixed_type->length()) {
if (std::cmp_equal(binary_val.size(), target_fixed_type->length())) {
return Literal::Fixed(std::move(binary_val));
}
return InvalidArgument("Failed to cast Binary with length {} to Fixed({})",
Expand Down Expand Up @@ -525,8 +526,8 @@ bool Literal::IsAboveMax() const { return std::holds_alternative<AboveMax>(value
bool Literal::IsNull() const { return std::holds_alternative<std::monostate>(value_); }

bool Literal::IsNaN() const {
return std::holds_alternative<float>(value_) && std::isnan(std::get<float>(value_)) ||
std::holds_alternative<double>(value_) && std::isnan(std::get<double>(value_));
return (std::holds_alternative<float>(value_) && std::isnan(std::get<float>(value_))) ||
(std::holds_alternative<double>(value_) && std::isnan(std::get<double>(value_)));
}

// LiteralCaster implementation
Expand Down
12 changes: 7 additions & 5 deletions src/iceberg/expression/manifest_evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ class ManifestEvalVisitor : public BoundVisitor<bool> {
return kRowsMightMatch;
}

Result<bool> NotEq(const std::shared_ptr<Bound>& expr, const Literal& lit) override {
Result<bool> NotEq([[maybe_unused]] const std::shared_ptr<Bound>& expr,
[[maybe_unused]] const Literal& lit) override {
// because the bounds are not necessarily a min or max value, this cannot be answered
// using them. notEq(col, X) with (X, Y) doesn't guarantee that X is a value in col.
return kRowsMightMatch;
Expand Down Expand Up @@ -222,8 +223,9 @@ class ManifestEvalVisitor : public BoundVisitor<bool> {
return kRowsMightMatch;
}

Result<bool> NotIn(const std::shared_ptr<Bound>& expr,
const BoundSetPredicate::LiteralSet& literal_set) override {
Result<bool> NotIn(
[[maybe_unused]] const std::shared_ptr<Bound>& expr,
[[maybe_unused]] const BoundSetPredicate::LiteralSet& literal_set) override {
// because the bounds are not necessarily a min or max value, this cannot be answered
// using them. notIn(col, {X, ...}) with (X, Y) doesn't guarantee that X is a value in
// col.
Expand Down Expand Up @@ -339,8 +341,8 @@ class ManifestEvalVisitor : public BoundVisitor<bool> {
if (!type->is_primitive()) {
return NotSupported("Bounds of non-primitive partition fields are not supported.");
}
return Literal::Deserialize(
bound, std::move(internal::checked_pointer_cast<PrimitiveType>(type)));
return Literal::Deserialize(bound,
internal::checked_pointer_cast<PrimitiveType>(type));
}

private:
Expand Down
4 changes: 2 additions & 2 deletions src/iceberg/expression/projections.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ProjectionVisitor : public ExpressionVisitor<std::shared_ptr<Expression>>
Result<std::shared_ptr<Expression>> AlwaysFalse() override { return False::Instance(); }

Result<std::shared_ptr<Expression>> Not(
const std::shared_ptr<Expression>& child_result) override {
[[maybe_unused]] const std::shared_ptr<Expression>& child_result) override {
return InvalidExpression("Project called on expression with a not");
}

Expand All @@ -70,7 +70,7 @@ class ProjectionVisitor : public ExpressionVisitor<std::shared_ptr<Expression>>
}

Result<std::shared_ptr<Expression>> Predicate(
const std::shared_ptr<BoundPredicate>& pred) override {
[[maybe_unused]] const std::shared_ptr<BoundPredicate>& pred) override {
return InvalidExpression("Bound predicates are not supported in projections");
}

Expand Down
2 changes: 1 addition & 1 deletion src/iceberg/expression/projections.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ICEBERG_EXPORT ProjectionEvaluator {
Result<std::shared_ptr<Expression>> Project(const std::shared_ptr<Expression>& expr);

private:
friend class Projections;
friend struct Projections;

/// \brief Create a ProjectionEvaluator.
///
Expand Down
8 changes: 4 additions & 4 deletions src/iceberg/expression/strict_metrics_evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,13 @@ class StrictMetricsVisitor : public BoundVisitor<bool> {
return kRowsMightNotMatch;
}

Result<bool> StartsWith(const std::shared_ptr<Bound>& expr,
const Literal& lit) override {
Result<bool> StartsWith([[maybe_unused]] const std::shared_ptr<Bound>& expr,
[[maybe_unused]] const Literal& lit) override {
return kRowsMightNotMatch;
}

Result<bool> NotStartsWith(const std::shared_ptr<Bound>& expr,
const Literal& lit) override {
Result<bool> NotStartsWith([[maybe_unused]] const std::shared_ptr<Bound>& expr,
[[maybe_unused]] const Literal& lit) override {
// TODO(xiao.dong) Handle cases that definitely cannot match,
// such as notStartsWith("x") when
// the bounds are ["a", "b"].
Expand Down
9 changes: 5 additions & 4 deletions src/iceberg/file_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class ICEBERG_EXPORT FileIO {
/// the length to read, e.g. S3 `GetObject` has a Range parameter.
/// \return The content of the file if the read succeeded, an error code if the read
/// failed.
virtual Result<std::string> ReadFile(const std::string& file_location,
std::optional<size_t> length) {
virtual Result<std::string> ReadFile([[maybe_unused]] const std::string& file_location,
[[maybe_unused]] std::optional<size_t> length) {
// We provide a default implementation to avoid Windows linker error LNK2019.
return NotImplemented("ReadFile not implemented");
}
Expand All @@ -62,15 +62,16 @@ class ICEBERG_EXPORT FileIO {
/// \param overwrite If true, overwrite the file if it exists. If false, fail if the
/// file exists.
/// \return void if the write succeeded, an error code if the write failed.
virtual Status WriteFile(const std::string& file_location, std::string_view content) {
virtual Status WriteFile([[maybe_unused]] const std::string& file_location,
[[maybe_unused]] std::string_view content) {
return NotImplemented("WriteFile not implemented");
}

/// \brief Delete a file at the given location.
///
/// \param file_location The location of the file to delete.
/// \return void if the delete succeeded, an error code if the delete failed.
virtual Status DeleteFile(const std::string& file_location) {
virtual Status DeleteFile([[maybe_unused]] const std::string& file_location) {
return NotImplemented("DeleteFile not implemented");
}
};
Expand Down
Loading
Loading