diff --git a/src/query/inc/qUdf.h b/src/query/inc/qUdf.h index c66ca5a21b9ba8825a72bcc618dc8d19fbc1b316..26573cb743f1897da21928ddbd80b0e151b1b122 100644 --- a/src/query/inc/qUdf.h +++ b/src/query/inc/qUdf.h @@ -51,8 +51,6 @@ typedef struct SUdfInfo { SUdfInit init; char *content; char *path; - - bool cloned; } SUdfInfo; //script diff --git a/tests/script/sh/demo.c b/tests/script/sh/demo.c index a506014a9e1679fb1eba038d707faa335c91483b..23d217444892e5bd8dc1c83b569dc22616c42e78 100644 --- a/tests/script/sh/demo.c +++ b/tests/script/sh/demo.c @@ -16,6 +16,10 @@ typedef struct SDemo{ short otype; }SDemo; +#define FLOAT_NULL 0x7FF00000 // it is an NAN +#define DOUBLE_NULL 0x7FFFFF0000000000L // it is an NAN + + void demo(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput, int* numOfOutput, short otype, short obytes, SUdfInit* buf) { int i; @@ -75,10 +79,18 @@ void demo_finalize(char* dataOutput, char* interBuf, int* numOfOutput, SUdfInit* SDemo *p = (SDemo *)interBuf; printf("demo_finalize interbuf:%p, numOfOutput:%p, buf:%p, sum:%f, num:%d\n", interBuf, numOfOutput, buf, p->sum, p->num); if (p->otype == 6) { - *(float *)dataOutput = (float)(p->sum / p->num); + if (p->num != 30000) { + *(unsigned int *)dataOutput = FLOAT_NULL; + } else { + *(float *)dataOutput = (float)(p->sum / p->num); + } printf("finalize values:%f\n", *(float *)dataOutput); } else if (p->otype == 7) { - *(double *)dataOutput = (double)(p->sum / p->num); + if (p->num != 30000) { + *(unsigned long long *)dataOutput = DOUBLE_NULL; + } else { + *(double *)dataOutput = (double)(p->sum / p->num); + } printf("finalize values:%f\n", *(double *)dataOutput); }