[
https://issues.apache.org/jira/browse/IMPALA-9023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16969987#comment-16969987
]
ASF subversion and git services commented on IMPALA-9023:
---------------------------------------------------------
Commit a0ebeef63bb6903a5e318c2d13497c43ce3a7ee1 in impala's branch
refs/heads/master from Alice Fan
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=a0ebeef ]
IMPALA-9023: Fix IllegalStateException in SimplifyConditionalsRule
For 'case' function, if left WHEN condition is true, SimplifyConditionalsRule
will cast the THEN result-expression to original expression's type before return
result. In this Jira, we would like to remove the cast function for two reasons:
1. SimplifyConditionalsRule only applys to analyzed expression, which means
expression has already been casted to compatible type before it reaches the
expression rewrite step.
2. The cast function will cause IllegalStateException when 'CASE WHEN TRUE'
appearing in the where conjunction. For example:
Query: select * from functional.alltypessmall where case when true then id < 50
END
ERROR: IllegalStateException: null
Testing:
- Added e2e test to exprs.test
- Added unit test to ExprRewriteRulesTest
- Added unit test to ExprRewriterTest
Change-Id: I640d577200e76121c72685e4aaba1ef312a2d8b4
Reviewed-on: http://gerrit.cloudera.org:8080/14540
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> select statement fails with "ERROR: IllegalStateException: null" after
> expression rewrite
> -----------------------------------------------------------------------------------------
>
> Key: IMPALA-9023
> URL: https://issues.apache.org/jira/browse/IMPALA-9023
> Project: IMPALA
> Issue Type: Bug
> Components: Frontend
> Affects Versions: Impala 3.4.0
> Reporter: Alice Fan
> Assignee: Alice Fan
> Priority: Major
>
> Steps to repro:
> {code:java}
> create table t (year int, make string);
> insert into t
> values
> (2005, 'Toyota'),
> (2010, 'Toyota'),
> (2005, 'Honda'),
> (2010, 'Honda'),
> (2005, 'Ford'),
> (2010, 'Ford');
> select *
> from t
> where
> case when make = 'Toyota' then year < 2008
> end
> and make = 'Toyota';
> {code}
> It will fail with following errors:
> {code:java}
> I1007 23:48:37.523810 15479 Frontend.java:1295]
> 7d47c4acb54a7131:bca9c9ef00000000] Analysis and authorization finished.
> I1007 23:48:37.574666 15479 jni-util.cc:288]
> 7d47c4acb54a7131:bca9c9ef00000000] 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:1256)
> at org.apache.impala.analysis.Expr.isBoundBySlotIds(Expr.java:1256)
> at
> org.apache.impala.planner.HdfsPartitionPruner.prunePartitions(HdfsPartitionPruner.java:124)
> at
> org.apache.impala.planner.SingleNodePlanner.createHdfsScanPlan(SingleNodePlanner.java:1269)
> at
> org.apache.impala.planner.SingleNodePlanner.createScanNode(SingleNodePlanner.java:1395)
> at
> org.apache.impala.planner.SingleNodePlanner.createTableRefNode(SingleNodePlanner.java:1582)
> at
> org.apache.impala.planner.SingleNodePlanner.createTableRefsPlan(SingleNodePlanner.java:826)
> at
> org.apache.impala.planner.SingleNodePlanner.createSelectPlan(SingleNodePlanner.java:662)
> 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:117)
> at
> org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1180)
> at
> org.apache.impala.service.Frontend.getPlannedExecRequest(Frontend.java:1506)
> at
> org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:1370)
> at
> org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:1261)
> at
> org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1231)
> at
> org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:154)
> I1007 23:48:37.717686 15479 status.cc:124] 7d47c4acb54a7131:bca9c9ef00000000]
> IllegalStateException: null
> @ 0x1b90190 impala::Status::Status()
> @ 0x238b21c impala::JniUtil::GetJniExceptionMsg()
> @ 0x21b18b5 impala::JniCall::Call<>()
> @ 0x21ae9f3 impala::JniUtil::CallJniMethod<>()
> @ 0x21acc96 impala::Frontend::GetExecRequest()
> @ 0x21d9fe0 impala::ImpalaServer::ExecuteInternal()
> @ 0x21d9a0e impala::ImpalaServer::Execute()
> @ 0x226698a impala::ImpalaServer::query()
> @ 0x27ce3fd beeswax::BeeswaxServiceProcessor::process_query()
> @ 0x27ce14b beeswax::BeeswaxServiceProcessor::dispatchCall()
> @ 0x279bb78 impala::ImpalaServiceProcessor::dispatchCall()
> @ 0x1b3f553 apache::thrift::TDispatchProcessor::process()
> @ 0x1f9ee57
> apache::thrift::server::TAcceptQueueServer::Task::run()
> @ 0x1f9459c impala::ThriftThread::RunRunnable()
> @ 0x1f95cc2 boost::_mfi::mf2<>::operator()()
> @ 0x1f95b58 boost::_bi::list3<>::operator()<>()
> @ 0x1f958a4 boost::_bi::bind_t<>::operator()()
> @ 0x1f957b7
> boost::detail::function::void_function_obj_invoker0<>::invoke()
> @ 0x1eb271f boost::function0<>::operator()()
> @ 0x2405a34 impala::Thread::SuperviseThread()
> @ 0x240ddb8 boost::_bi::list5<>::operator()<>()
> @ 0x240dcdc boost::_bi::bind_t<>::operator()()
> @ 0x240dc9f boost::detail::thread_data<>::run()
> @ 0x3bea089 thread_proxy
> @ 0x7fea2747f6b9 start_thread
> @ 0x7fea23c5e41c clone
> {code}
> Workarounds:
> 1. Disable expression rewrites (SET ENABLE_EXPR_REWRITES=0), which can fix
> the issue.
> 2. Rewrite query with the same logic:
> {code}
> select * from t where make = 'Toyota' and year < 2008;
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]