#include <stdio.h>#include <stdlib.h>#include <string.h>typedefstructSUdfInit{intmaybe_null;/* 1 if function can return NULL */intdecimals;/* for real functions */longlonglength;/* For string functions */char*ptr;/* free pointer for function data */intconst_item;/* 0 if result is independent of arguments */}SUdfInit;voidsub_one(char*data,shortitype,shortibytes,intnumOfRows,longlong*ts,char*dataOutput,char*interBUf,char*tsOutput,int*numOfOutput,shortotype,shortobytes,SUdfInit*buf){inti;intr=0;printf("sub_one input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n",data,itype,numOfRows,ts,*ts,dataOutput,tsOutput,numOfOutput,buf);if(itype==4){for(i=0;i<numOfRows;++i){printf("input %d - %d",i,*((int*)data+i));*((int*)dataOutput+i)=*((int*)data+i)-1;printf(", output %d\n",*((int*)dataOutput+i));if(tsOutput){*(longlong*)tsOutput=1000000;}}*numOfOutput=numOfRows;printf("sub_one out, numOfOutput:%d\n",*numOfOutput);}}