Github user sureshsubbiah commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1420#discussion_r164609598
  
    --- Diff: core/sql/regress/udr/TEST103_functions.cpp ---
    @@ -117,11 +117,41 @@ SQLUDR_LIBFUNC SQLUDR_INT32 
genRandomNumber(SQLUDR_INT32 *in1,
         }
       }
       
    -  strcpy(out, result.c_str());
    +  memcpy(out, result.c_str(), result.length());
       return SQLUDR_SUCCESS;
     }
     
     
    +SQLUDR_LIBFUNC SQLUDR_INT32 nonDeterministicRandom(SQLUDR_INT32 *out1,
    +                                                   SQLUDR_INT16 *outInd1,
    +                                                   SQLUDR_TRAIL_ARGS)
    +{
    +  if (calltype == SQLUDR_CALLTYPE_FINAL)
    +    return SQLUDR_SUCCESS;
    +
    +  // pointer to the buffer in the state area that is
    +  // available for the lifetime of this statement,
    +  // this can be used by the UDF to maintain state
    +  int *my_state = (int *) statearea->stmt_data.data;
    +
    +  if (calltype == SQLUDR_CALLTYPE_INITIAL && *my_state == 0)
    +    {
    +      *my_state = 555;
    +    }
    +  else
    +    // Use a simple linear congruential generator, we
    +    // want deterministic regression results, despite
    +    // the name of this function. Note that a
    --- End diff --
    
    Typo. Extra "a". Smallest nit possible :)


---

Reply via email to