You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found this issue since airframe-sql 22.12.3. I'm working on the fix.
cc: @takezoe
[original]
select name, count(*) cnt from (
select id, arbitrary(name) name from A
group by 1
)
group by 1
[resolved]
SELECT arbitrary(name) AS name, count(*) AS cnt <--------- The first selectItem should be just `name`
FROM (SELECT id, arbitrary(name) AS name FROM default.A GROUP BY id)
GROUP BY arbitrary(name) <------------- This also needs to be just `name`
[original plan]
[Aggregate]: (id:?, name:?) => (name:?, cnt:?)
- SingleColumn(Id(name))
- SingleColumn(FunctionCall(count, AllColumns(*), distinct:false, window:None) as cnt)
- GroupingKey(Literal(1),Some(NodeLocation(5,10)))
[Aggregate]: => (id:?, name:?)
- SingleColumn(Id(id))
- SingleColumn(FunctionCall(arbitrary, Id(name), distinct:false, window:None) as name)
- GroupingKey(Literal(1),Some(NodeLocation(3,12)))
[TableRef]
- A
[resolved plan]
[Aggregate]: (id:long, name:?) => (name:?, cnt:?)
- SingleColumn(SingleColumn(FunctionCall(arbitrary, name:string <- [A.name], distinct:false, window:None) as name))
- SingleColumn(FunctionCall(count, AllColumns(), distinct:false, window:None) as cnt)
- GroupingKey(FunctionCall(arbitrary, name:string <- [A.name], distinct:false, window:None),Some(NodeLocation(2,14)))
[Aggregate]: (id:long, name:string) => (id:long, name:?)
- SingleColumn(id:long <- [A.id])
- SingleColumn(FunctionCall(arbitrary, name:string <- [A.name], distinct:false, window:None) as name)
- GroupingKey(id:long <- [A.id],None)
[TableScan]: => (id:long, name:string)
A problem is that resolveAggregateKey rule wrongly replaces Id(name) into FunctionCall(arbitrary, ...), which can be found in the subquery's outputAttributes:
I've found this issue since airframe-sql 22.12.3. I'm working on the fix.
cc: @takezoe
A problem is that resolveAggregateKey rule wrongly replaces Id(name) into FunctionCall(arbitrary, ...), which can be found in the subquery's outputAttributes:
The text was updated successfully, but these errors were encountered: