The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

Passing 3rd argument in IntermediateAggs

edited November 2018 in General Discussion

Based on the

I wrote below code.

virtual void initAggregate(ServerInterface &si, IntermediateAggs &aggs)
    {  try{
        VString &arg1 = aggs.getStringRef(0);

        VString &arg2 = aggs.getStringRef(1);

        VString &arg3 = aggs.getStringRef(2);

        }catch(std::exception &e) {
          vt_report_error(0, "Exception while initializing intermediate aggregates: [% s]", e.what());

The problem is I’ll have 3 arguments to pass around between aggregate to combine function instead of 2. I’m getting an exception because of “VString &arg3 = aggs.getStringRef(2);”

error code: 0, message: Exception while initializing intermediate aggregates: [vector::_M_range_check]
LOCATION: initAgg, /scratch_a/release/svrtar4536/vbuild/vertica/EE/Functions/UserDefinedAggregate.cpp:143

My requirement is to pass 3 arguments, how can I do this?


  • You need to specify the third intermediate in the AggregateFunctionFactory class -

    virtual void getIntermediateTypes(ServerInterface &srvInterface,
    const SizedColumnTypes &inputTypes,
    SizedColumnTypes &intermediateTypeMetaData)
    const VerticaType &inType = inputTypes.getColumnType(0);
    intermediateTypeMetaData.addNumeric(interPrec, inType.getNumericScale());
    // Add your 3rd type here...

  • got the answer we need define it in . the getIntermediateTypes methods

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.