-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duckdb 1.2 update #548
Duckdb 1.2 update #548
Changes from 1 commit
acda61a
a2f32a6
15d5300
09986a1
3ae7f5f
9556f29
b16aed9
912d09f
f556695
c0b9a32
9abe5b4
b912069
f075a41
22d3048
264da7a
2e0597a
9c2a42b
8030edd
f47c105
47eef96
3aa062f
5be0124
b1c162e
0889841
fa5f9ec
753b0ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,23 +18,23 @@ namespace pgduckdb { | |||||
void | ||||||
PostgresScanGlobalState::ConstructQueryFilter(duckdb::TableFilter *filter, const char *column_name) { | ||||||
switch (filter->filter_type) { | ||||||
case duckdb::TableFilterType::CONSTANT_COMPARISON: | ||||||
case duckdb::TableFilterType::IS_NULL: | ||||||
case duckdb::TableFilterType::IS_NOT_NULL: | ||||||
case duckdb::TableFilterType::CONJUNCTION_OR: | ||||||
case duckdb::TableFilterType::CONJUNCTION_AND: | ||||||
case duckdb::TableFilterType::IN_FILTER: | ||||||
scan_query << filter->ToString(column_name).c_str(); | ||||||
break; | ||||||
case duckdb::TableFilterType::OPTIONAL_FILTER: { | ||||||
auto optional_filter = reinterpret_cast<duckdb::OptionalFilter*>(filter); | ||||||
ConstructQueryFilter(optional_filter->child_filter.get(), column_name); | ||||||
break; | ||||||
} | ||||||
case duckdb::TableFilterType::STRUCT_EXTRACT: | ||||||
case duckdb::TableFilterType::DYNAMIC_FILTER: | ||||||
scan_query << "1 = 1"; | ||||||
break; | ||||||
case duckdb::TableFilterType::CONSTANT_COMPARISON: | ||||||
case duckdb::TableFilterType::IS_NULL: | ||||||
case duckdb::TableFilterType::IS_NOT_NULL: | ||||||
case duckdb::TableFilterType::CONJUNCTION_OR: | ||||||
case duckdb::TableFilterType::CONJUNCTION_AND: | ||||||
case duckdb::TableFilterType::IN_FILTER: | ||||||
scan_query << filter->ToString(column_name).c_str(); | ||||||
break; | ||||||
case duckdb::TableFilterType::OPTIONAL_FILTER: { | ||||||
auto optional_filter = reinterpret_cast<duckdb::OptionalFilter *>(filter); | ||||||
ConstructQueryFilter(optional_filter->child_filter.get(), column_name); | ||||||
break; | ||||||
} | ||||||
case duckdb::TableFilterType::STRUCT_EXTRACT: | ||||||
case duckdb::TableFilterType::DYNAMIC_FILTER: | ||||||
scan_query << "1 = 1"; | ||||||
break; | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -186,7 +186,7 @@ duckdb::InsertionOrderPreservingMap<duckdb::string> | |||||
PostgresScanTableFunction::ToString(duckdb::TableFunctionToStringInput &input) { | ||||||
auto &bind_data = input.bind_data->Cast<PostgresScanFunctionData>(); | ||||||
duckdb::InsertionOrderPreservingMap<duckdb::string> result; | ||||||
result["Table"] = GetRelationName(bind_data.rel); | ||||||
result["Table"] = GetRelationName(bind_data.rel); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe interesting to note that it is a PG table?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explain already show it is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't show that for explain analyze for some reason I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
return result; | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a bit of a hack. Do we really need this? If so, can you add a comment explaining why?
Also, is this actually correct? Because now we don't actually filter anything for these filter types inside postgres, but duckdb will not filter on that side either. I feel like we probably need some tests that show that we return correct result when using these kind of things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated construction of pushdown filters. Looking at duckdb code
STRUCT_EXTRACT
is only created ifstruct_extract
is used in query, whileDYNAMIC_FILTER
is constructed when there is topN node (LIMIT). Both of these should not matter to filtering.