[
https://issues.apache.org/jira/browse/TAJO-939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14069672#comment-14069672
]
ASF GitHub Bot commented on TAJO-939:
-------------------------------------
Github user hyunsik commented on a diff in the pull request:
https://github.com/apache/tajo/pull/71#discussion_r15207047
--- Diff:
tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java ---
@@ -260,7 +262,8 @@ private void setRawTargets(PlanContext context,
Target[] targets, String[] refer
Target [] rawTargets = new Target[projection.getNamedExprs().length];
for (int i = 0; i < projection.getNamedExprs().length; i++) {
NamedExpr namedExpr = projection.getNamedExprs()[i];
- EvalNode evalNode = exprAnnotator.createEvalNode(plan, block,
namedExpr.getExpr());
+ EvalNode evalNode = exprAnnotator.createEvalNode(plan, block,
namedExpr.getExpr(),
--- End diff --
name references in select list can be only actual column names. They are
addressed in the manner at
https://github.com/apache/tajo/pull/71/files#diff-c11c2244fea624cb7b08f6906d554cd4R470.
In contrast, setRawTargets() in visitProjection should deal with actual
fields as well as temporal fields generated by common subexpression
elimination. So, it should use RELS_AND_SUBEXPRS.
> Refactoring the column resolver in LogicalPlan
> ----------------------------------------------
>
> Key: TAJO-939
> URL: https://issues.apache.org/jira/browse/TAJO-939
> Project: Tajo
> Issue Type: Bug
> Components: planner/optimizer
> Reporter: Hyunsik Choi
> Assignee: Hyunsik Choi
> Fix For: 0.9.0
>
>
> The main role of the column resolver is to find the exact column in a
> relation or a temporal column to which a variable name points. We have used a
> monolithic column resolver to deal with lots of cases.
> But, resolving a name should play different roles according to at which the
> name is placed.
> For example, 1) a column name in select list always points one of fields in
> relations, 2) a column name in WHERE clause can point to one of fields in
> relations or one of aliased temporal fields in select list. If there are
> duplicated, the column name firstly chooses the field in relations. 3) a
> column name in ORDER BY clause is similar to that in WHERE clause, but it
> firstly chooses one of aliased temporal fields in select list.
> The current column resolver does not consider the above rules. As a result,
> it works incorrectly in some cases where a sql statement includes the same
> name references, actually indicating one field in relation and one aliased
> temporal field in select list. We should fix it.
--
This message was sent by Atlassian JIRA
(v6.2#6252)