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 @@ -191,6 +191,7 @@ private String add(String specifiedName, EvalNode evalNode) throws PlanningExcep
// if a name already exists, it only just keeps an actual
// expression instead of a column reference.
if (nameToIdBiMap.containsKey(specifiedName)) {

int refId = nameToIdBiMap.get(specifiedName);
EvalNode found = idToEvalBiMap.get(refId);
if (found != null) {
Expand All @@ -204,7 +205,16 @@ private String add(String specifiedName, EvalNode evalNode) throws PlanningExcep
}

if (found.getType() == EvalType.FIELD) {
Integer daggling = idToEvalBiMap.inverse().get(evalNode);
idToEvalBiMap.forcePut(refId, evalNode);
if (daggling != null) {
String name = getPrimaryName(daggling);
idToNamesMap.remove(daggling);
nameToIdBiMap.put(name, refId);
if (!idToNamesMap.get(refId).contains(name)) {
TUtil.putToNestedList(idToNamesMap, refId, name);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ public final void testSelectColumnAliasExistingInRelation2() throws Exception {
cleanupQuery(res);
}

@Test
public final void testSelectColumnAliasExistingInRelation3() throws Exception {
// This is a reproduction code and validator of TAJO-975 Bug
// Please see TAJO-975 in order to know this test in detail.
ResultSet res = executeQuery();
assertResultSet(res);
cleanupQuery(res);
}


@Test
public final void testSelectSameConstantsWithDifferentAliases() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
SELECT l_orderkey FROM (

-- actual test query
SELECT
T1.l_orderkey
FROM
LINEITEM
INNER JOIN (
SELECT
T1.l_orderkey
FROM (
SELECT
LINEITEM.l_orderkey AS l_orderkey
FROM
LINEITEM
) T1
) T1 ON LINEITEM.l_orderkey=T1.l_orderkey

) A ORDER BY l_orderkey; -- for determinant query result
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
l_orderkey
-------------------------------
1
1
1
1
2
3
3
3
3