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
1 change: 0 additions & 1 deletion src/iceberg/expression/expressions.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <string>
#include <vector>

#include "iceberg/exception.h"
#include "iceberg/expression/literal.h"
#include "iceberg/expression/predicate.h"
#include "iceberg/expression/term.h"
Expand Down
15 changes: 13 additions & 2 deletions src/iceberg/expression/predicate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "iceberg/expression/predicate.h"

#include <algorithm>
#include <cmath>
#include <format>

#include "iceberg/expression/expressions.h"
Expand Down Expand Up @@ -50,7 +49,9 @@ Result<std::unique_ptr<UnboundPredicateImpl<B>>> UnboundPredicateImpl<B>::Make(
if (!term) [[unlikely]] {
return InvalidExpression("UnboundPredicate cannot have null term");
}
if (op == Expression::Operation::kIn || op == Expression::Operation::kNotIn) {
if (op != Expression::Operation::kIsNull && op != Expression::Operation::kNotNull &&
op != Expression::Operation::kIsNan && op != Expression::Operation::kNotNan)
[[unlikely]] {
return InvalidExpression("Cannot create {} predicate without a value",
::iceberg::ToString(op));
}
Expand All @@ -64,6 +65,16 @@ Result<std::unique_ptr<UnboundPredicateImpl<B>>> UnboundPredicateImpl<B>::Make(
if (!term) [[unlikely]] {
return InvalidExpression("UnboundPredicate cannot have null term");
}
if (op == Expression::Operation::kIsNull || op == Expression::Operation::kNotNull ||
op == Expression::Operation::kIsNan || op == Expression::Operation::kNotNan)
[[unlikely]] {
return InvalidExpression("Cannot create {} predicate inclusive a value",
::iceberg::ToString(op));
}
if (value.IsNaN()) [[unlikely]] {
return InvalidExpression(
"Invalid expression literal: NaN, use isNaN or notNaN instead");
}
return std::unique_ptr<UnboundPredicateImpl<B>>(
new UnboundPredicateImpl<B>(op, std::move(term), std::move(value)));
}
Expand Down
Loading