[ 
https://issues.apache.org/jira/browse/IMPALA-7108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16507463#comment-16507463
 ] 

ASF subversion and git services commented on IMPALA-7108:
---------------------------------------------------------

Commit e6ca7ca14d4dc64e0f43547c8d9f156ef42d2818 in impala's branch 
refs/heads/master from Zoltan Borok-Nagy
[ https://git-wip-us.apache.org/repos/asf?p=impala.git;h=e6ca7ca ]

IMPALA-7108: IllegalStateException hit during CardinalityCheckNode.<init>

Since IMPALA-6314 on runtime scalar subqueries we set LIMIT 2
in StmtRewriter.mergeExpr(). We do that because later we add a
CardinalityCheckNode on top of such subqueries and with
LIMIT 2 we can still check if they return more than one row.

In the constructor of CardinalityCheckNode there is a
precondition that checks if the child node has LIMIT 2 to
be certain that we've set the limit for all the necessary
cases.

However, some subqueries will get a LIMIT 1 later breaking the
precondition in CardinalityCheckNode. An example to these
subqueries is a select stmt that selects from an inline view
that returns a single row:

select * from functional.alltypes
where int_col = (select f.id from (
                 select * from functional.alltypes limit 1) f);

Note that we shouldn't add a CardinalityCheckNode to the plan
of this query in the first place. To generate a proper plan I
updated SelectStmt.returnsSingleRow() because this method didn't
handle this case well.

I also changed
the precondition from
Preconditions.checkState(child.getLimit() == 2);
to
Preconditions.checkState(child.getLimit() <= 2);
in order to be more permissive.

I added tests for the aforementioned query.

Change-Id: I82a7a3fe26db3e12131c030c4ad055a9c4955407
Reviewed-on: http://gerrit.cloudera.org:8080/10605
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


>  IllegalStateException hit during CardinalityCheckNode.<init>
> -------------------------------------------------------------
>
>                 Key: IMPALA-7108
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7108
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 3.1.0
>            Reporter: Vincent Tran
>            Assignee: Zoltán Borók-Nagy
>            Priority: Major
>
> The following query produces an IllegalStateException:
> {noformat}
> [localhost:21000] tpch300_parquet> select i.* from lineitem i 
> where i.l_orderkey = ( select t.o_orderkey from ( select * from customer join 
> orders on customer.c_custkey = orders.o_custkey order by 1 limit 1)  t );
> {noformat}
> Could be related to the change in IMPALA-6314
> {noformat}
> I0601 12:24:52.200441  6760 Frontend.java:997] Analyzing query: select i.* 
> from lineitem i where i.l_orderkey = ( select t.o_orderkey from ( select * 
> from customer join orders on customer.c_custkey = orders.o_custkey order by 1 
> limit 1) t )
> I0601 12:24:52.206576  6760 Frontend.java:1009] Analysis finished.
> I0601 12:24:52.210525  6760 jni-util.cc:230] java.lang.IllegalStateException
>       at 
> com.google.common.base.Preconditions.checkState(Preconditions.java:129)
>       at 
> org.apache.impala.planner.CardinalityCheckNode.<init>(CardinalityCheckNode.java:45)
>       at 
> org.apache.impala.planner.SingleNodePlanner.createInlineViewPlan(SingleNodePlanner.java:1104)
>       at 
> org.apache.impala.planner.SingleNodePlanner.createTableRefNode(SingleNodePlanner.java:1525)
>       at 
> org.apache.impala.planner.SingleNodePlanner.createTableRefsPlan(SingleNodePlanner.java:776)
>       at 
> org.apache.impala.planner.SingleNodePlanner.createSelectPlan(SingleNodePlanner.java:614)
>       at 
> org.apache.impala.planner.SingleNodePlanner.createQueryPlan(SingleNodePlanner.java:257)
>       at 
> org.apache.impala.planner.SingleNodePlanner.createSingleNodePlan(SingleNodePlanner.java:147)
>       at org.apache.impala.planner.Planner.createPlan(Planner.java:101)
>       at 
> org.apache.impala.service.Frontend.createExecRequest(Frontend.java:941)
>       at 
> org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1062)
>       at 
> org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:156)
> I0601 12:24:52.274375  6760 status.cc:125] IllegalStateException: null
>     @          0x1891f69  impala::Status::Status()
>     @          0x1e70be6  impala::JniUtil::GetJniExceptionMsg()
>     @          0x1d2e909  impala::JniUtil::CallJniMethod<>()
>     @          0x1d2b563  impala::Frontend::GetExecRequest()
>     @          0x1d4d552  impala::ImpalaServer::ExecuteInternal()
>     @          0x1d4d09a  impala::ImpalaServer::Execute()
>     @          0x1db742c  impala::ImpalaServer::query()
>     @          0x2f0641e  beeswax::BeeswaxServiceProcessor::process_query()
>     @          0x2f0616c  beeswax::BeeswaxServiceProcessor::dispatchCall()
>     @          0x2edfc2d  impala::ImpalaServiceProcessor::dispatchCall()
>     @          0x18502f0  apache::thrift::TDispatchProcessor::process()
>     @          0x1bb1ac9  
> apache::thrift::server::TAcceptQueueServer::Task::run()
>     @          0x1ba90a9  impala::ThriftThread::RunRunnable()
>     @          0x1baa7ad  boost::_mfi::mf2<>::operator()()
>     @          0x1baa643  boost::_bi::list3<>::operator()<>()
>     @          0x1baa38f  boost::_bi::bind_t<>::operator()()
>     @          0x1baa2a2  
> boost::detail::function::void_function_obj_invoker0<>::invoke()
>     @          0x1bef122  boost::function0<>::operator()()
>     @          0x1eda873  impala::Thread::SuperviseThread()
>     @          0x1ee2a0f  boost::_bi::list5<>::operator()<>()
>     @          0x1ee2933  boost::_bi::bind_t<>::operator()()
>     @          0x1ee28f6  boost::detail::thread_data<>::run()
>     @          0x31ddbca  thread_proxy
>     @     0x7f1d612256ba  start_thread
>     @     0x7f1d60f5b41d  clone
> I0601 12:24:52.274433  6760 impala-server.cc:1011] UnregisterQuery(): 
> query_id=b64705fe2b9d154b:e7592d7800000000
> I0601 12:24:52.274439  6760 impala-server.cc:1098] Cancel(): 
> query_id=b64705fe2b9d154b:e7592d7800000000
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to