Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-5251

DecimalAvgFinalize() gets the wrong arg type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • Impala 2.8.0
    • Impala 2.9.0
    • Frontend

    Description

      We mean to pass in the agg fn's logical input type to the UDAs, but appear to be passing in the physical input type (i.e. intermediate type) in this case.

      Steps to repro:

      use tpcds;
      select avg(ss_list_price) B1_LP
                  ,count(ss_list_price) B1_CNT
                  ,count(distinct ss_list_price) B1_CNTD
            from store_sales
            where ss_quantity between 0 and 5
              and (ss_list_price between 8 and 8+10
                   or ss_coupon_amt between 459 and 459+1000
                   or ss_wholesale_cost between 57 and 57+20);
      

      Results in this assert:

      #3  0x00007fd78a7fdca2 in __GI___assert_fail (assertion=0x2edc118 "arg_types[i].type == FunctionContext::TYPE_DECIMAL", file=0x2edbb80 "/home/dhecht/src/Impala/be/src/udf/udf.cc", line=592,
          function=0x2edc7c0 <impala::FunctionContextImpl::GetConstFnAttr(impala::RuntimeState const*, impala_udf::FunctionContext::TypeDesc const&, std::vector<impala_udf::FunctionContext::TypeDesc, std::alloc
      ator<impala_udf::FunctionContext::TypeDesc> > const&, impala::FunctionContextImpl::ConstFnAttr, int)::__PRETTY_FUNCTION__> "static int impala::FunctionContextImpl::GetConstFnAttr(const impala::RuntimeStat
      e*, const impala_udf::FunctionContext::TypeDesc&, const std::vector<impala_udf::FunctionContext::TypeDesc>&, impala::Fun"...) at assert.c:101
      #4  0x0000000001a98aa1 in impala::FunctionContextImpl::GetConstFnAttr (state=0xb3bdc00, return_type=..., arg_types=std::vector of length 1, capacity 1 = {...},
          t=impala::FunctionContextImpl::ARG_TYPE_SCALE, i=0) at /home/dhecht/src/Impala/be/src/udf/udf.cc:592
      #5  0x0000000001a987a2 in impala::FunctionContextImpl::GetConstFnAttr (this=0x6984640, t=impala::FunctionContextImpl::ARG_TYPE_SCALE, i=0) at /home/dhecht/src/Impala/be/src/udf/udf.cc:561
      #6  0x00000000018a88a0 in impala::AggregateFunctions::DecimalAvgGetValue (ctx=0x4944d78, src=...) at /home/dhecht/src/Impala/be/src/exprs/aggregate-functions-ir.cc:445
      #7  0x00000000018a89f2 in impala::AggregateFunctions::DecimalAvgFinalize (ctx=0x4944d78, src=...) at /home/dhecht/src/Impala/be/src/exprs/aggregate-functions-ir.cc:462
      #8  0x00000000018a3d5a in impala::AggFnEvaluator::SerializeOrFinalize (this=0xcf2f000, agg_fn_ctx=0x4944d78, src=0xb11d000, dst_slot_desc=0xce0be60, dst=0xd02a000,
          fn=0x18a89aa <impala::AggregateFunctions::DecimalAvgFinalize(impala_udf::FunctionContext*, impala_udf::StringVal const&)>) at /home/dhecht/src/Impala/be/src/exprs/agg-fn-evaluator.cc:499
      #9  0x00000000017b2b3e in impala::AggFnEvaluator::Finalize (this=0xcf2f000, agg_fn_ctx=0x4944d78, src=0xb11d000, dst=0xd02a000) at /home/dhecht/src/Impala/be/src/exprs/agg-fn-evaluator.h:266
      #10 0x00000000017b2d76 in impala::AggFnEvaluator::Finalize (evaluators=std::vector of length 3, capacity 4 = {...}, fn_ctxs=std::vector of length 3, capacity 4 = {...}, src=0xb11d000, dst=0xd02a000)
          at /home/dhecht/src/Impala/be/src/exprs/agg-fn-evaluator.h:312
      #11 0x00000000017a8976 in impala::PartitionedAggregationNode::GetOutputTuple (this=0xd714780, agg_fn_ctxs=std::vector of length 3, capacity 4 = {...}, tuple=0xb11d000, pool=0xca844a8)
          at /home/dhecht/src/Impala/be/src/exec/partitioned-aggregation-node.cc:1109
      #12 0x00000000017a2866 in impala::PartitionedAggregationNode::GetSingletonOutput (this=0xd714780, row_batch=0xca84480) at /home/dhecht/src/Impala/be/src/exec/partitioned-aggregation-node.cc:466
      #13 0x00000000017a2186 in impala::PartitionedAggregationNode::GetNextInternal (this=0xd714780, state=0xb3bdc00, row_batch=0xca84480, eos=0x7fd7000b9ebf)
          at /home/dhecht/src/Impala/be/src/exec/partitioned-aggregation-node.cc:442
      #14 0x00000000017a170b in impala::PartitionedAggregationNode::GetNext (this=0xd714780, state=0xb3bdc00, row_batch=0xca84480, eos=0x7fd7000b9ebf)
          at /home/dhecht/src/Impala/be/src/exec/partitioned-aggregation-node.cc:376
      #15 0x0000000001a738b8 in impala::PlanFragmentExecutor::ExecInternal (this=0xb3b89d0) at /home/dhecht/src/Impala/be/src/runtime/plan-fragment-executor.cc:353
      #16 0x0000000001a735f6 in impala::PlanFragmentExecutor::Exec (this=0xb3b89d0) at /home/dhecht/src/Impala/be/src/runtime/plan-fragment-executor.cc:337
      #17 0x0000000001a6cd95 in impala::FragmentInstanceState::Exec (this=0xb3b8700) at /home/dhecht/src/Impala/be/src/runtime/fragment-instance-state.cc:68
      #18 0x0000000001a78367 in impala::QueryExecMgr::ExecFInstance (this=0xbc6ad20, fis=0xb3b8700) at /home/dhecht/src/Impala/be/src/runtime/query-exec-mgr.cc:110
      

      Attachments

        Issue Links

          Activity

            People

              kwho Michael Ho
              dhecht Daniel Hecht
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: