Skip to content

Commit 83725d7

Browse files
committed
Fix JOIN clause to reference the correct table in SQL query generation
1 parent 07cc9fd commit 83725d7

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

wayang-platforms/wayang-jdbc-template/src/main/java/org/apache/wayang/jdbc/operators/JdbcJoinOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public String createSqlClause(Connection connection, FunctionCompiler compiler)
7373
final String rightTableName = right.field0;
7474
final String rightKey = right.field1;
7575

76-
return "JOIN " + leftTableName + " ON " +
76+
return "JOIN " + rightTableName + " ON " +
7777
rightTableName + "." + rightKey
7878
+ "=" + leftTableName + "." + leftKey;
7979
}

wayang-platforms/wayang-jdbc-template/src/test/java/org/apache/wayang/jdbc/operators/JdbcJoinOperatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void testWithHsqldb() throws SQLException {
119119
System.out.println();
120120

121121
assertEquals(
122-
"SELECT * FROM testA JOIN testA ON testB.a=testA.a;",
122+
"SELECT * FROM testA JOIN testB ON testB.a=testA.a;",
123123
sqlQueryChannelInstance.getSqlQuery()
124124
);
125125
}

0 commit comments

Comments
 (0)