iceberg-cpp
Loading...
Searching...
No Matches
sanitize_expression.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
24
25#include <cstdint>
26#include <memory>
27#include <string>
28
31#include "iceberg/type_fwd.h"
32
33namespace iceberg {
34
38class ICEBERG_EXPORT SanitizeExpression
39 : public ExpressionVisitor<std::shared_ptr<Expression>> {
40 public:
43 const std::shared_ptr<Expression>& expr);
44
48 const Schema& schema, const std::shared_ptr<Expression>& expr, bool case_sensitive);
49
53 const std::shared_ptr<Expression>& child_result) override;
55 const std::shared_ptr<Expression>& left_result,
56 const std::shared_ptr<Expression>& right_result) override;
58 const std::shared_ptr<Expression>& left_result,
59 const std::shared_ptr<Expression>& right_result) override;
61 const std::shared_ptr<BoundPredicate>& pred) override;
63 const std::shared_ptr<UnboundPredicate>& pred) override;
64
65 private:
67
68 // Microseconds since the Unix epoch, at millisecond precision.
69 int64_t now_;
70 // UTC days since the Unix epoch.
71 int32_t today_;
72};
73
74} // namespace iceberg
An Expression that represents a logical AND operation between two expressions.
Definition expression.h:139
Base visitor for traversing expression trees.
Definition expression_visitor.h:49
An Expression that represents logical NOT operation.
Definition expression.h:289
An Expression that represents a logical OR operation between two expressions.
Definition expression.h:215
Rewrites an expression tree as an unbound expression whose literal values are replaced with type-awar...
Definition sanitize_expression.h:39
Result< std::shared_ptr< Expression > > AlwaysFalse() override
Visit a False expression (always evaluates to false).
static Result< std::shared_ptr< Expression > > Sanitize(const Schema &schema, const std::shared_ptr< Expression > &expr, bool case_sensitive)
Bind expr to schema first, falling back to sanitizing the unbound expression if binding fails.
Result< std::shared_ptr< Expression > > AlwaysTrue() override
Visit a True expression (always evaluates to true).
static Result< std::shared_ptr< Expression > > Sanitize(const std::shared_ptr< Expression > &expr)
Sanitize an expression tree and return an unbound expression.
Result< std::shared_ptr< Expression > > Predicate(const std::shared_ptr< BoundPredicate > &pred) override
Visit a bound predicate.
Result< std::shared_ptr< Expression > > Predicate(const std::shared_ptr< UnboundPredicate > &pred) override
Visit an unbound predicate.
A schema for a Table.
Definition schema.h:51
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::expected< T, E > Result
Result alias.
Definition result.h:88