You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Balazs Jeszenszky (JIRA)" <ji...@apache.org> on 2018/03/12 12:47:00 UTC

[jira] [Created] (IMPALA-6639) Crash with 'ORDER BY' in 'OVER' clause with 'RANDOM'

Balazs Jeszenszky created IMPALA-6639:
-----------------------------------------

             Summary: Crash with 'ORDER BY' in 'OVER' clause with 'RANDOM'
                 Key: IMPALA-6639
                 URL: https://issues.apache.org/jira/browse/IMPALA-6639
             Project: IMPALA
          Issue Type: Bug
            Reporter: Balazs Jeszenszky


The following query crashes Impala reliably:

{code:java}
select AVG(n) OVER(ORDER By n) from (
select RANDOM() as n from (select 1 union all select 1) a) b;
{code}

Stack trace:
{code:java}
#0  0x00007f98565315e5 in raise () from /lib64/libc.so.6
#1  0x00007f9856532dc5 in abort () from /lib64/libc.so.6
#2  0x00007f9858697a55 in os::abort(bool) () from /usr/java/jdk1.7.0_67-cloudera/jre/lib/amd64/server/libjvm.so
#3  0x00007f9858817f87 in VMError::report_and_die() ()
   from /usr/java/jdk1.7.0_67-cloudera/jre/lib/amd64/server/libjvm.so
#4  0x00007f985869c96f in JVM_handle_linux_signal ()
   from /usr/java/jdk1.7.0_67-cloudera/jre/lib/amd64/server/libjvm.so
#5  <signal handler called>
#6  0x0000000002c9ed73 in impala::Sorter::Run::Run (this=0x94612a0, parent=0xa396080, sort_tuple_desc=0x8d9a750, 
    initial_run=true) at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/runtime/sorter.cc:624
#7  0x0000000002ca5c00 in impala::Sorter::Open (this=0xa396080)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/runtime/sorter.cc:1551
#8  0x0000000002901a09 in impala::SortNode::Open (this=0x945de00, state=0x9d92180)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/exec/sort-node.cc:82
#9  0x0000000002919bcb in impala::AnalyticEvalNode::Open (this=0x6dbb100, state=0x9d92180)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/exec/analytic-eval-node.cc:187
#10 0x0000000001893d03 in impala::FragmentInstanceState::Open (this=0xae64760)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/runtime/fragment-instance-state.cc:255
#11 0x00000000018917fd in impala::FragmentInstanceState::Exec (this=0xae64760)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/runtime/fragment-instance-state.cc:80
#12 0x000000000187a7ac in impala::QueryState::ExecFInstance (this=0x8fd0d00, fis=0xae64760)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/runtime/query-state.cc:382
#13 0x000000000187906e in impala::QueryState::<lambda()>::operator()(void) const (__closure=0x7f97ffd88bc8)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/runtime/query-state.cc:325
#14 0x000000000187b3eb in boost::detail::function::void_function_obj_invoker0<impala::QueryState::StartFInstances()::<lambda()>, void>::invoke(boost::detail::function::function_buffer &) (function_obj_ptr=...)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/toolchain/boost-1.57.0-p3/include/boost/function/function_template.hpp:153
#15 0x00000000017c88de in boost::function0<void>::operator() (this=0x7f97ffd88bc0)
    at /usr/src/debug/impala-2.11.0-cdh5.14.0/toolchain/boost-1.57.0-p3/include/boost/function/function_template.hpp:767
#16 0x0000000001abe113 in impala::Thread::SuperviseThread (name=..., category=..., functor=..., 
    thread_started=0x7f9800788ab0) at /usr/src/debug/impala-2.11.0-cdh5.14.0/be/src/util/thread.cc:352
#17 0x0000000001ac6c9e in boost::_bi::list4<boost::_bi::value<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::value<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::value<boost::function<void()> >, boost::_bi::value<impala::Promise<long int>*> >::operator()<void (*)(const std::basic_string<char>&, const std::basic_string<char>&, boost::function<void()>, impala::Promise<long int>*), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(const std::basic_string<char, std::char_traits<char>, std::allocator<char> > &, const std::basic_string<char, std::char_traits<char>, std::allocator<char> > &, boost::function<void()>, impala::Promise<long> *), boost::_bi::list0 &, int) (this=0xa3901c0, f=@0xa3901b8, a=...)
{code}

sort_tuple_size_ ends up as zero in this division:
https://github.com/cloudera/Impala/blob/cdh5-2.11.0_5.14.0/be/src/runtime/sorter.cc#L624

Looks like the tuple descriptor is malformed:
{code:java}
(gdb) p  *(impala::TupleDescriptor *) sort_tuple_desc
$4 = {static LLVM_CLASS_NAME = 0x3d649c4 "class.impala::TupleDescriptor", id_ = 8, table_desc_ = 0x0, 
  byte_size_ = 0, num_null_bytes_ = 0, null_bytes_offset_ = 0, 
  slots_ = {<std::_Vector_base<impala::SlotDescriptor*, std::allocator<impala::SlotDescriptor*> >> = {
      _M_impl = {<std::allocator<impala::SlotDescriptor*>> = {<__gnu_cxx::new_allocator<impala::SlotDescriptor*>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}, 
  string_slots_ = {<std::_Vector_base<impala::SlotDescriptor*, std::allocator<impala::SlotDescriptor*> >> = {
      _M_impl = {<std::allocator<impala::SlotDescriptor*>> = {<__gnu_cxx::new_allocator<impala::SlotDescriptor*>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}, 
  collection_slots_ = {<std::_Vector_base<impala::SlotDescriptor*, std::allocator<impala::SlotDescriptor*> >> = {
      _M_impl = {<std::allocator<impala::SlotDescriptor*>> = {<__gnu_cxx::new_allocator<impala::SlotDescriptor*>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}, 
  has_varlen_slots_ = false, tuple_path_ = {<std::_Vector_base<int, std::allocator<int> >> = {
      _M_impl = {<std::allocator<int>> = {<__gnu_cxx::new_allocator<int>> = {<No data fields>}, <No data fields>}, 
        _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}}
{code}

Seems to only happen with the RANDOM() function combined with the ORDER BY clause within the OVER clause. Having a single row within the innermost select will run successfully (but having a select * from a table will crash).



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