Comments (11)
I confirm that 1b396c4 fixes our more involved case in practice.
from arrow-datafusion.
I think this is related #10660
from arrow-datafusion.
Thanks for the pointers @duongcongtoai
I think the recursive and max_depth options can be a special workaround, but introduce a good amount of complexity. Fixing the push down makes single unnest
composable in general.
from arrow-datafusion.
alternative query
Yes. The problem is that one can't move the filter to the inner query (views) or one shouldn't have to with other common sql constructs (sub queries, ctes).
from arrow-datafusion.
I think we can rewrite Unnest plan in push down filter
from arrow-datafusion.
Thanks for the swift action.
I just found out this second, that the change introduces a new issue when filtering on an unnested struct column (Optimizer rule 'common_sub_expression_eliminate' failed
). Sorry for being late.
I'll file a new issue. The reproducer is less trivial as here.
from arrow-datafusion.
I confirm that 1b396c4 fixes our more involved case in practice.
Thank you @jayzhan211 for the quick response
from arrow-datafusion.
For this kind of query select unnest(unnest([[1],[1,2],[1,2,3]]));
, I think we can follow what Duckdb does.
Unnest with recursive, and max_depth
select unnest([[1],[1,2],[1,2,3]], recursive := true);
or select unnest([[1],[1,2],[1,2,3]], max_depth := 2);
from arrow-datafusion.
@ahirner
I found an alternative query is to move filter into the query
select "unnest(v.column2)" from (select unnest(column2), column1 from v where column1=2);
query TT
explain select "unnest(v.column2)" from (select unnest(column2), column1 from v where column1=2);
----
logical_plan
01)Projection: unnest(v.column2)
02)--Unnest: lists[unnest(v.column2)] structs[]
03)----Projection: v.column2 AS unnest(v.column2), v.column1
04)------Filter: v.column1 = Int64(2)
05)--------TableScan: v projection=[column1, column2]
physical_plan
01)ProjectionExec: expr=[unnest(v.column2)@0 as unnest(v.column2)]
02)--UnnestExec
03)----RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
04)------ProjectionExec: expr=[column2@1 as unnest(v.column2), column1@0 as column1]
05)--------CoalesceBatchesExec: target_batch_size=8192
06)----------FilterExec: column1@0 = 2
07)------------MemoryExec: partitions=1, partition_sizes=[1]
Given that, it might not be necessary to support pushing down outer filter
from arrow-datafusion.
PR to do so: #10974
from arrow-datafusion.
Added issue that's quite minimal but maybe not entirely minimal: #10990
from arrow-datafusion.
Related Issues (20)
- Building time for `cargo bench` takes quite a long time HOT 1
- Potential optimization for CASE WHEN for protecting against divide by zero HOT 1
- Add a sub-project for map udf functions HOT 5
- always failed test on datasource::file_format::csv::tests::test_csv_parallel_one_col::case_6 on windows machine
- Update Optimizer documentation HOT 1
- Implement `evaluate_bounds` for math unary functions HOT 2
- Why is there no content in `Extending DataFusion’s operators: custom LogicalPlan and Execution Plan` HOT 4
- Add NullState::is_null public method
- Typo in doc of datafusion::physical_plan::Partitioning HOT 2
- Expression Simplifier doesn't consider associativity (`(i + 1) + 2)` is not simplified to `i + 3`) HOT 5
- Serialization of UDF might lose aliases HOT 1
- Propagation of ordered `SortProperties` should consider `nulls_first`
- Rename `functions-array` to `functions-nested` to collect all nested-type functions HOT 2
- Consider having `SessionCatalog` also implement `FunctionRegistry` rather than providing access to the hash maps directly
- Review code that `downcast_ref` from `CatalogSession` to `SessionState`
- DataFusion weekly project plan (Andrew Lamb) - July 22, 2024 HOT 1
- Write a blog post about implementing StringView in DataFusion
- Optimize CASE expression to produce dictionary-encoded arrays in some cases
- Decimal256 type is not supported in datafusion-proto
- Ability to chunk download from object store
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 arrow-datafusion.