Comments (6)
This should be a duplicate of #6543
from datafusion.
I think we can change expr from Debug to Display with this issue together. This todo is added in #11797
Expr::Unnest(Unnest { expr }) => {
// TODO: use Display instead of Debug, there is non-unique expression name in projection issue.
write!(f, "UNNEST({expr})")
}
from datafusion.
Although theoretically #6543 can solve this ticket, but i think the bug presented here comes from the internal implementation inside try_process_unnest function itself, and can be fixed within this function
CREATE TABLE unnest_table
AS VALUES
([1,2,3]);
query TT
explain select unnest(column1), unnest(column1) + 1 from unnest_table;
----
Current plan generated (which causes error)
logical_plan
01)Projection: unnest(unnest_table.column1), unnest(unnest_table.column1) + Int64(1)
02)--Unnest: lists[unnest(unnest_table.column1)] structs[]
03)----Projection: unnest_table.column1 AS unnest(unnest_table.column1), unnest_table.column1 AS unnest(unnest_table.column1)
04)------TableScan: unnest_table projection=[column1]
Better plan generated
logical_plan
01)Projection: unnest(unnest_table.column1), unnest(unnest_table.column1) + Int64(1)
02)--Unnest: lists[unnest(unnest_table.column1)] structs[]
03)----Projection: unnest_table.column1 AS unnest(unnest_table.column1)
04)------TableScan: unnest_table projection=[column1]
We also avoid unnecessary columns generated in the intermediate projection step
from datafusion.
datafusion/datafusion/sql/src/select.rs
Line 344 in 58f79e1
At this line, before create new projection nodes, we can deduplicate intermediate unnest expr within inner_projection_exprs
from datafusion.
take
from datafusion.
I also found a different error for the following queries:
select unnest(column1) + unnest(column1) from unnest_table;
External error: query failed: DataFusion error: Schema error: No field named unnest_table.column1. Valid fields are "unnest(unnest_table.column1)".
from datafusion.
Related Issues (20)
- Add min_by and max_by aggregate functions HOT 1
- A simple count() query caused Internal Error in PhysicalOptimizer (SQLancer) HOT 1
- Add additional regexp function `regexp_count()`
- Use GenericStringBuilder to improve performance of UDF split_part
- Document "how to read an explain plan" HOT 9
- Thread panics in SpawnedTask during shutdown. HOT 6
- SMJ full join produces a null join row for a buffered row even the buffered row is joined with streamed row and passes join filter
- Implement GroupsAccumulator for stddev and var aggregaters
- Cannot infer common string type for string concat operation Dictionary(Int32, Utf8) || Dictionary(Int32, Utf8) HOT 2
- Bug detecting datatype in VALUES tuples
- Handle downstream impacts to union's behavioral changes. HOT 5
- Aggregation fuzz testing HOT 4
- Systematic fuzz testing for parquet predicate pushdown HOT 1
- Support protobuf serialization for `ScalarValue::Utf8View` and `ScalarValue::BinaryView`
- Support substrait serialization for `ScalarValue::Utf8View` and `ScalarValue::BinaryView` HOT 1
- Add config flag to convert `Utf8View`/`BinaryView` --> `Utf8` / `Binary` at output
- Add the possibility to work with plan clones directly in `inline_table_scan` HOT 3
- Parquet statistics missing when reading `Utf8` as `Utf8View`
- Panic in `substring()` scalar function (SQLancer)
- Fuse operations in `equal_rows_arr`
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.