File tree Expand file tree Collapse file tree 6 files changed +445
-64
lines changed Expand file tree Collapse file tree 6 files changed +445
-64
lines changed Original file line number Diff line number Diff line change 2222#include < memory>
2323#include < string>
2424
25- #include " iceberg/result.h"
26-
2725namespace iceberg {
28- class Schema ;
26+
27+ // / Operation types for expressions
28+ enum class Operation {
29+ kTrue ,
30+ kFalse ,
31+ kIsNull ,
32+ kNotNull ,
33+ kIsNan ,
34+ kNotNan ,
35+ kLt ,
36+ kLtEq ,
37+ kGt ,
38+ kGtEq ,
39+ kEq ,
40+ kNotEq ,
41+ kIn ,
42+ kNotIn ,
43+ kNot ,
44+ kAnd ,
45+ kOr ,
46+ kStartsWith ,
47+ kNotStartsWith ,
48+ kCount ,
49+ kCountStar ,
50+ kMax ,
51+ kMin
52+ };
53+
54+ // / \brief Returns whether the operation is a predicate operation.
55+ constexpr bool IsPredicate (Operation op) {
56+ switch (op) {
57+ case Operation::kTrue :
58+ case Operation::kFalse :
59+ case Operation::kIsNull :
60+ case Operation::kNotNull :
61+ case Operation::kIsNan :
62+ case Operation::kNotNan :
63+ case Operation::kLt :
64+ case Operation::kLtEq :
65+ case Operation::kGt :
66+ case Operation::kGtEq :
67+ case Operation::kEq :
68+ case Operation::kNotEq :
69+ case Operation::kIn :
70+ case Operation::kNotIn :
71+ case Operation::kNot :
72+ case Operation::kAnd :
73+ case Operation::kOr :
74+ case Operation::kStartsWith :
75+ case Operation::kNotStartsWith :
76+ return true ;
77+ case Operation::kCount :
78+ case Operation::kCountStar :
79+ case Operation::kMax :
80+ case Operation::kMin :
81+ return false ;
82+ }
83+ return false ;
84+ }
85+
86+ constexpr bool IsUnaryPredicate (Operation op) {
87+ switch (op) {
88+ case Operation::kIsNull :
89+ case Operation::kNotNull :
90+ case Operation::kIsNan :
91+ case Operation::kNotNan :
92+ return true ;
93+ default :
94+ return false ;
95+ }
96+ }
97+ constexpr bool IsBinaryPredicate (Operation op) {
98+ switch (op) {
99+ case Operation::kLt :
100+ case Operation::kLtEq :
101+ case Operation::kGt :
102+ case Operation::kGtEq :
103+ case Operation::kEq :
104+ case Operation::kNotEq :
105+ case Operation::kIn :
106+ case Operation::kNotIn :
107+ case Operation::kAnd :
108+ case Operation::kOr :
109+ case Operation::kStartsWith :
110+ case Operation::kNotStartsWith :
111+ return true ;
112+ default :
113+ return false ;
114+ }
115+ }
29116
30117} // namespace iceberg
You can’t perform that action at this time.
0 commit comments