You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "2010YOUY01 (via GitHub)" <gi...@apache.org> on 2024/07/11 08:27:34 UTC

[I] LEFT/RIGHT OUTER JOIN failed to detect ambiguous column reference (SQLancer-NoREC) [datafusion]

2010YOUY01 opened a new issue, #11408:
URL: https://github.com/apache/datafusion/issues/11408

   ### Describe the bug
   
   Table reference in this query is ambiguous, and should be rejected by the planner.
   `select t1.v1 from t1 left outer join t1 on true;`
   Now it can be run successfully, see the reproducer:
   (It can also be reproduced if 'left outer join' is changed to 'left join' 'right join' 'right outer join')
   ```
   > create table t1(v1 int);
   0 row(s) fetched.
   Elapsed 0.068 seconds.
   
   > insert into t1 values (1);
   +-------+
   | count |
   +-------+
   | 1     |
   +-------+
   1 row(s) fetched.
   Elapsed 0.054 seconds.
   
   > select t1.v1 from t1 left outer join t1 on true;
   +----+
   | v1 |
   +----+
   | 1  |
   +----+
   1 row(s) fetched.
   Elapsed 0.016 seconds.
   
   > select v1 from t1 left outer join t1 on true;
   Schema error: Ambiguous reference to unqualified field v1
   ```
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   found by SQLancer https://github.com/apache/datafusion/issues/11030


-- 
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-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] LEFT/RIGHT OUTER JOIN failed to detect ambiguous column reference (SQLancer-NoREC) [datafusion]

Posted by "jonahgao (via GitHub)" <gi...@apache.org>.
jonahgao commented on issue #11408:
URL: https://github.com/apache/datafusion/issues/11408#issuecomment-2227616261

   Might be related to #11464


-- 
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-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] LEFT/RIGHT OUTER JOIN failed to detect ambiguous column reference (SQLancer-NoREC) [datafusion]

Posted by "2010YOUY01 (via GitHub)" <gi...@apache.org>.
2010YOUY01 commented on issue #11408:
URL: https://github.com/apache/datafusion/issues/11408#issuecomment-2226912517

   Note to myself: maybe duplicate
   ```
   NoREC oracle violated:
       Q1(result size 0):SELECT COUNT(*) FROM t2 table1 FULL JOIN t2 table1 ON ((table1.v1)<(((((table1.v2)|(-1680394990)))==(RADIANS(NULL))))) WHERE table1.v3;
       Q2(result size 3):SELECT COUNT(CASE WHEN TABLE1.V3 THEN 1 ELSE NULL END) FROM t2 table1 FULL JOIN t2 AS table1 ON ((table1.v1)<(((((table1.v2)|(-1680394990)))==(RADIANS(NULL)))));
   =======================================
   Reproducer:
   /*DML*/CREATE TABLE t0(v0 BIGINT, v1 BOOLEAN, v2 BOOLEAN, v3 DOUBLE);
   /*DML*/CREATE TABLE t1(v0 DOUBLE);
   /*DML*/CREATE TABLE t2(v0 DOUBLE, v1 BOOLEAN, v2 BIGINT, v3 BOOLEAN);
   /*DML*/INSERT INTO t0(v3, v0, v2) VALUES ('NaN'::Double, 462373142, false);
   /*DML*/INSERT INTO t0(v0, v2) VALUES (462373142, NULL);
   /*DML*/INSERT INTO t1(v0) VALUES (0.23090038573154326);
   /*DML*/INSERT INTO t1(v0) VALUES ('+Inf'::Double), ('+Inf'::Double);
   /*DML*/INSERT INTO t1(v0) VALUES ('+Inf'::Double);
   /*DML*/INSERT INTO t2(v2) VALUES (673041184);
   /*DML*/INSERT INTO t2(v2, v3) VALUES (212832748, false);
   /*DML*/INSERT INTO t2(v3, v0, v2) VALUES (true, 0.9397291016687526, 462373142);
   /*DML*/INSERT INTO t2(v1, v2, v0, v3) VALUES (false, 462373142, 0.6388418793650567, true);
   /*DML*/INSERT INTO t2(v3, v0) VALUES (true, 0.6388418793650567);
   /*DML*/INSERT INTO t2(v0, v2, v3) VALUES (0.31756635573567127, 104424209, false);
   ```


-- 
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-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] LEFT/RIGHT OUTER JOIN failed to detect ambiguous column reference (SQLancer-NoREC) [datafusion]

Posted by "aalexandrov (via GitHub)" <gi...@apache.org>.
aalexandrov commented on issue #11408:
URL: https://github.com/apache/datafusion/issues/11408#issuecomment-2231587943

   Not sure if this is should be classified as a bug or just as an error message that could be improved.
   
   I tested on Postgres, MySQL, and SQL Server and all fail because you cannot have duplicate table names in the FROM list.


-- 
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-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org