Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ public class QueryBlock {
private final Map<String, RelationNode> canonicalNameToRelationMap = TUtil.newHashMap();
private final Map<String, List<String>> aliasMap = TUtil.newHashMap();
private final Map<OpType, List<Expr>> operatorToExprMap = TUtil.newHashMap();
private final List<RelationNode> relationList = TUtil.newList();
/**
* It's a map between nodetype and node. node types can be duplicated. So, latest node type is only kept.
*/
Expand Down Expand Up @@ -668,10 +669,11 @@ public void addRelation(RelationNode relation) {
TUtil.putToNestedList(aliasMap, relation.getTableName(), relation.getCanonicalName());
}
canonicalNameToRelationMap.put(relation.getCanonicalName(), relation);
relationList.add(relation);
}

public Collection<RelationNode> getRelations() {
return this.canonicalNameToRelationMap.values();
return Collections.unmodifiableList(relationList);
}

public boolean hasTableExpression() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ public final void testNotBroadcastJoinSubquery() throws IOException, PlanningExc
@Test
public final void testBroadcastJoinSubquery() throws IOException, PlanningException {
String query = "select count(*) from large1 " +
"join (select * from small1) a on large1_id = a.small1_id " +
"join small2 on large1_id = small2_id";
"join small2 on large1_id = small2_id " +
"join (select * from small1) a on large1_id = a.small1_id";

LogicalPlanner planner = new LogicalPlanner(catalog);
LogicalOptimizer optimizer = new LogicalOptimizer(conf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,11 @@ public final void testJoinOnMultipleDatabasesWithJson() throws Exception {
assertResultSet(res);
cleanupQuery(res);
}

@Test
public final void testJoinAsterisk() throws Exception {
ResultSet res = executeQuery();
assertResultSet(res);
cleanupQuery(res);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select *
from nation b
join customer a on b.n_nationkey = a.c_nationkey
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
n_nationkey,n_name,n_regionkey,n_comment,c_custkey,c_name,c_address,c_nationkey,c_phone,c_acctbal,c_mktsegment,c_comment
-------------------------------
1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon,3,Customer#000000003,MG9kdTD2WBHm,1,11-719-748-3364,7498.12,AUTOMOBILE, deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts abov
3,CANADA,1,eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold,5,Customer#000000005,KvpyuHCplrB84WgAiGV6sYpZq7Tj,3,13-750-942-6364,794.47,HOUSEHOLD,n accounts will have to unwind. foxes cajole accor
4,EGYPT,4,y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d,4,Customer#000000004,XxVSJsLAGtn,4,14-128-190-5944,2866.83,MACHINERY, requests. final, regular ideas sleep final accou
13,JORDAN,4,ic deposits are blithely about the carefully regular pa,2,Customer#000000002,XSTf4,NCwDVaWNe6tEgvwfmRchLXak,13,23-768-687-3665,121.65,AUTOMOBILE,l accounts. blithely ironic theodolites integrate boldly: caref
15,MOROCCO,0,rns. blithely bold courts among the closely regular packages use furiously bold platelets?,1,Customer#000000001,IVhzIApeRb ot,c,E,15,25-989-741-2988,711.56,BUILDING,to the even, regular platelets. regular, ironic epitaphs nag e