@@ -159,87 +159,6 @@ py::object TransformExpression(const Expression &expression, const vector<string
159159py::object TransformFilter (const TableFilter &filter, vector<string> column_path, FilterBackend &backend,
160160 const ArrowType *arrow_type, const string &timezone_config) {
161161 switch (filter.filter_type ) {
162- case TableFilterType::CONSTANT_COMPARISON : {
163- auto &constant_filter = filter.Cast <ConstantFilter>();
164- auto col = backend.MakeColumnRef (column_path);
165- return EmitCompare (backend, constant_filter.comparison_type , std::move (col), constant_filter.constant ,
166- arrow_type, timezone_config);
167- }
168- case TableFilterType::IS_NULL : {
169- auto col = backend.MakeColumnRef (column_path);
170- return backend.IsNull (std::move (col));
171- }
172- case TableFilterType::IS_NOT_NULL : {
173- auto col = backend.MakeColumnRef (column_path);
174- return backend.IsNotNull (std::move (col));
175- }
176- case TableFilterType::CONJUNCTION_AND : {
177- auto &and_filter = filter.Cast <ConjunctionAndFilter>();
178- py::object result = py::none ();
179- for (idx_t i = 0 ; i < and_filter.child_filters .size (); i++) {
180- py::object child_expression =
181- TransformFilter (*and_filter.child_filters [i], column_path, backend, arrow_type, timezone_config);
182- if (child_expression.is (py::none ())) {
183- continue ;
184- }
185- if (result.is (py::none ())) {
186- result = std::move (child_expression);
187- } else {
188- result = backend.And (std::move (result), std::move (child_expression));
189- }
190- }
191- return result;
192- }
193- case TableFilterType::CONJUNCTION_OR : {
194- auto &or_filter = filter.Cast <ConjunctionOrFilter>();
195- py::object result = py::none ();
196- for (idx_t i = 0 ; i < or_filter.child_filters .size (); i++) {
197- py::object child_expression =
198- TransformFilter (*or_filter.child_filters [i], column_path, backend, arrow_type, timezone_config);
199- if (child_expression.is (py::none ())) {
200- continue ;
201- }
202- if (result.is (py::none ())) {
203- result = std::move (child_expression);
204- } else {
205- result = backend.Or (std::move (result), std::move (child_expression));
206- }
207- }
208- return result;
209- }
210- case TableFilterType::STRUCT_EXTRACT : {
211- auto &struct_filter = filter.Cast <StructFilter>();
212- column_path.push_back (struct_filter.child_name );
213- const ArrowType *child_type = nullptr ;
214- if (arrow_type) {
215- child_type = &arrow_type->GetTypeInfo <ArrowStructInfo>().GetChild (struct_filter.child_idx );
216- }
217- return TransformFilter (*struct_filter.child_filter , std::move (column_path), backend, child_type,
218- timezone_config);
219- }
220- case TableFilterType::OPTIONAL_FILTER : {
221- auto &optional_filter = filter.Cast <OptionalFilter>();
222- if (!optional_filter.child_filter ) {
223- return py::none ();
224- }
225- try {
226- return TransformFilter (*optional_filter.child_filter , column_path, backend, arrow_type, timezone_config);
227- } catch (const NotImplementedException &) {
228- return py::none ();
229- }
230- }
231- case TableFilterType::IN_FILTER : {
232- auto &in_filter = filter.Cast <InFilter>();
233- auto col = backend.MakeColumnRef (column_path);
234- // The column's logical type for IN comes from the values themselves
235- // (they share the comparison type). Empty IN lists are not produced
236- // by the optimizer so we can safely index values[0].
237- LogicalType col_logical_type =
238- in_filter.values .empty () ? LogicalType::SQLNULL : in_filter.values .front ().type ();
239- return backend.IsIn (std::move (col), in_filter.values , col_logical_type, timezone_config);
240- }
241- case TableFilterType::DYNAMIC_FILTER :
242- return py::none ();
243162 case TableFilterType::EXPRESSION_FILTER : {
244163 auto &expression_filter = filter.Cast <ExpressionFilter>();
245164 return TransformExpression (*expression_filter.expr , column_path, backend, arrow_type, timezone_config);
0 commit comments