@@ -61,54 +61,6 @@ static void TryApplySpatialFilter(OGRLayer *layer, SpatialFilter *spatial_filter
61
61
}
62
62
}
63
63
64
- // TODO: Verify that this actually corresponds to the same sql subset expected by OGR SQL
65
- static string FilterToGdal (const TableFilter &filter, const string &column_name) {
66
-
67
- switch (filter.filter_type ) {
68
- case TableFilterType::CONSTANT_COMPARISON: {
69
- auto &constant_filter = filter.Cast <ConstantFilter>();
70
- return KeywordHelper::WriteOptionallyQuoted (column_name) +
71
- ExpressionTypeToOperator (constant_filter.comparison_type ) + constant_filter.constant .ToSQLString ();
72
- }
73
- case TableFilterType::CONJUNCTION_AND: {
74
- auto &and_filter = filter.Cast <ConjunctionAndFilter>();
75
- vector<string> filters;
76
- for (const auto &child_filter : and_filter.child_filters ) {
77
- filters.push_back (FilterToGdal (*child_filter, column_name));
78
- }
79
- return StringUtil::Join (filters, " AND " );
80
- }
81
- case TableFilterType::CONJUNCTION_OR: {
82
- auto &or_filter = filter.Cast <ConjunctionOrFilter>();
83
- vector<string> filters;
84
- for (const auto &child_filter : or_filter.child_filters ) {
85
- filters.push_back (FilterToGdal (*child_filter, column_name));
86
- }
87
- return StringUtil::Join (filters, " OR " );
88
- }
89
- case TableFilterType::IS_NOT_NULL: {
90
- return KeywordHelper::WriteOptionallyQuoted (column_name) + " IS NOT NULL" ;
91
- }
92
- case TableFilterType::IS_NULL: {
93
- return KeywordHelper::WriteOptionallyQuoted (column_name) + " IS NULL" ;
94
- }
95
- default :
96
- throw NotImplementedException (" FilterToGdal: filter type not implemented" );
97
- }
98
- }
99
-
100
- static string FilterToGdal (const TableFilterSet &set, const vector<idx_t > &column_ids,
101
- const vector<string> &column_names) {
102
-
103
- vector<string> filters;
104
- for (auto &input_filter : set.filters ) {
105
- auto col_idx = column_ids[input_filter.first ];
106
- auto &col_name = column_names[col_idx];
107
- filters.push_back (FilterToGdal (*input_filter.second , col_name));
108
- }
109
- return StringUtil::Join (filters, " AND " );
110
- }
111
-
112
64
struct GdalScanFunctionData : public TableFunctionData {
113
65
int layer_idx;
114
66
bool sequential_layer_scan = false ;
@@ -153,11 +105,6 @@ struct GdalScanGlobalState : ArrowScanGlobalState {
153
105
unique_ptr<FunctionData> GdalTableFunction::Bind (ClientContext &context, TableFunctionBindInput &input,
154
106
vector<LogicalType> &return_types, vector<string> &names) {
155
107
156
- auto &config = DBConfig::GetConfig (context);
157
- if (!config.options .enable_external_access ) {
158
- throw PermissionException (" Scanning GDAL files is disabled through configuration" );
159
- }
160
-
161
108
auto result = make_uniq<GdalScanFunctionData>();
162
109
163
110
// First scan for "options" parameter
@@ -470,13 +417,6 @@ unique_ptr<GlobalTableFunctionState> GdalTableFunction::InitGlobal(ClientContext
470
417
TryApplySpatialFilter (layer, data.spatial_filter .get ());
471
418
// TODO: Apply projection pushdown
472
419
473
- // Apply predicate pushdown
474
- // We simply create a string out of the predicates and pass it to GDAL.
475
- if (input.filters ) {
476
- auto filter_clause = FilterToGdal (*input.filters , input.column_ids , data.all_names );
477
- layer->SetAttributeFilter (filter_clause.c_str ());
478
- }
479
-
480
420
// Create arrow stream from layer
481
421
482
422
gstate.stream = make_uniq<ArrowArrayStreamWrapper>();
@@ -678,7 +618,6 @@ void GdalTableFunction::Register(DatabaseInstance &db) {
678
618
scan.get_partition_data = ArrowTableFunction::ArrowGetPartitionData;
679
619
680
620
scan.projection_pushdown = true ;
681
- scan.filter_pushdown = true ;
682
621
683
622
scan.named_parameters [" open_options" ] = LogicalType::LIST (LogicalType::VARCHAR);
684
623
scan.named_parameters [" allowed_drivers" ] = LogicalType::LIST (LogicalType::VARCHAR);
0 commit comments