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

Daniel Becker commented on IMPALA-8719:
---------------------------------------

About a year before this bug report, I cannot reproduce it on the current 
master. Probably it has been fixed. Can we close it?

> SELECT from view fails with "AnalysisException: Column/field reference is 
> ambiguous" after expression rewite
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-8719
>                 URL: https://issues.apache.org/jira/browse/IMPALA-8719
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 3.3.0
>            Reporter: Attila Jeges
>            Priority: Major
>
> Minimal repro:
> {code}
> CREATE DATABASE tmp;
> CREATE TABLE tmp.a_tbl (col1 BIGINT, col2 INT);
> CREATE TABLE tmp.b_tbl (col1 BIGINT);
> CREATE VIEW tmp.c_view
> AS SELECT a.col1 as c1, a.col2 as c2
> FROM tmp.a_tbl a INNER JOIN tmp.b_tbl b ON a.col1 = b.col1;
> SELECT * FROM tmp.c_view WHERE ((c1 = 1 AND c2 = 2) OR (c1 = 11 AND c2 = 12)) 
> AND c2 = 22;
> {code}
> This should return 0 rows, but instead the query fails with "ERROR: 
> IllegalStateException: null" and the impalad log shows the following:
> {code}
> W0627 15:38:07.103969 31182 Expr.java:1201] 
> a94d3fb39954fe29:ef89dd2300000000] Not able to analyze after rewrite: 
> org.apache.impala.common.AnalysisException: Column/field reference is 
> ambiguous: 'col1' conjuncts: CompoundPredicate{op=OR, 
> CompoundPredicate{op=AND, BoolLiteral{value=false} BinaryPredicate{op==, 
> SlotRef{label=a.col1, path=col1, type=BIGINT, id=0} NumericLiteral{value=1, 
> type=TINYINT}}} CompoundPredicate{op=AND, BoolLiteral{value=false} 
> BinaryPredicate{op==, SlotRef{label=a.col1, path=col1, type=BIGINT, id=0} 
> NumericLiteral{value=11, type=TINYINT}}}} BinaryPredicate{op==, 
> SlotRef{label=a.col2, path=col2, type=INT, id=2} NumericLiteral{value=22, 
> type=INT}, isInferred=true}
> I0627 15:38:07.104437 31182 jni-util.cc:288] 
> a94d3fb39954fe29:ef89dd2300000000] java.lang.IllegalStateException
>         at 
> com.google.common.base.Preconditions.checkState(Preconditions.java:133)
>         at 
> org.apache.impala.analysis.SlotRef.isBoundBySlotIds(SlotRef.java:222)
>         at org.apache.impala.analysis.Expr.isBoundBySlotIds(Expr.java:1230)
>         at org.apache.impala.analysis.Expr.isBoundBySlotIds(Expr.java:1230)
>         at org.apache.impala.analysis.Expr.isBoundBySlotIds(Expr.java:1230)
>         at 
> org.apache.impala.planner.HdfsPartitionPruner.prunePartitions(HdfsPartitionPruner.java:124)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createHdfsScanPlan(SingleNodePlanner.java:1265)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createScanNode(SingleNodePlanner.java:1391)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createTableRefNode(SingleNodePlanner.java:1578)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createTableRefsPlan(SingleNodePlanner.java:822)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createSelectPlan(SingleNodePlanner.java:658)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createQueryPlan(SingleNodePlanner.java:261)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createInlineViewPlan(SingleNodePlanner.java:1096)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createTableRefNode(SingleNodePlanner.java:1589)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createTableRefsPlan(SingleNodePlanner.java:822)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createSelectPlan(SingleNodePlanner.java:658)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createQueryPlan(SingleNodePlanner.java:261)
>         at 
> org.apache.impala.planner.SingleNodePlanner.createSingleNodePlan(SingleNodePlanner.java:151)
>         at org.apache.impala.planner.Planner.createPlan(Planner.java:105)
>         at 
> org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1136)
>         at 
> org.apache.impala.service.Frontend.getPlannedExecRequest(Frontend.java:1430)
>         at 
> org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:1309)
>         at 
> org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:1217)
>         at 
> org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1187)
>         at 
> org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:153)
> I0627 15:38:07.302868 31182 status.cc:124] a94d3fb39954fe29:ef89dd2300000000] 
> IllegalStateException: null
>     @          0x1b0b92c  impala::Status::Status()
>     @          0x22c3ba4  impala::JniUtil::GetJniExceptionMsg()
>     @          0x2101acf  impala::JniCall::Call<>()
>     @          0x20fec9d  impala::JniUtil::CallJniMethod<>()
>     @          0x20fd0e6  impala::Frontend::GetExecRequest()
>     @          0x212acb2  impala::ImpalaServer::ExecuteInternal()
>     @          0x212a79a  impala::ImpalaServer::Execute()
>     @          0x21acf82  impala::ImpalaServer::query()
>     @          0x26fdcf1  beeswax::BeeswaxServiceProcessor::process_query()
>     @          0x26fda3f  beeswax::BeeswaxServiceProcessor::dispatchCall()
>     @          0x26cc05c  impala::ImpalaServiceProcessor::dispatchCall()
>     @          0x1abad1d  apache::thrift::TDispatchProcessor::process()
>     @          0x1f09cc9  
> apache::thrift::server::TAcceptQueueServer::Task::run()
>     @          0x1f002f8  impala::ThriftThread::RunRunnable()
>     @          0x1f01a1e  boost::_mfi::mf2<>::operator()()
>     @          0x1f018b4  boost::_bi::list3<>::operator()<>()
>     @          0x1f01600  boost::_bi::bind_t<>::operator()()
>     @          0x1f01513  
> boost::detail::function::void_function_obj_invoker0<>::invoke()
>     @          0x1e26249  boost::function0<>::operator()()
>     @          0x2339ea8  impala::Thread::SuperviseThread()
>     @          0x234222c  boost::_bi::list5<>::operator()<>()
>     @          0x2342150  boost::_bi::bind_t<>::operator()()
>     @          0x2342113  boost::detail::thread_data<>::run()
>     @          0x3a0cd09  thread_proxy
>     @     0x7f3a31cf66da  start_thread
>     @     0x7f3a2e34488e  clone
> {code}
> Workarounds:
> Disabling expression rewrites (SET enable_expr_rewrites=false) fixes the 
> issue.
> Renaming 'col1' column to something else in one of the tables and then 
> recreating the view is another workaround.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to