zzwqqq commented on code in PR #4748:
URL: https://github.com/apache/calcite/pull/4748#discussion_r2702217189


##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -6426,6 +6426,25 @@ private void checkLiteral2(String expression, String 
expected) {
     sql(query).withConfig(c -> c.withExpand(false)).ok(expected);
   }
 
+  /** Test case of
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-7378";>[CALCITE-7378]
+   * Potential incorrect column attribution in RelToSqlConverter due to 
implicit
+   * table alias handling</a>. */
+  @Test void testSubQueryWithSelfJoin() {
+    String query = "select \"product_name\" from \"product\" t1 "
+        + "where \"product_id\" not in (select \"product_id\" "
+        + "from \"product\" t2 "
+        + "where t2.\"product_id\" = t1.\"product_id\" "
+        + "and t1.\"product_id\" = 2 and t2.\"product_id\" = 1)";
+    String expected = "SELECT \"product_name\"\n"

Review Comment:
   > > Table 'sales_fact_1997' not found; did you mean 'SALES_FACT_1997'?
   > 
   > This means that you are using a conformance which is case-sensitive. Look 
backwards for the last !use statement. Does it work if you capitalize the table 
name?
   
   yeah, it works, thanks.



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