Anjali Norwood created IMPALA-6139:
--------------------------------------

             Summary: CTAS with same object as target and source gives 
IllegalStateException
                 Key: IMPALA-6139
                 URL: https://issues.apache.org/jira/browse/IMPALA-6139
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
    Affects Versions: Impala 2.9.0
            Reporter: Anjali Norwood
            Priority: Minor


For CTAS queries where the target and the source are the same object, I get 
IllegalStateException.  Queries are non-sensical, but would be nice to get an 
AnalysisException rather than IllegalStateException.

Here is the repro: 

{code:java}
create table new(c1 int, c2 int);
create table if not exists new as select * from new;
Query: create table if not exists new as select * from new
Query submitted at: 2017-10-16 19:08:09 (Coordinator: 
http://ubuntu-xenial:25000)
ERROR: IllegalStateException: null
{code}

Here is the stacktrace:

{code:java}
I1016 19:08:12.903148 28898 jni-util.cc:196] java.lang.IllegalStateException
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:129)
        at 
org.apache.impala.analysis.AnalysisContext.authorize(AnalysisContext.java:472)
        at org.apache.impala.service.Frontend.analyzeStmt(Frontend.java:927)
        at 
org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1049)
        at 
org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:156)
I1016 19:08:12.955595 28898 status.cc:122] IllegalStateException: null
    @          0x159a8e7  impala::Status::Status()
    @          0x1994147  impala::JniUtil::GetJniExceptionMsg()
    @          0x1845476  impala::JniUtil::CallJniMethod<>()
    @          0x184194b  impala::Frontend::GetExecRequest()
    @          0x18625ea  impala::ImpalaServer::ExecuteInternal()
    @          0x1862132  impala::ImpalaServer::Execute()
    @          0x18ce12e  impala::ImpalaServer::query()
    @          0x1df7ee8  beeswax::BeeswaxServiceProcessor::process_query()
    @          0x1df7c36  beeswax::BeeswaxServiceProcessor::dispatchCall()
    @          0x1de0437  impala::ImpalaServiceProcessor::dispatchCall()
    @          0x15414fa  apache::thrift::TDispatchProcessor::process()
    @          0x1710723  
apache::thrift::server::TAcceptQueueServer::Task::run()
    @          0x170c5ff  impala::ThriftThread::RunRunnable()
    @          0x170dd0b  boost::_mfi::mf2<>::operator()()
    @          0x170dba1  boost::_bi::list3<>::operator()<>()
    @          0x170d8ed  boost::_bi::bind_t<>::operator()()
    @          0x170d800  
boost::detail::function::void_function_obj_invoker0<>::invoke()
    @          0x171c0f4  boost::function0<>::operator()()
    @          0x19f2e4b  impala::Thread::SuperviseThread()
    @          0x19fb9de  boost::_bi::list4<>::operator()<>()
    @          0x19fb921  boost::_bi::bind_t<>::operator()()
    @          0x19fb8e4  boost::detail::thread_data<>::run()
    @          0x20a61ca  thread_proxy
    @     0x7f64f69246ba  start_thread
    @     0x7f64f665a3dd  clone
{code}

Using a view based on the same table as destination table name also gives 
IllegalStateException

{code:java}
create view view1 as select * from new;
create table if not exists new as select * from view1;
Query: create table if not exists new as select * from view1
Query submitted at: 2017-10-16 19:08:53 (Coordinator: 
http://ubuntu-xenial:25000)
ERROR: IllegalStateException: null
{code}

The stacktrace is here:

{code:java}
I1016 19:08:56.818511 28898 jni-util.cc:196] java.lang.IllegalStateException
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:129)
        at 
org.apache.impala.analysis.DescriptorTable.toThrift(DescriptorTable.java:174)
        at 
org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1103)
        at 
org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:156)
I1016 19:08:56.869375 28898 status.cc:122] IllegalStateException: null
    @          0x159a8e7  impala::Status::Status()
    @          0x1994147  impala::JniUtil::GetJniExceptionMsg()
    @          0x1845476  impala::JniUtil::CallJniMethod<>()
    @          0x184194b  impala::Frontend::GetExecRequest()
    @          0x18625ea  impala::ImpalaServer::ExecuteInternal()
    @          0x1862132  impala::ImpalaServer::Execute()
    @          0x18ce12e  impala::ImpalaServer::query()
    @          0x1df7ee8  beeswax::BeeswaxServiceProcessor::process_query()
    @          0x1df7c36  beeswax::BeeswaxServiceProcessor::dispatchCall()
    @          0x1de0437  impala::ImpalaServiceProcessor::dispatchCall()
    @          0x15414fa  apache::thrift::TDispatchProcessor::process()
    @          0x1710723  
apache::thrift::server::TAcceptQueueServer::Task::run()
    @          0x170c5ff  impala::ThriftThread::RunRunnable()
    @          0x170dd0b  boost::_mfi::mf2<>::operator()()
    @          0x170dba1  boost::_bi::list3<>::operator()<>()
    @          0x170d8ed  boost::_bi::bind_t<>::operator()()
    @          0x170d800  
boost::detail::function::void_function_obj_invoker0<>::invoke()
    @          0x171c0f4  boost::function0<>::operator()()
    @          0x19f2e4b  impala::Thread::SuperviseThread()
    @          0x19fb9de  boost::_bi::list4<>::operator()<>()
    @          0x19fb921  boost::_bi::bind_t<>::operator()()
    @          0x19fb8e4  boost::detail::thread_data<>::run()
    @          0x20a61ca  thread_proxy
    @     0x7f64f69246ba  start_thread
    @     0x7f64f665a3dd  clone
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to