AngersZh commented on pull request #31485:
URL: https://github.com/apache/spark/pull/31485#issuecomment-774843305
> ```sql
> create table t1 using parquet as select id as a, id as b, id as c from
range(100);
> create table t2 using parquet as select id as a, id as b, id as c from
range(100);
> create table t3 using parquet as select id as a, id as b, id as c from
range(100);
> analyze table t1 compute statistics for all columns;
> analyze table t2 compute statistics for all columns;
> analyze table t3 compute statistics for all columns;
>
> set spark.sql.cbo.enabled=true;
> explain cost
> select * from t3 where c > (select max(t1.c) as tc from t1 join t2 on t1.a
= t2.a and t2.b < 10);
> ```
After current pr the physic plan is
```
== Physical Plan ==
AdaptiveSparkPlan isFinalPlan=false
+- Filter (isnotnull(c#9787L) AND (c#9787L > Subquery subquery#9784,
[id=#246]))
: +- Subquery subquery#9784, [id=#246]
: +- AdaptiveSparkPlan isFinalPlan=false
:+- HashAggregate(keys=[], functions=[max(c#9790L)],
output=[tc#9783L])
: +- Exchange SinglePartition, ENSURE_REQUIREMENTS, [id=#244]
: +- HashAggregate(keys=[],
functions=[partial_max(c#9790L)], output=[max#9799L])
: +- Project [c#9790L]
:+- BroadcastHashJoin [a#9788L], [a#9791L], Inner,
BuildRight, false
: :- Filter isnotnull(a#9788L)
: : +- FileScan parquet
default.t1[a#9788L,c#9790L] Batched: true, DataFilters: [isnotnull(a#9788L)],
Format: Parquet, Location: InMemoryFileIndex(1
paths)[file:/Users/yi.zhu/Documents/project/Angerszh/spark/spark-warehous...,
PartitionFilters: [], PushedFilters: [IsNotNull(a)], ReadSchema:
struct
: +- BroadcastExchange
HashedRelationBroadcastMode(List(input[0, bigint, true]),false), [id=#239]
: +- Project [a#9791L]
: +- Filter ((isnotnull(b#9792L) AND (b#9792L
< 10)) AND isnotnull(a#9791L))
:+- FileScan parquet
default.t2[a#9791L,b#9792L] Batched: true, DataFilters: [isnotnull(b#9792L),
(b#9792L < 10), isnotnull(a#9791L)], Format: Parquet, Location:
InMemoryFileIndex(1
paths)[file:/Users/yi.zhu/Documents/project/Angerszh/spark/spark-warehous...,
PartitionFilters: [], PushedFilters: [IsNotNull(b), LessThan(b,10),
IsNotNull(a)], ReadSchema: struct
+- FileScan parquet default.t3[a#9785L,b#9786L,c#9787L] Batched: true,
DataFilters: [isnotnull(c#9787L)], Format: Parquet, Location:
InMemoryFileIndex(1
paths)[file:/Users/yi.zhu/Documents/project/Angerszh/spark/spark-warehous...,
PartitionFilters: [], PushedFilters: [IsNotNull(c)], ReadSchema:
struct
```
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org
-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org