Comments (6)
@alamb This is a great idea. As I learn more perhaps I can help.
from datafusion.
This looks very good, pretty much what I implemented. The only question I have remaining is:
If TableScan
has filters
why would that not catch all filters? What does LogicalPlan::Filter
catch that the TableScan.filters
would not? For my specific use case I only need filters on the tables that are present in the query.
from datafusion.
Got it, that makes total sense. I will only care about the accepted pushdown filters, so the TableScan
will work for what we need.
from datafusion.
Thank you @cisaacson
from datafusion.
Moving out of slack into Github so it might be more easily found
If your usecase is to to get the list of filters and tables that appear in a query, one way to do this is:
- Get the list of tables by finding all
LogicalPlan::TableScan
(any Join will have an input from a TableScan) - Get the list of filters/predicates, look in
LogicalPlan::Filter
and potentially the filters on theLogicalPlan::TableScan
So I think it could look something like (untested)
let mut referenced_tables = HashSet::new();
let mut filters = vec![];
// recursively visit all nodes in the tree (including subqueries)
logical_plan.apply_with_subqueries(|plan| {
match plan {
// record table names
LogicalPlan::TableScan(table_scan) => {
referenced_tables.insert(table_scan.table_name);
},
// record filters
LogicalPlan::Filter(filter) => {
filters.push(filter.predicate);
}
// ignore other nodes
_ => {}
Ok(TreeNodeRecursion::Continue)
}
})?;
from datafusion.
If TableScan has filters why would that not catch all filters?
Depending on the value of https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.TableProviderFilterPushDown.html sometimes filters would not be pushed down into the provider
Also filters can be duplicated in the table scan and filter (again depending on the value of the FilterPushDown
from datafusion.
Related Issues (20)
- Convert `Hyperloglog` to UDAF HOT 3
- Support extracting Float{16, 32, 64} statistics from Parquet Data Pages
- Support extracting UInt{8, 16, 32, 64} statistics from Parquet Data Pages
- DataFusion weekly project plan (Andrew Lamb) - June 17, 2024
- Timezone `UTC` is not considered equal to `+00:00` HOT 5
- Create a branch for StringView / BinaryView development HOT 1
- Change `StatisticsConverter::row_group_counts` to return `None` for non existent columns in parquet files HOT 1
- Complete Possible Join Type Handling for EmptyRelation Propagation Rule HOT 3
- Presentation about DataFusion at Microsoft GSL (Grey Systems Lab)
- Conditionally allow to keep partition_by columns when using PARTITIONED BY HOT 1
- Inconsistent behavior in HashJoin Projections HOT 1
- regen.sh is failing in Ubuntu when working with recommended version of protoc HOT 1
- Implement `DynamicTableProvider` in DataFusion Core HOT 2
- Open Variant Type for semi-structured data HOT 2
- push down unnest filter only on non-unnest column HOT 4
- 'common_sub_expression_eliminate' failed on unnested structs field HOT 1
- Implement equality = and inequality <> support for `BinaryView` HOT 2
- Improve filter predicates with `Utf8View` literals
- Convert `ArrayAgg` to UDAF HOT 1
- Reduce test duplication in tests for data page stattistics
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datafusion.