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

Constant argument for UDAF is not accessible in Init function.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Impala 2.2
    • Impala 2.8.0
    • Frontend

    Description

      A user reported on the user list that they were unable to access a constant argument from the Init function of a UDAF. It would be convenient in many cases to support this.

      I'm adding a parameter to my version of the appx_median function to set the number of samples we want to store. My plan was to require that the number of samples parameter be a constant so I can allocate the memory for the samples in the Init function but I can't seem to access it in the Init function.
      
        if (! ctx->IsArgConstant(1)) {
          ctx->SetError("The number of samples must be a constant");
          return;
      
        }
      
      If I include that check in my Init function, it always returns an error and I get back a NULL when I try to access the constant arg:
      
      int max_samples = reinterpret_cast<IntVal*>(ctx->GetConstantArg(1))->val;
      

      Attachments

        Activity

          People

            cchanning Chris Channing
            tarmstrong Tim Armstrong
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: