Hi,
I have some problems when develop a vertica custom analytics function with C++ SDK.
I simplify this problem, and here is what I do to reproduction it:
1. edit the example NthValue analytic function (/opt/vertica/sdk/examples/AnalyticFunctions/NthValue.cpp):
int i = 0, j = 0;
do {
if (currentRow == nParam) {
nthRowExists = true;
// break;
} else {
currentRow++;
}
i++;
} while (inputReader.next());
// Output the n-th value.
if (nthRowExists) {
do {
outputWriter.copyFromInput(0 /*dest*/, inputReader, argCols.at(0) /*src*/);
j++;
} while (outputWriter.next());
} else {
// The partition has less than n rows. Output NULL values.
do {
outputWriter.setNull(0);
j++;
} while (outputWriter.next());
}
srvInterface.log("SSSSSSSSSS:%d %d", i, j);
2. compile the examples
make AnalyticFunctions
3.run example test
vsql -f AnalyticFunctions.sql
4. view the UDx Log
16:47:46.398 [C++-instance-nwxsxyjq-25959:0x66e-32496] 0x7f1afaf31700 [UserMessage] nth_value - SSSSSSSSSS:3 131072
16:47:46.400 [C++-instance-nwxsxyjq-25959:0x66e-32496] 0x7f1afb732700 [UserMessage] nth_value - SSSSSSSSSS:3 131072
16:47:46.446 [C++-instance-nwxsxyjq-25959:0x66e-32496] 0x7f1afb732700 [UserMessage] nth_value - SSSSSSSSSS:3 131072
16:47:46.575 [C++-instance-nwxsxyjq-25959:0x66e-32496] 0x7f1afaf31700 Exiting UDx side process
Here is the problem: the number '3' and '131072' in log message is obviously incorrect, Why is this happened?
Thank You!