parkma99 commented on issue #6677:
URL: 
https://github.com/apache/arrow-datafusion/issues/6677#issuecomment-1597376749

   Hello @alamb ,  I  update the code, got two kinds error:
   
   1.
   ```shell
   [SQL] explain SELECT t1_id, (SELECT sum(t2_int) FROM t2 WHERE t2.t2_id = 
t1.t1_id) as t2_sum from t1
   [Diff] (-expected|+actual)
       logical_plan
       Projection: t1.t1_id, __scalar_sq_2.SUM(t2.t2_int) AS t2_sum
       --Left Join: t1.t1_id = __scalar_sq_2.t2_id
       ----TableScan: t1 projection=[t1_id]
       ----SubqueryAlias: __scalar_sq_2
       ------Projection: SUM(t2.t2_int), t2.t2_id
       --------Aggregate: groupBy=[[t2.t2_id]], aggr=[[SUM(t2.t2_int)]]
       ----------TableScan: t2 projection=[t2_id, t2_int]
       physical_plan
       ProjectionExec: expr=[t1_id@0 as t1_id, SUM(t2.t2_int)@1 as t2_sum]
       --CoalesceBatchesExec: target_batch_size=8192
   -   ----HashJoinExec: mode=Partitioned, join_type=Left, on=[(Column { name: 
"t1_id", index: 0 }, Column { name: "t2_id", index: 1 })]
   +   ----HashJoinExec: mode=Partitioned, join_type=Left, on=[(t1_id@0, 
t2_id@1)]
       ------CoalesceBatchesExec: target_batch_size=8192
   -   --------RepartitionExec: partitioning=Hash([Column { name: "t1_id", 
index: 0 }], 4), input_partitions=4
   +   --------RepartitionExec: partitioning=Hash([t1_id@0], 4), 
input_partitions=4
       ----------MemoryExec: partitions=4, partition_sizes=[1, 0, 0, 0]
       ------ProjectionExec: expr=[SUM(t2.t2_int)@1 as SUM(t2.t2_int), t2_id@0 
as t2_id]
       --------AggregateExec: mode=FinalPartitioned, gby=[t2_id@0 as t2_id], 
aggr=[SUM(t2.t2_int)]
       ----------CoalesceBatchesExec: target_batch_size=8192
   -   ------------RepartitionExec: partitioning=Hash([Column { name: "t2_id", 
index: 0 }], 4), input_partitions=4
   +   ------------RepartitionExec: partitioning=Hash([t2_id@0], 4), 
input_partitions=4
       --------------AggregateExec: mode=Partial, gby=[t2_id@0 as t2_id], 
aggr=[SUM(t2.t2_int)]
       ----------------MemoryExec: partitions=4, partition_sizes=[1, 0, 0, 0]
   at tests/sqllogictests/test_files/subquery.slt:112
   ```
   
   2.
   ```shell
   [SQL] explain select * from hashjoin_datatype_table_t1 t1 right join 
hashjoin_datatype_table_t2 t2 on t1.c3 = t2.c3
   [Diff] (-expected|+actual)
       logical_plan
       Right Join: CAST(t1.c3 AS Decimal128(10, 2)) = t2.c3
       --SubqueryAlias: t1
       ----TableScan: hashjoin_datatype_table_t1 projection=[c1, c2, c3, c4]
       --SubqueryAlias: t2
       ----TableScan: hashjoin_datatype_table_t2 projection=[c1, c2, c3, c4]
       physical_plan
       ProjectionExec: expr=[c1@0 as c1, c2@1 as c2, c3@2 as c3, c4@3 as c4, 
c1@5 as c1, c2@6 as c2, c3@7 as c3, c4@8 as c4]
   -   --SortMergeJoin: join_type=Right, on=[(Column { name: "CAST(t1.c3 AS 
Decimal128(10, 2))", index: 4 }, Column { name: "c3", index: 2 })]
   -   ----SortExec: expr=[CAST(t1.c3 AS Decimal128(10, 2))@4 ASC]
   +   --SortMergeJoin: join_type=Right, on=[(Cast(Cast { expr: Column(Column { 
relation: Some(Bare { table: "t1" }), name: "c3" }), data_type: Decimal128(10, 
2) })@4, c3@2)]
   +   ----SortExec: expr=[Cast(Cast { expr: Column(Column { relation: 
Some(Bare { table: "t1" }), name: "c3" }), data_type: Decimal128(10, 2) })@4 
ASC]
       ------CoalesceBatchesExec: target_batch_size=4096
   -   --------RepartitionExec: partitioning=Hash([Column { name: "CAST(t1.c3 
AS Decimal128(10, 2))", index: 4 }], 2), input_partitions=2
   -   ----------ProjectionExec: expr=[c1@0 as c1, c2@1 as c2, c3@2 as c3, c4@3 
as c4, CAST(c3@2 AS Decimal128(10, 2)) as CAST(t1.c3 AS Decimal128(10, 2))]
   +   --------RepartitionExec: partitioning=Hash([Cast(Cast { expr: 
Column(Column { relation: Some(Bare { table: "t1" }), name: "c3" }), data_type: 
Decimal128(10, 2) })@4], 2), input_partitions=2
   +   ----------ProjectionExec: expr=[c1@0 as c1, c2@1 as c2, c3@2 as c3, c4@3 
as c4, CAST(c3@2 AS Decimal128(10, 2)) as Cast(Cast { expr: Column(Column { 
relation: Some(Bare { table: "t1" }), name: "c3" }), data_type: Decimal128(10, 
2) })]
       ------------RepartitionExec: partitioning=RoundRobinBatch(2), 
input_partitions=1
       --------------MemoryExec: partitions=1, partition_sizes=[1]
       ----SortExec: expr=[c3@2 ASC]
       ------CoalesceBatchesExec: target_batch_size=4096
       --------RepartitionExec: partitioning=Hash([c3@2], 2), input_partitions=2
       ----------RepartitionExec: partitioning=RoundRobinBatch(2), 
input_partitions=1
       ------------MemoryExec: partitions=1, partition_sizes=[1]
   at tests/sqllogictests/test_files/joins.slt:2672
   ```
   
   Case 1: I think changing the slt file is a good option.
   Case 2: I failed to find where used `{:?}`😭. I think It caused by building 
the `Column` Struct by passing `name` is `Debug String`. 


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to