Skip to content

Commit

Permalink
Adjust RequestUtils#getTableNames to get table names from both left a…
Browse files Browse the repository at this point in the history
…nd right sides of join (apache#14554)
  • Loading branch information
AlexanderKM authored Nov 28, 2024
1 parent da897dd commit 2d470e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ private static Set<String> getTableNames(DataSource dataSource) {
return getTableNames(dataSource.getSubquery());
} else if (dataSource.isSetJoin()) {
return ImmutableSet.<String>builder().addAll(getTableNames(dataSource.getJoin().getLeft()))
.addAll(getTableNames(dataSource.getJoin().getLeft())).build();
.addAll(getTableNames(dataSource.getJoin().getRight())).build();
}
return ImmutableSet.of(dataSource.getTableName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public void testParseQuery() {
public Object[][] queryProvider() {
return new Object[][] {
{"select foo from countries where bar > 1", Set.of("countries")},
{"select 1", null}
{"select 1", null},
{"SET useMultiStageEngine=true; SELECT table1.foo, table2.bar FROM "
+ "table1 JOIN table2 ON table1.id = table2.id LIMIT 10;", Set.of("table1", "table2")}
};
}

Expand Down

0 comments on commit 2d470e7

Please sign in to comment.