@@ -40,48 +40,11 @@ struct PERSPECTIVE_EXPORT t_expression_error {
40
40
t_index m_column;
41
41
};
42
42
43
- /* *
44
- * @brief Contains the metadata for a single expression and the methods which
45
- * will compute the expression's output.
46
- */
47
- class PERSPECTIVE_EXPORT t_computed_expression {
48
- public:
49
- PSP_NON_COPYABLE (t_computed_expression);
50
-
51
- t_computed_expression (
52
- std::string expression_alias,
53
- std::string expression_string,
54
- std::string parsed_expression_string,
55
- const std::vector<std::pair<std::string, std::string>>& column_ids,
56
- t_dtype dtype
57
- );
58
-
59
- void compute (
60
- const std::shared_ptr<t_data_table>& source_table,
61
- const t_gstate::t_mapping& pkey_map,
62
- const std::shared_ptr<t_data_table>& destination_table,
63
- t_expression_vocab& vocab,
64
- t_regex_mapping& regex_mapping
65
- ) const ;
66
-
67
- const std::string& get_expression_alias () const ;
68
- const std::string& get_expression_string () const ;
69
- const std::string& get_parsed_expression_string () const ;
70
- const std::vector<std::pair<std::string, std::string>>&
71
- get_column_ids () const ;
72
- t_dtype get_dtype () const ;
73
-
74
- private:
75
- std::string m_expression_alias;
76
- std::string m_expression_string;
77
- std::string m_parsed_expression_string;
78
- std::vector<std::pair<std::string, std::string>> m_column_ids;
79
- t_dtype m_dtype;
80
- };
43
+ class PERSPECTIVE_EXPORT t_computed_expression;
81
44
82
45
class PERSPECTIVE_EXPORT t_computed_expression_parser {
83
46
public:
84
- static void init ();
47
+ t_computed_expression_parser ();
85
48
86
49
/* *
87
50
* @brief Given expression strings, validate the expression's dtype and
@@ -100,7 +63,7 @@ class PERSPECTIVE_EXPORT t_computed_expression_parser {
100
63
* @param schema
101
64
* @return std::shared_ptr<t_computed_expression>
102
65
*/
103
- static std::shared_ptr<t_computed_expression> precompute (
66
+ std::shared_ptr<t_computed_expression> precompute (
104
67
const std::string& expression_alias,
105
68
const std::string& expression_string,
106
69
const std::string& parsed_expression_string,
@@ -110,7 +73,7 @@ class PERSPECTIVE_EXPORT t_computed_expression_parser {
110
73
const std::shared_ptr<t_schema>& schema,
111
74
t_expression_vocab& vocab,
112
75
t_regex_mapping& regex_mapping
113
- );
76
+ ) const ;
114
77
115
78
/* *
116
79
* @brief Returns the dtype of the given expression, or `DTYPE_NONE`
@@ -132,7 +95,7 @@ class PERSPECTIVE_EXPORT t_computed_expression_parser {
132
95
* @param error_string
133
96
* @return t_dtype
134
97
*/
135
- static t_dtype get_dtype (
98
+ t_dtype get_dtype (
136
99
const std::string& expression_alias,
137
100
const std::string& expression_string,
138
101
const std::string& parsed_expression_string,
@@ -143,12 +106,9 @@ class PERSPECTIVE_EXPORT t_computed_expression_parser {
143
106
t_expression_error& error,
144
107
t_expression_vocab& vocab,
145
108
t_regex_mapping& regex_mapping
146
- );
147
-
148
- static std::shared_ptr<exprtk::parser<t_tscalar>> PARSER;
109
+ ) const ;
149
110
150
- // Applied to the parser
151
- static std::size_t PARSER_COMPILE_OPTIONS;
111
+ std::shared_ptr<exprtk::parser<t_tscalar>> m_parser;
152
112
153
113
// Static computed functions have no state
154
114
static computed_function::bucket BUCKET_FN;
@@ -176,6 +136,46 @@ class PERSPECTIVE_EXPORT t_computed_expression_parser {
176
136
static t_tscalar FALSE_SCALAR;
177
137
};
178
138
139
+ /* *
140
+ * @brief Contains the metadata for a single expression and the methods which
141
+ * will compute the expression's output.
142
+ */
143
+ class PERSPECTIVE_EXPORT t_computed_expression {
144
+ public:
145
+ PSP_NON_COPYABLE (t_computed_expression);
146
+
147
+ t_computed_expression (
148
+ std::string expression_alias,
149
+ std::string expression_string,
150
+ std::string parsed_expression_string,
151
+ const std::vector<std::pair<std::string, std::string>>& column_ids,
152
+ t_dtype dtype
153
+ );
154
+
155
+ void compute (
156
+ const std::shared_ptr<t_data_table>& source_table,
157
+ const t_gstate::t_mapping& pkey_map,
158
+ const std::shared_ptr<t_data_table>& destination_table,
159
+ t_expression_vocab& vocab,
160
+ t_regex_mapping& regex_mapping
161
+ ) const ;
162
+
163
+ const std::string& get_expression_alias () const ;
164
+ const std::string& get_expression_string () const ;
165
+ const std::string& get_parsed_expression_string () const ;
166
+ const std::vector<std::pair<std::string, std::string>>&
167
+ get_column_ids () const ;
168
+ t_dtype get_dtype () const ;
169
+
170
+ private:
171
+ std::string m_expression_alias;
172
+ std::string m_expression_string;
173
+ std::string m_parsed_expression_string;
174
+ t_computed_expression_parser m_computed_expression_parser;
175
+ std::vector<std::pair<std::string, std::string>> m_column_ids;
176
+ t_dtype m_dtype;
177
+ };
178
+
179
179
/* *
180
180
* @brief a `t_schema`-like container for validated expression results that
181
181
* offers fast lookups.
0 commit comments