Hyoungjun Kim created TAJO-1557:
-----------------------------------
Summary: ProjectionPushDownRule throws NPE when the alias is the
same column name.
Key: TAJO-1557
URL: https://issues.apache.org/jira/browse/TAJO-1557
Project: Tajo
Issue Type: Bug
Reporter: Hyoungjun Kim
Priority: Minor
The next query uses the alias as column name. In this case
ProjectionPushDownRule throws NPE.
{code:sql}
select l_orderkey, sum(l_partkey) l_partkey
from
(select l_orderkey as l_orderkey, l_partkey as l_partkey
from lineitem, orders
where l_orderkey = o_orderkey) a,
orders
where l_orderkey = o_orderkey
group by l_orderkey;
{code}
{noformat}
Stack Trace:
java.lang.NullPointerException
at
org.apache.tajo.plan.rewrite.rules.ProjectionPushDownRule.buildGroupByTarget(ProjectionPushDownRule.java:815)
at
org.apache.tajo.plan.rewrite.rules.ProjectionPushDownRule.visitGroupBy(ProjectionPushDownRule.java:787)
at
org.apache.tajo.plan.rewrite.rules.ProjectionPushDownRule.visitGroupBy(ProjectionPushDownRule.java:47)
at
org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:81)
at
org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor.visitProjection(BasicLogicalPlanVisitor.java:173)
at
org.apache.tajo.plan.rewrite.rules.ProjectionPushDownRule.visitProjection(ProjectionPushDownRule.java:461)
at
org.apache.tajo.plan.rewrite.rules.ProjectionPushDownRule.visitProjection(ProjectionPushDownRule.java:47)
at
org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:69)
at
org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor.visitRoot(BasicLogicalPlanVisitor.java:151)
at
org.apache.tajo.plan.rewrite.rules.ProjectionPushDownRule.visitRoot(ProjectionPushDownRule.java:444)
at
org.apache.tajo.plan.rewrite.rules.ProjectionPushDownRule.visitRoot(ProjectionPushDownRule.java:47)
at
org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:60)
at
org.apache.tajo.plan.rewrite.rules.ProjectionPushDownRule.rewrite(ProjectionPushDownRule.java:81)
at
org.apache.tajo.plan.rewrite.BaseLogicalPlanRewriteEngine.rewrite(BaseLogicalPlanRewriteEngine.java:80)
at
org.apache.tajo.plan.LogicalOptimizer.optimize(LogicalOptimizer.java:102)
at
org.apache.tajo.master.GlobalEngine.createLogicalPlan(GlobalEngine.java:278)
at
org.apache.tajo.master.GlobalEngine.executeQuery(GlobalEngine.java:188)
at
org.apache.tajo.master.TajoMasterClientService$TajoMasterClientProtocolServiceHandler.submitQuery(TajoMasterClientService.java:287)
at
org.apache.tajo.ipc.TajoMasterClientProtocol$TajoMasterClientProtocolService$2.callBlockingMethod(TajoMasterClientProtocol.java:543)
at
org.apache.tajo.rpc.BlockingRpcServer$ServerHandler.channelRead(BlockingRpcServer.java:113)
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:182)
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130)
at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:744)
{noformat}
I had to investigate the cause. GroupByNode has l_partkey target and this is
mapped into sum(l_partkey) EvalNoce. After that JoinNode also has l_partkey
target and this is mapped into not sum(l_partkey) EvalNode but field(l_partkey)
EvalNode in the TargetListManager.add() method.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)