Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/iceberg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(ICEBERG_INCLUDES "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/src>"
set(ICEBERG_SOURCES
arrow_c_data_internal.cc
demo.cc
expression/expression.cc
json_internal.cc
partition_field.cc
partition_spec.cc
Expand All @@ -35,7 +36,6 @@ set(ICEBERG_SOURCES
transform_function.cc
type.cc
snapshot.cc
expression.cc
util/murmurhash3_internal.cc)

set(ICEBERG_STATIC_BUILD_INTERFACE_LIBS)
Expand Down Expand Up @@ -68,6 +68,7 @@ add_iceberg_lib(iceberg

iceberg_install_all_headers(iceberg)

add_subdirectory(expression)
add_subdirectory(util)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_export.h
Expand Down
18 changes: 18 additions & 0 deletions src/iceberg/expression/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

iceberg_install_all_headers(iceberg/expression)
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
* under the License.
*/

#include "expression.h"
#include "iceberg/expression/expression.h"

#include <format>

#include "iceberg/result.h"

namespace iceberg {

// True implementation
Expand Down Expand Up @@ -49,8 +51,7 @@ std::string And::ToString() const {

Result<std::shared_ptr<Expression>> And::Negate() const {
// TODO(yingcai-cy): Implement Or expression
return unexpected(
Error(ErrorKind::kInvalidExpression, "And negation not yet implemented"));
return InvalidExpressionError("And negation not yet implemented");
}

bool And::Equals(const Expression& expr) const {
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions src/iceberg/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,12 @@ auto JsonParseError(const std::format_string<Args...> fmt, Args&&... args)
.message = std::format(fmt, std::forward<Args>(args)...)});
}

/// \brief Create an unexpected error with kInvalidExpression
template <typename... Args>
auto InvalidExpressionError(const std::format_string<Args...> fmt, Args&&... args)
-> unexpected<Error> {
return unexpected<Error>({.kind = ErrorKind::kInvalidExpression,
.message = std::format(fmt, std::forward<Args>(args)...)});
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add an Error wrapper for each ErrorKind? I'd suggest including all those in this PR if needed. #80 might need NoSuchNamespaceError.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea! We can use a separate PR for this.

} // namespace iceberg
2 changes: 1 addition & 1 deletion test/expression_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

#include "iceberg/expression.h"
#include "iceberg/expression/expression.h"

#include <memory>

Expand Down
Loading