logan-keede commented on issue #14118: URL: https://github.com/apache/datafusion/issues/14118#issuecomment-2595524440
Okay, this definitely sent me on a ride but here are the results after multiple logging statement, function analysis and postgresql's planner analysis, most of which were rather useless the bug stems from what should be an incorrect regex (have not found the code for it yet). Why do I think so? ``` CREATE TABLE t(a int) AS VALUES (1), (2), (3); select * from (select t.a+2 as a from t join t bc using(a)) as bc; --> +---+ | a | +---+ | 3 | | 4 | | 5 | +---+ ``` it seems like this error occurs when beginning of alias matches with actual table name(not vice versa) and culprit code ends up excluding all the columns further inspection reveals that `using_columns` function seems to be working fine for this as it returns ``` [{Column { relation: Some(Bare { table: "t" }), name: "a" }, Column { relation: Some(Bare { table: "t2" }), name: "a" }}] ``` another function [`exclude_using_columns()`](https://github.com/apache/datafusion/blob/dc22b3fc846c23f69325be6e11c8ef204c3dc6be/datafusion/expr/src/utils.rs#L385)(which finds which columns should be excluded) returns ``` {Column { relation: Some(Bare { table: "t2" }), name: "a" }} ``` which also seems fine the problematic part should be the piece of code where this exclusion actually happens(MIA) btw this is the output of logger when we use `bc` alias instead of `t2` ``` [{Column { relation: Some(Bare { table: "t" }), name: "a" }, Column { relation: Some(Bare { table: "bc" }), name: "a" }}] {Column { relation: Some(Bare { table: "t" }), name: "a" }} ``` and bug does not occur when alias is `t` but tablename is `t2` Please assign this issue to me, let me know if I am missing something as I am rather new to this code base or if you have any idea where I can find my "patient" code. Thanks, Logan -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org