enh:[TD-33274] Add more test cases
This commit is contained in:
parent
9c8a9edf49
commit
3f6039d36b
|
@ -2985,279 +2985,93 @@ static int32_t doScalarFunction2(SScalarParam *pInput, int32_t inputNum, SScalar
|
|||
bool hasNullType = (IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[0])) || IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[1])));
|
||||
|
||||
int32_t numOfRows = TMAX(pInput[0].numOfRows, pInput[1].numOfRows);
|
||||
if (pInput[0].numOfRows == pInput[1].numOfRows) {
|
||||
for (int32_t i = 0; i < numOfRows; ++i) {
|
||||
if (colDataIsNull_s(pInputData[0], i) || colDataIsNull_s(pInputData[1], i) || hasNullType) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
continue;
|
||||
}
|
||||
double in2;
|
||||
GET_TYPED_DATA(in2, double, GET_PARAM_TYPE(&pInput[1]), colDataGetData(pInputData[1], i));
|
||||
switch (GET_PARAM_TYPE(&pInput[0])) {
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
double *in = (double *)pInputData[0]->pData;
|
||||
double *out = (double *)pOutputData->pData;
|
||||
double result = d1(in[i], in2);
|
||||
if (isinf(result) || isnan(result)) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
} else {
|
||||
out[i] = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
float *in = (float *)pInputData[0]->pData;
|
||||
float *out = (float *)pOutputData->pData;
|
||||
float result = f1(in[i], (float)in2);
|
||||
if (isinf(result) || isnan(result)) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
} else {
|
||||
out[i] = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_TINYINT: {
|
||||
int8_t *in = (int8_t *)pInputData[0]->pData;
|
||||
int8_t *out = (int8_t *)pOutputData->pData;
|
||||
int8_t result = (int8_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_SMALLINT: {
|
||||
int16_t *in = (int16_t *)pInputData[0]->pData;
|
||||
int16_t *out = (int16_t *)pOutputData->pData;
|
||||
int16_t result = (int16_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_INT: {
|
||||
int32_t *in = (int32_t *)pInputData[0]->pData;
|
||||
int32_t *out = (int32_t *)pOutputData->pData;
|
||||
int32_t result = (int32_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_BIGINT: {
|
||||
int64_t *in = (int64_t *)pInputData[0]->pData;
|
||||
int64_t *out = (int64_t *)pOutputData->pData;
|
||||
int64_t result = (int64_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UTINYINT: {
|
||||
uint8_t *in = (uint8_t *)pInputData[0]->pData;
|
||||
uint8_t *out = (uint8_t *)pOutputData->pData;
|
||||
uint8_t result = (uint8_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_USMALLINT: {
|
||||
uint16_t *in = (uint16_t *)pInputData[0]->pData;
|
||||
uint16_t *out = (uint16_t *)pOutputData->pData;
|
||||
uint16_t result = (uint16_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UINT: {
|
||||
uint32_t *in = (uint32_t *)pInputData[0]->pData;
|
||||
uint32_t *out = (uint32_t *)pOutputData->pData;
|
||||
uint32_t result = (uint32_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UBIGINT: {
|
||||
uint64_t *in = (uint64_t *)pInputData[0]->pData;
|
||||
uint64_t *out = (uint64_t *)pOutputData->pData;
|
||||
uint64_t result = (uint64_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int32_t i = 0; i < numOfRows; ++i) {
|
||||
int32_t colIdx1 = (pInput[0].numOfRows == 1) ? 0 : i;
|
||||
int32_t colIdx2 = (pInput[1].numOfRows == 1) ? 0 : i;
|
||||
if (colDataIsNull_s(pInputData[0], colIdx1) || colDataIsNull_s(pInputData[1], colIdx2) || hasNullType) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
continue;
|
||||
}
|
||||
} else if (pInput[0].numOfRows == 1) { // left operand is constant
|
||||
if (colDataIsNull_s(pInputData[0], 0) || hasNullType) {
|
||||
colDataSetNNULL(pOutputData, 0, pInput[1].numOfRows);
|
||||
} else {
|
||||
for (int32_t i = 0; i < numOfRows; ++i) {
|
||||
if (colDataIsNull_s(pInputData[1], i)) {
|
||||
double in2;
|
||||
GET_TYPED_DATA(in2, double, GET_PARAM_TYPE(&pInput[1]), colDataGetData(pInputData[1], colIdx2));
|
||||
switch (GET_PARAM_TYPE(&pInput[0])) {
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
double *in = (double *)pInputData[0]->pData;
|
||||
double *out = (double *)pOutputData->pData;
|
||||
double result = d1(in[colIdx1], in2);
|
||||
if (isinf(result) || isnan(result)) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
continue;
|
||||
}
|
||||
double in2;
|
||||
GET_TYPED_DATA(in2, double, GET_PARAM_TYPE(&pInput[1]), colDataGetData(pInputData[1], i));
|
||||
switch (GET_PARAM_TYPE(&pInput[0])) {
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
double *in = (double *)pInputData[0]->pData;
|
||||
double *out = (double *)pOutputData->pData;
|
||||
double result = d1(in[0], in2);
|
||||
if (isinf(result) || isnan(result)) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
} else {
|
||||
out[i] = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
float *in = (float *)pInputData[0]->pData;
|
||||
float *out = (float *)pOutputData->pData;
|
||||
float result = f1(in[0], (float)in2);
|
||||
if (isinf(result) || isnan(result)) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
} else {
|
||||
out[i] = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_TINYINT: {
|
||||
int8_t *in = (int8_t *)pInputData[0]->pData;
|
||||
int8_t *out = (int8_t *)pOutputData->pData;
|
||||
int8_t result = (int8_t)d1((double)in[0], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_SMALLINT: {
|
||||
int16_t *in = (int16_t *)pInputData[0]->pData;
|
||||
int16_t *out = (int16_t *)pOutputData->pData;
|
||||
int16_t result = (int16_t)d1((double)in[0], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_INT: {
|
||||
int32_t *in = (int32_t *)pInputData[0]->pData;
|
||||
int32_t *out = (int32_t *)pOutputData->pData;
|
||||
int32_t result = (int32_t)d1((double)in[0], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_BIGINT: {
|
||||
int64_t *in = (int64_t *)pInputData[0]->pData;
|
||||
int64_t *out = (int64_t *)pOutputData->pData;
|
||||
int64_t result = (int64_t)d1((double)in[0], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UTINYINT: {
|
||||
uint8_t *in = (uint8_t *)pInputData[0]->pData;
|
||||
uint8_t *out = (uint8_t *)pOutputData->pData;
|
||||
uint8_t result = (uint8_t)d1((double)in[0], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_USMALLINT: {
|
||||
uint16_t *in = (uint16_t *)pInputData[0]->pData;
|
||||
uint16_t *out = (uint16_t *)pOutputData->pData;
|
||||
uint16_t result = (uint16_t)d1((double)in[0], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UINT: {
|
||||
uint32_t *in = (uint32_t *)pInputData[0]->pData;
|
||||
uint32_t *out = (uint32_t *)pOutputData->pData;
|
||||
uint32_t result = (uint32_t)d1((double)in[0], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UBIGINT: {
|
||||
uint64_t *in = (uint64_t *)pInputData[0]->pData;
|
||||
uint64_t *out = (uint64_t *)pOutputData->pData;
|
||||
uint64_t result = (uint64_t)d1((double)in[0], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
out[i] = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (pInput[1].numOfRows == 1) {
|
||||
if (colDataIsNull_s(pInputData[1], 0) || hasNullType) {
|
||||
colDataSetNNULL(pOutputData, 0, pInput[0].numOfRows);
|
||||
} else {
|
||||
for (int32_t i = 0; i < numOfRows; ++i) {
|
||||
if (colDataIsNull_s(pInputData[0], i)) {
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
float *in = (float *)pInputData[0]->pData;
|
||||
float *out = (float *)pOutputData->pData;
|
||||
float result = f1(in[colIdx1], (float)in2);
|
||||
if (isinf(result) || isnan(result)) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
continue;
|
||||
}
|
||||
double in2;
|
||||
GET_TYPED_DATA(in2, double, GET_PARAM_TYPE(&pInput[1]), colDataGetData(pInputData[1], 0));
|
||||
switch (GET_PARAM_TYPE(&pInput[0])) {
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
double *in = (double *)pInputData[0]->pData;
|
||||
double *out = (double *)pOutputData->pData;
|
||||
double result = d1(in[i], in2);
|
||||
if (isinf(result) || isnan(result)) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
} else {
|
||||
out[i] = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
float *in = (float *)pInputData[0]->pData;
|
||||
float *out = (float *)pOutputData->pData;
|
||||
float result = f1(in[i], in2);
|
||||
if (isinf(result) || isnan(result)) {
|
||||
colDataSetNULL(pOutputData, i);
|
||||
} else {
|
||||
out[i] = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_TINYINT: {
|
||||
int8_t *in = (int8_t *)pInputData[0]->pData;
|
||||
int8_t *out = (int8_t *)pOutputData->pData;
|
||||
int8_t result = (int8_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_SMALLINT: {
|
||||
int16_t *in = (int16_t *)pInputData[0]->pData;
|
||||
int16_t *out = (int16_t *)pOutputData->pData;
|
||||
int16_t result = (int16_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_INT: {
|
||||
int32_t *in = (int32_t *)pInputData[0]->pData;
|
||||
int32_t *out = (int32_t *)pOutputData->pData;
|
||||
int32_t result = (int32_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_BIGINT: {
|
||||
int64_t *in = (int64_t *)pInputData[0]->pData;
|
||||
int64_t *out = (int64_t *)pOutputData->pData;
|
||||
int64_t result = (int64_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UTINYINT: {
|
||||
uint8_t *in = (uint8_t *)pInputData[0]->pData;
|
||||
uint8_t *out = (uint8_t *)pOutputData->pData;
|
||||
uint8_t result = (uint8_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_USMALLINT: {
|
||||
uint16_t *in = (uint16_t *)pInputData[0]->pData;
|
||||
uint16_t *out = (uint16_t *)pOutputData->pData;
|
||||
uint16_t result = (uint16_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UINT: {
|
||||
uint32_t *in = (uint32_t *)pInputData[0]->pData;
|
||||
uint32_t *out = (uint32_t *)pOutputData->pData;
|
||||
uint32_t result = (uint32_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UBIGINT: {
|
||||
uint64_t *in = (uint64_t *)pInputData[0]->pData;
|
||||
uint64_t *out = (uint64_t *)pOutputData->pData;
|
||||
uint64_t result = (uint64_t)d1((double)in[i], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
out[i] = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_TINYINT: {
|
||||
int8_t *in = (int8_t *)pInputData[0]->pData;
|
||||
int8_t *out = (int8_t *)pOutputData->pData;
|
||||
int8_t result = (int8_t)d1((double)in[colIdx1], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_SMALLINT: {
|
||||
int16_t *in = (int16_t *)pInputData[0]->pData;
|
||||
int16_t *out = (int16_t *)pOutputData->pData;
|
||||
int16_t result = (int16_t)d1((double)in[colIdx1], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_INT: {
|
||||
int32_t *in = (int32_t *)pInputData[0]->pData;
|
||||
int32_t *out = (int32_t *)pOutputData->pData;
|
||||
int32_t result = (int32_t)d1((double)in[colIdx1], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_BIGINT: {
|
||||
int64_t *in = (int64_t *)pInputData[0]->pData;
|
||||
int64_t *out = (int64_t *)pOutputData->pData;
|
||||
int64_t result = (int64_t)d1((double)in[colIdx1], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UTINYINT: {
|
||||
uint8_t *in = (uint8_t *)pInputData[0]->pData;
|
||||
uint8_t *out = (uint8_t *)pOutputData->pData;
|
||||
uint8_t result = (uint8_t)d1((double)in[colIdx1], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_USMALLINT: {
|
||||
uint16_t *in = (uint16_t *)pInputData[0]->pData;
|
||||
uint16_t *out = (uint16_t *)pOutputData->pData;
|
||||
uint16_t result = (uint16_t)d1((double)in[colIdx1], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UINT: {
|
||||
uint32_t *in = (uint32_t *)pInputData[0]->pData;
|
||||
uint32_t *out = (uint32_t *)pOutputData->pData;
|
||||
uint32_t result = (uint32_t)d1((double)in[colIdx1], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_UBIGINT: {
|
||||
uint64_t *in = (uint64_t *)pInputData[0]->pData;
|
||||
uint64_t *out = (uint64_t *)pOutputData->pData;
|
||||
uint64_t result = (uint64_t)d1((double)in[colIdx1], in2);
|
||||
out[i] = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,19 +121,6 @@ _return:
|
|||
SCL_RET(code);
|
||||
}
|
||||
|
||||
int32_t convertBinaryToDouble(const void *inData, void *outData) {
|
||||
char *tmp = taosMemoryCalloc(1, varDataTLen(inData));
|
||||
if (tmp == NULL) {
|
||||
*((double *)outData) = 0.;
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(tmp, varDataVal(inData), varDataLen(inData));
|
||||
double ret = taosStr2Double(tmp, NULL);
|
||||
taosMemoryFree(tmp);
|
||||
*((double *)outData) = ret;
|
||||
SCL_RET(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
typedef int32_t (*_getBigintValue_fn_t)(void *src, int32_t index, int64_t *res);
|
||||
|
||||
int32_t getVectorBigintValue_TINYINT(void *src, int32_t index, int64_t *res) {
|
||||
|
@ -1129,17 +1116,11 @@ int32_t vectorConvertCols(SScalarParam *pLeft, SScalarParam *pRight, SScalarPara
|
|||
}
|
||||
|
||||
if (type != GET_PARAM_TYPE(param1)) {
|
||||
code = vectorConvertSingleCol(param1, paramOut1, type, startIndex, numOfRows);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
SCL_ERR_RET(vectorConvertSingleCol(param1, paramOut1, type, startIndex, numOfRows));
|
||||
}
|
||||
|
||||
if (type != GET_PARAM_TYPE(param2)) {
|
||||
code = vectorConvertSingleCol(param2, paramOut2, type, startIndex, numOfRows);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
SCL_ERR_RET(vectorConvertSingleCol(param2, paramOut2, type, startIndex, numOfRows));
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1208,22 +1189,16 @@ static int32_t vectorMathTsAddHelper(SColumnInfoData *pLeftCol, SColumnInfoData
|
|||
static int32_t vectorConvertVarToDouble(SScalarParam *pInput, int32_t *converted, SColumnInfoData **pOutputCol) {
|
||||
SScalarParam output = {0};
|
||||
SColumnInfoData *pCol = pInput->columnData;
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
*pOutputCol = NULL;
|
||||
if (IS_VAR_DATA_TYPE(pCol->info.type) && pCol->info.type != TSDB_DATA_TYPE_JSON && pCol->info.type != TSDB_DATA_TYPE_VARBINARY) {
|
||||
int32_t code = vectorConvertSingleCol(pInput, &output, TSDB_DATA_TYPE_DOUBLE, -1, -1);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
*pOutputCol = NULL;
|
||||
SCL_ERR_RET(code);
|
||||
}
|
||||
|
||||
SCL_ERR_RET(vectorConvertSingleCol(pInput, &output, TSDB_DATA_TYPE_DOUBLE, -1, -1));
|
||||
*converted = VECTOR_DO_CONVERT;
|
||||
|
||||
*pOutputCol = output.columnData;
|
||||
SCL_RET(code);
|
||||
}
|
||||
|
||||
*converted = VECTOR_UN_CONVERT;
|
||||
|
||||
*pOutputCol = pInput->columnData;
|
||||
SCL_RET(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
@ -1616,68 +1591,25 @@ int32_t vectorMathRemainder(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa
|
|||
|
||||
double *output = (double *)pOutputCol->pData;
|
||||
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (IS_NULL) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
double lx = 0;
|
||||
double rx = 0;
|
||||
SCL_ERR_JRET(getVectorDoubleValueFnLeft(LEFT_COL, i, &lx));
|
||||
SCL_ERR_JRET(getVectorDoubleValueFnRight(RIGHT_COL, i, &rx));
|
||||
if (isnan(lx) || isinf(lx) || isnan(rx) || isinf(rx) || FLT_EQUAL(rx, 0)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
*output = lx - ((int64_t)(lx / rx)) * rx;
|
||||
int32_t numOfRows = TMAX(pLeft->numOfRows, pRight->numOfRows);
|
||||
for (; i < numOfRows && i >= 0; i += step, output += 1) {
|
||||
int32_t leftidx = pLeft->numOfRows == 1 ? 0 : i;
|
||||
int32_t rightidx = pRight->numOfRows == 1 ? 0 : i;
|
||||
if (IS_HELPER_NULL(pLeftCol, leftidx) || IS_HELPER_NULL(pRightCol, rightidx)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
} else if (pLeft->numOfRows == 1) {
|
||||
|
||||
double lx = 0;
|
||||
SCL_ERR_JRET(getVectorDoubleValueFnLeft(LEFT_COL, 0, &lx));
|
||||
if (IS_HELPER_NULL(pLeftCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataSetNNULL(pOutputCol, 0, pRight->numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < pRight->numOfRows; i += step, output += 1) {
|
||||
if (IS_HELPER_NULL(pRightCol, i)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
double rx = 0;
|
||||
SCL_ERR_JRET(getVectorDoubleValueFnRight(RIGHT_COL, i, &rx));
|
||||
if (isnan(rx) || isinf(rx) || FLT_EQUAL(rx, 0)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
*output = lx - ((int64_t)(lx / rx)) * rx;
|
||||
}
|
||||
}
|
||||
} else if (pRight->numOfRows == 1) {
|
||||
double rx = 0;
|
||||
SCL_ERR_JRET(getVectorDoubleValueFnRight(RIGHT_COL, 0, &rx));
|
||||
if (IS_HELPER_NULL(pRightCol, 0) || FLT_EQUAL(rx, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataSetNNULL(pOutputCol, 0, pLeft->numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < pLeft->numOfRows; i += step, output += 1) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
double lx = 0;
|
||||
SCL_ERR_JRET(getVectorDoubleValueFnLeft(LEFT_COL, i, &lx));
|
||||
if (isnan(lx) || isinf(lx)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
*output = lx - ((int64_t)(lx / rx)) * rx;
|
||||
}
|
||||
SCL_ERR_JRET(getVectorDoubleValueFnLeft(LEFT_COL, leftidx, &lx));
|
||||
SCL_ERR_JRET(getVectorDoubleValueFnRight(RIGHT_COL, rightidx, &rx));
|
||||
if (isnan(lx) || isinf(lx) || isnan(rx) || isinf(rx) || FLT_EQUAL(rx, 0)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
*output = lx - ((int64_t)(lx / rx)) * rx;
|
||||
}
|
||||
|
||||
_return:
|
||||
|
@ -1739,33 +1671,6 @@ int32_t vectorAssign(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pO
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t vectorBitAndHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
|
||||
int32_t numOfRows, int32_t step, int32_t i) {
|
||||
_getBigintValue_fn_t getVectorBigintValueFnLeft;
|
||||
_getBigintValue_fn_t getVectorBigintValueFnRight;
|
||||
SCL_ERR_RET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
|
||||
SCL_ERR_RET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
|
||||
|
||||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataSetNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
int64_t leftRes = 0;
|
||||
int64_t rightRes = 0;
|
||||
SCL_ERR_RET(getVectorBigintValueFnLeft(LEFT_COL, i, &leftRes));
|
||||
SCL_ERR_RET(getVectorBigintValueFnRight(RIGHT_COL, 0, &rightRes));
|
||||
*output = leftRes & rightRes;
|
||||
}
|
||||
}
|
||||
SCL_RET(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
int32_t vectorBitAnd(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, int32_t _ord) {
|
||||
SColumnInfoData *pOutputCol = pOut->columnData;
|
||||
pOut->numOfRows = TMAX(pLeft->numOfRows, pRight->numOfRows);
|
||||
|
@ -1786,22 +1691,19 @@ int32_t vectorBitAnd(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pO
|
|||
SCL_ERR_JRET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
|
||||
|
||||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (IS_NULL) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
int64_t leftRes = 0;
|
||||
int64_t rightRes = 0;
|
||||
SCL_ERR_JRET(getVectorBigintValueFnLeft(LEFT_COL, i, &leftRes));
|
||||
SCL_ERR_JRET(getVectorBigintValueFnRight(RIGHT_COL, i, &rightRes));
|
||||
*output = leftRes & rightRes;
|
||||
int32_t numOfRows = TMAX(pLeft->numOfRows, pRight->numOfRows);
|
||||
for (; i < numOfRows && i >= 0; i += step, output += 1) {
|
||||
int32_t leftidx = pLeft->numOfRows == 1 ? 0 : i;
|
||||
int32_t rightidx = pRight->numOfRows == 1 ? 0 : i;
|
||||
if (IS_HELPER_NULL(pRightCol, rightidx) || IS_HELPER_NULL(pLeftCol, leftidx)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
} else if (pLeft->numOfRows == 1) {
|
||||
SCL_ERR_JRET(vectorBitAndHelper(pRightCol, pLeftCol, pOutputCol, pRight->numOfRows, step, i));
|
||||
} else if (pRight->numOfRows == 1) {
|
||||
SCL_ERR_JRET(vectorBitAndHelper(pLeftCol, pRightCol, pOutputCol, pLeft->numOfRows, step, i));
|
||||
int64_t leftRes = 0;
|
||||
int64_t rightRes = 0;
|
||||
SCL_ERR_JRET(getVectorBigintValueFnLeft(LEFT_COL, leftidx, &leftRes));
|
||||
SCL_ERR_JRET(getVectorBigintValueFnRight(RIGHT_COL, rightidx, &rightRes));
|
||||
*output = leftRes & rightRes;
|
||||
}
|
||||
|
||||
_return:
|
||||
|
@ -1810,33 +1712,6 @@ _return:
|
|||
SCL_RET(code);
|
||||
}
|
||||
|
||||
static int32_t vectorBitOrHelper(SColumnInfoData *pLeftCol, SColumnInfoData *pRightCol, SColumnInfoData *pOutputCol,
|
||||
int32_t numOfRows, int32_t step, int32_t i) {
|
||||
_getBigintValue_fn_t getVectorBigintValueFnLeft;
|
||||
_getBigintValue_fn_t getVectorBigintValueFnRight;
|
||||
SCL_ERR_RET(getVectorBigintValueFn(pLeftCol->info.type, &getVectorBigintValueFnLeft));
|
||||
SCL_ERR_RET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
|
||||
|
||||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataSetNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
int64_t rx = 0;
|
||||
SCL_ERR_RET(getVectorBigintValueFnRight(RIGHT_COL, 0, &rx));
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
int64_t lx = 0;
|
||||
SCL_ERR_RET(getVectorBigintValueFnLeft(LEFT_COL, i, &lx));
|
||||
*output = lx | rx;
|
||||
}
|
||||
}
|
||||
SCL_RET(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
int32_t vectorBitOr(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, int32_t _ord) {
|
||||
SColumnInfoData *pOutputCol = pOut->columnData;
|
||||
pOut->numOfRows = TMAX(pLeft->numOfRows, pRight->numOfRows);
|
||||
|
@ -1857,22 +1732,20 @@ int32_t vectorBitOr(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOu
|
|||
SCL_ERR_JRET(getVectorBigintValueFn(pRightCol->info.type, &getVectorBigintValueFnRight));
|
||||
|
||||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (IS_NULL) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
int64_t leftRes = 0;
|
||||
int64_t rightRes = 0;
|
||||
SCL_ERR_JRET(getVectorBigintValueFnLeft(LEFT_COL, i, &leftRes));
|
||||
SCL_ERR_JRET(getVectorBigintValueFnRight(RIGHT_COL, i, &rightRes));
|
||||
*output = leftRes | rightRes;
|
||||
int32_t numOfRows = TMAX(pLeft->numOfRows, pRight->numOfRows);
|
||||
for (; i < numOfRows && i >= 0; i += step, output += 1) {
|
||||
int32_t leftidx = pLeft->numOfRows == 1 ? 0 : i;
|
||||
int32_t rightidx = pRight->numOfRows == 1 ? 0 : i;
|
||||
if (IS_HELPER_NULL(pRightCol, leftidx) || IS_HELPER_NULL(pLeftCol, rightidx)) {
|
||||
colDataSetNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
} else if (pLeft->numOfRows == 1) {
|
||||
SCL_ERR_JRET(vectorBitOrHelper(pRightCol, pLeftCol, pOutputCol, pRight->numOfRows, step, i));
|
||||
} else if (pRight->numOfRows == 1) {
|
||||
SCL_ERR_JRET(vectorBitOrHelper(pLeftCol, pRightCol, pOutputCol, pLeft->numOfRows, step, i));
|
||||
|
||||
int64_t leftRes = 0;
|
||||
int64_t rightRes = 0;
|
||||
SCL_ERR_JRET(getVectorBigintValueFnLeft(LEFT_COL, leftidx, &leftRes));
|
||||
SCL_ERR_JRET(getVectorBigintValueFnRight(RIGHT_COL, rightidx, &rightRes));
|
||||
*output = leftRes | rightRes;
|
||||
}
|
||||
|
||||
_return:
|
||||
|
|
|
@ -391,6 +391,26 @@ TEST(constantTest, bigint_add_bigint) {
|
|||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, ubigint_add_ubigint) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
code = scltMakeValueNode(&pLeft, TSDB_DATA_TYPE_UBIGINT, &scltLeftV);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeValueNode(&pRight, TSDB_DATA_TYPE_UBIGINT, &scltRightV);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeOpNode(&opNode, OP_TYPE_ADD, TSDB_DATA_TYPE_UBIGINT, pLeft, pRight);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
|
||||
code = scalarCalculateConstants(opNode, &res);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
||||
SValueNode *v = (SValueNode *)res;
|
||||
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_UBIGINT);
|
||||
ASSERT_FLOAT_EQ(v->datum.d, (scltLeftV + scltRightV));
|
||||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, double_sub_bigint) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -431,6 +451,66 @@ TEST(constantTest, tinyint_and_smallint) {
|
|||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, utinyint_and_usmallint) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
code = scltMakeValueNode(&pLeft, TSDB_DATA_TYPE_UTINYINT, &scltLeftV);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeValueNode(&pRight, TSDB_DATA_TYPE_USMALLINT, &scltRightV);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeOpNode(&opNode, OP_TYPE_BIT_AND, TSDB_DATA_TYPE_BIGINT, pLeft, pRight);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
|
||||
code = scalarCalculateConstants(opNode, &res);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
||||
SValueNode *v = (SValueNode *)res;
|
||||
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_BIGINT);
|
||||
ASSERT_EQ(v->datum.i, (int64_t)scltLeftV & (int64_t)scltRightV);
|
||||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, uint_and_usmallint) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
code = scltMakeValueNode(&pLeft, TSDB_DATA_TYPE_UINT, &scltLeftV);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeValueNode(&pRight, TSDB_DATA_TYPE_USMALLINT, &scltRightV);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeOpNode(&opNode, OP_TYPE_BIT_AND, TSDB_DATA_TYPE_BIGINT, pLeft, pRight);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
|
||||
code = scalarCalculateConstants(opNode, &res);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
||||
SValueNode *v = (SValueNode *)res;
|
||||
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_BIGINT);
|
||||
ASSERT_EQ(v->datum.i, (int64_t)scltLeftV & (int64_t)scltRightV);
|
||||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, ubigint_and_uint) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
code = scltMakeValueNode(&pLeft, TSDB_DATA_TYPE_UBIGINT, &scltLeftV);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeValueNode(&pRight, TSDB_DATA_TYPE_UINT, &scltRightV);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeOpNode(&opNode, OP_TYPE_BIT_AND, TSDB_DATA_TYPE_BIGINT, pLeft, pRight);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
|
||||
code = scalarCalculateConstants(opNode, &res);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
||||
SValueNode *v = (SValueNode *)res;
|
||||
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_BIGINT);
|
||||
ASSERT_EQ(v->datum.i, (int64_t)scltLeftV & (int64_t)scltRightV);
|
||||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, bigint_or_double) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -494,6 +574,53 @@ TEST(constantTest, int_greater_double) {
|
|||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, binary_greater_equal_varbinary) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
char binaryStr[64] = {0};
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
(void)sprintf(&binaryStr[2], "%d", scltRightV);
|
||||
varDataSetLen(binaryStr, strlen(&binaryStr[2]));
|
||||
code = scltMakeValueNode(&pLeft, TSDB_DATA_TYPE_VARBINARY, binaryStr);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeValueNode(&pRight, TSDB_DATA_TYPE_BINARY, binaryStr);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeOpNode(&opNode, OP_TYPE_GREATER_THAN, TSDB_DATA_TYPE_BOOL, pLeft, pRight);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
|
||||
code = scalarCalculateConstants(opNode, &res);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
||||
SValueNode *v = (SValueNode *)res;
|
||||
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_BOOL);
|
||||
ASSERT_EQ(v->datum.b, scltLeftV < scltRightVd);
|
||||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, binary_equal_geo) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
char geoRawStr[64] = "POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))";
|
||||
char geoStr[64] = {0};
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
(void)sprintf(&geoStr[2], "%s", geoRawStr);
|
||||
varDataSetLen(geoStr, strlen(&geoStr[2]));
|
||||
code = scltMakeValueNode(&pLeft, TSDB_DATA_TYPE_GEOMETRY, geoStr);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeValueNode(&pRight, TSDB_DATA_TYPE_BINARY, geoStr);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
code = scltMakeOpNode(&opNode, OP_TYPE_EQUAL, TSDB_DATA_TYPE_BOOL, pLeft, pRight);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
|
||||
code = scalarCalculateConstants(opNode, &res);
|
||||
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
||||
SValueNode *v = (SValueNode *)res;
|
||||
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_BOOL);
|
||||
ASSERT_EQ(v->datum.b, scltLeftV < scltRightVd);
|
||||
nodesDestroyNode(res);
|
||||
}
|
||||
|
||||
TEST(constantTest, int_greater_equal_binary) {
|
||||
SNode *pLeft = NULL, *pRight = NULL, *opNode = NULL, *res = NULL;
|
||||
char binaryStr[64] = {0};
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
taos> select leastsquares(1, 1, 1)
|
||||
leastsquares(1, 1, 1) |
|
||||
=================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(1.1 as float), 1, 1)
|
||||
leastsquares(cast(1.1 as float), 1, 1) |
|
||||
=========================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(1.1 as double), 1, 1)
|
||||
leastsquares(cast(1.1 as double), 1, 1) |
|
||||
==========================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(1 as tinyint), 1, 1)
|
||||
leastsquares(cast(1 as tinyint), 1, 1) |
|
||||
=========================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(100 as smallint), 1, 1)
|
||||
leastsquares(cast(100 as smallint), 1, 1) |
|
||||
============================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(100000 as int), 1, 1)
|
||||
leastsquares(cast(100000 as int), 1, 1) |
|
||||
==========================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(10000000000 as bigint), 1, 1)
|
||||
leastsquares(cast(10000000000 as bigint), 1, 1) |
|
||||
==================================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(1 as tinyint unsigned), 1, 1)
|
||||
leastsquares(cast(1 as tinyint unsigned), 1, 1) |
|
||||
==================================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(100 as smallint unsigned), 1, 1)
|
||||
leastsquares(cast(100 as smallint unsigned), 1, 1) |
|
||||
=====================================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(100000 as int unsigned), 1, 1)
|
||||
leastsquares(cast(100000 as int unsigned), 1, 1) |
|
||||
===================================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
||||
taos> select leastsquares(cast(10000000000 as bigint unsigned), 1, 1)
|
||||
leastsquares(cast(10000000000 as bigint unsigned), 1, 1) |
|
||||
===========================================================
|
||||
{slop:-nan, intercept:-nan} |
|
||||
|
|
|
@ -603,3 +603,58 @@ taos> select location, max(current) from ts_4893.meters group by location order
|
|||
============================================
|
||||
beijing | 11.9989996 |
|
||||
|
||||
taos> select max(1)
|
||||
max(1) |
|
||||
========================
|
||||
1 |
|
||||
|
||||
taos> select max(cast(1 as tinyint))
|
||||
max(cast(1 as tinyint)) |
|
||||
==========================
|
||||
1 |
|
||||
|
||||
taos> select max(cast(100 as smallint))
|
||||
max(cast(100 as smallint)) |
|
||||
=============================
|
||||
100 |
|
||||
|
||||
taos> select max(cast(100000 as int))
|
||||
max(cast(100000 as int)) |
|
||||
===========================
|
||||
100000 |
|
||||
|
||||
taos> select max(cast(10000000000 as bigint))
|
||||
max(cast(10000000000 as bigint)) |
|
||||
===================================
|
||||
10000000000 |
|
||||
|
||||
taos> select max(cast(1 as tinyint unsigned))
|
||||
max(cast(1 as tinyint unsigned)) |
|
||||
===================================
|
||||
1 |
|
||||
|
||||
taos> select max(cast(100 as smallint unsigned))
|
||||
max(cast(100 as smallint unsigned)) |
|
||||
======================================
|
||||
100 |
|
||||
|
||||
taos> select max(cast(100000 as int unsigned))
|
||||
max(cast(100000 as int unsigned)) |
|
||||
====================================
|
||||
100000 |
|
||||
|
||||
taos> select max(cast(10000000000 as bigint unsigned))
|
||||
max(cast(10000000000 as bigint unsigned)) |
|
||||
============================================
|
||||
10000000000 |
|
||||
|
||||
taos> select max(cast(1.1 as float))
|
||||
max(cast(1.1 as float)) |
|
||||
==========================
|
||||
1.1000000e+00 |
|
||||
|
||||
taos> select max(cast(1.1 as double))
|
||||
max(cast(1.1 as double)) |
|
||||
============================
|
||||
1.100000000000000 |
|
||||
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 576.
|
|
@ -603,3 +603,58 @@ taos> select location, min(id) from ts_4893.meters group by location order by lo
|
|||
===================================
|
||||
beijing | 0 |
|
||||
|
||||
taos> select min(1)
|
||||
min(1) |
|
||||
========================
|
||||
1 |
|
||||
|
||||
taos> select min(cast(1 as tinyint))
|
||||
min(cast(1 as tinyint)) |
|
||||
==========================
|
||||
1 |
|
||||
|
||||
taos> select min(cast(100 as smallint))
|
||||
min(cast(100 as smallint)) |
|
||||
=============================
|
||||
100 |
|
||||
|
||||
taos> select min(cast(100000 as int))
|
||||
min(cast(100000 as int)) |
|
||||
===========================
|
||||
100000 |
|
||||
|
||||
taos> select min(cast(10000000000 as bigint))
|
||||
min(cast(10000000000 as bigint)) |
|
||||
===================================
|
||||
10000000000 |
|
||||
|
||||
taos> select min(cast(1 as tinyint unsigned))
|
||||
min(cast(1 as tinyint unsigned)) |
|
||||
===================================
|
||||
1 |
|
||||
|
||||
taos> select min(cast(100 as smallint unsigned))
|
||||
min(cast(100 as smallint unsigned)) |
|
||||
======================================
|
||||
100 |
|
||||
|
||||
taos> select min(cast(100000 as int unsigned))
|
||||
min(cast(100000 as int unsigned)) |
|
||||
====================================
|
||||
100000 |
|
||||
|
||||
taos> select min(cast(10000000000 as bigint unsigned))
|
||||
min(cast(10000000000 as bigint unsigned)) |
|
||||
============================================
|
||||
10000000000 |
|
||||
|
||||
taos> select min(cast(1.1 as float))
|
||||
min(cast(1.1 as float)) |
|
||||
==========================
|
||||
1.1000000e+00 |
|
||||
|
||||
taos> select min(cast(1.1 as double))
|
||||
min(cast(1.1 as double)) |
|
||||
============================
|
||||
1.100000000000000 |
|
||||
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 576.
|
|
@ -308,3 +308,53 @@ taos> select round(log(current), 2) from ts_4893.meters limit 1
|
|||
============================
|
||||
2.370000000000000 |
|
||||
|
||||
taos> select round(cast(1.0e+400 as float), 0);
|
||||
round(cast(1.0e+400 as float), 0) |
|
||||
====================================
|
||||
NULL |
|
||||
|
||||
taos> select round(cast(1.0e+400 as double), 0);
|
||||
round(cast(1.0e+400 as double), 0) |
|
||||
=====================================
|
||||
NULL |
|
||||
|
||||
taos> select round(cast(5 as tinyint), 1);
|
||||
round(cast(5 as tinyint), 1) |
|
||||
===============================
|
||||
5 |
|
||||
|
||||
taos> select round(cast(50 as smallint), 1);
|
||||
round(cast(50 as smallint), 1) |
|
||||
=================================
|
||||
50 |
|
||||
|
||||
taos> select round(cast(500 as int), 1);
|
||||
round(cast(500 as int), 1) |
|
||||
=============================
|
||||
500 |
|
||||
|
||||
taos> select round(cast(50000 as bigint), 1);
|
||||
round(cast(50000 as bigint), 1) |
|
||||
==================================
|
||||
50000 |
|
||||
|
||||
taos> select round(cast(5 as TINYINT UNSIGNED), 1);
|
||||
round(cast(5 as tinyint unsigned), 1) |
|
||||
========================================
|
||||
5 |
|
||||
|
||||
taos> select round(cast(50 as smallint unsigned), 1);
|
||||
round(cast(50 as smallint unsigned), 1) |
|
||||
==========================================
|
||||
50 |
|
||||
|
||||
taos> select round(cast(500 as int unsigned), 1);
|
||||
round(cast(500 as int unsigned), 1) |
|
||||
======================================
|
||||
500 |
|
||||
|
||||
taos> select round(cast(50000 as bigint unsigned), 1)
|
||||
round(cast(50000 as bigint unsigned), 1) |
|
||||
===========================================
|
||||
50000 |
|
||||
|
||||
|
|
|
|
@ -121,6 +121,106 @@ taos> select SIGN(id) + id from ts_4893.meters order by ts limit 5
|
|||
4.000000000000000 |
|
||||
5.000000000000000 |
|
||||
|
||||
taos> select sign(cast(1 as tinyint))
|
||||
sign(cast(1 as tinyint)) |
|
||||
===========================
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as smallint))
|
||||
sign(cast(1 as smallint)) |
|
||||
============================
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as int))
|
||||
sign(cast(1 as int)) |
|
||||
=======================
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as bigint))
|
||||
sign(cast(1 as bigint)) |
|
||||
==========================
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as tinyint unsigned))
|
||||
sign(cast(1 as tinyint unsigned)) |
|
||||
====================================
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as smallint unsigned))
|
||||
sign(cast(1 as smallint unsigned)) |
|
||||
=====================================
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as int unsigned))
|
||||
sign(cast(1 as int unsigned)) |
|
||||
================================
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as bigint unsigned))
|
||||
sign(cast(1 as bigint unsigned)) |
|
||||
===================================
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as float))
|
||||
sign(cast(1 as float)) |
|
||||
=========================
|
||||
1.0000000e+00 |
|
||||
|
||||
taos> select sign(cast(1 as double))
|
||||
sign(cast(1 as double)) |
|
||||
============================
|
||||
1.000000000000000 |
|
||||
|
||||
taos> select sign(cast(NULL as tinyint))
|
||||
sign(cast(null as tinyint)) |
|
||||
==============================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as smallint))
|
||||
sign(cast(null as smallint)) |
|
||||
===============================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as int))
|
||||
sign(cast(null as int)) |
|
||||
==========================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as bigint))
|
||||
sign(cast(null as bigint)) |
|
||||
=============================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as tinyint unsigned))
|
||||
sign(cast(null as tinyint unsigned)) |
|
||||
=======================================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as smallint unsigned))
|
||||
sign(cast(null as smallint unsigned)) |
|
||||
========================================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as int unsigned))
|
||||
sign(cast(null as int unsigned)) |
|
||||
===================================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as bigint unsigned))
|
||||
sign(cast(null as bigint unsigned)) |
|
||||
======================================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as float))
|
||||
sign(cast(null as float)) |
|
||||
============================
|
||||
NULL |
|
||||
|
||||
taos> select sign(cast(NULL as double))
|
||||
sign(cast(null as double)) |
|
||||
=============================
|
||||
NULL |
|
||||
|
||||
taos> select SIGN(abs(10))
|
||||
sign(abs(10)) |
|
||||
========================
|
||||
|
@ -213,6 +313,34 @@ taos> select sign(current) from ts_4893.meters order by ts limit 10
|
|||
1.0000000 |
|
||||
1.0000000 |
|
||||
|
||||
taos> select sign(cast(current as float)) from ts_4893.d0 order by ts limit 10
|
||||
sign(cast(current as float)) |
|
||||
===============================
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
|
||||
taos> select sign(cast(current as float)) from ts_4893.meters order by ts limit 10
|
||||
sign(cast(current as float)) |
|
||||
===============================
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
|
||||
taos> select sign(null)
|
||||
sign(null) |
|
||||
========================
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 139.
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
taos> select statecount(1, 'GT', 1)
|
||||
statecount(1, 'GT', 1) |
|
||||
=========================
|
||||
-1 |
|
||||
|
||||
taos> select statecount(cast(1 as tinyint), 'GT', 1)
|
||||
statecount(cast(1 as tinyint), 'GT', 1) |
|
||||
==========================================
|
||||
-1 |
|
||||
|
||||
taos> select statecount(cast(100 as smallint), 'GT', 1)
|
||||
statecount(cast(100 as smallint), 'GT', 1) |
|
||||
=============================================
|
||||
1 |
|
||||
|
||||
taos> select statecount(cast(100000 as int), 'GT', 1)
|
||||
statecount(cast(100000 as int), 'GT', 1) |
|
||||
===========================================
|
||||
1 |
|
||||
|
||||
taos> select statecount(cast(10000000000 as bigint), 'GT', 1)
|
||||
statecount(cast(10000000000 as bigint), 'GT', 1) |
|
||||
===================================================
|
||||
1 |
|
||||
|
||||
taos> select statecount(cast(1 as tinyint unsigned), 'GT', 1)
|
||||
statecount(cast(1 as tinyint unsigned), 'GT', 1) |
|
||||
===================================================
|
||||
-1 |
|
||||
|
||||
taos> select statecount(cast(100 as smallint unsigned), 'GT', 1)
|
||||
statecount(cast(100 as smallint unsigned), 'GT', 1) |
|
||||
======================================================
|
||||
1 |
|
||||
|
||||
taos> select statecount(cast(100000 as int unsigned), 'GT', 1)
|
||||
statecount(cast(100000 as int unsigned), 'GT', 1) |
|
||||
====================================================
|
||||
1 |
|
||||
|
||||
taos> select statecount(cast(10000000000 as bigint unsigned), 'GT', 1)
|
||||
statecount(cast(10000000000 as bigint unsigned), 'GT', 1) |
|
||||
============================================================
|
||||
1 |
|
||||
|
||||
taos> select statecount(cast(1.1 as float), 'GT', 1)
|
||||
statecount(cast(1.1 as float), 'GT', 1) |
|
||||
==========================================
|
||||
1 |
|
||||
|
||||
taos> select statecount(cast(1.1 as double), 'GT', 1)
|
||||
statecount(cast(1.1 as double), 'GT', 1) |
|
||||
===========================================
|
||||
1 |
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
taos> select sum(1)
|
||||
sum(1) |
|
||||
========================
|
||||
1 |
|
||||
|
||||
taos> select sum(cast(1 as tinyint))
|
||||
sum(cast(1 as tinyint)) |
|
||||
==========================
|
||||
1 |
|
||||
|
||||
taos> select sum(cast(100 as smallint))
|
||||
sum(cast(100 as smallint)) |
|
||||
=============================
|
||||
100 |
|
||||
|
||||
taos> select sum(cast(100000 as int))
|
||||
sum(cast(100000 as int)) |
|
||||
===========================
|
||||
100000 |
|
||||
|
||||
taos> select sum(cast(10000000000 as bigint))
|
||||
sum(cast(10000000000 as bigint)) |
|
||||
===================================
|
||||
10000000000 |
|
||||
|
||||
taos> select sum(cast(1 as tinyint unsigned))
|
||||
sum(cast(1 as tinyint unsigned)) |
|
||||
===================================
|
||||
1 |
|
||||
|
||||
taos> select sum(cast(100 as smallint unsigned))
|
||||
sum(cast(100 as smallint unsigned)) |
|
||||
======================================
|
||||
100 |
|
||||
|
||||
taos> select sum(cast(100000 as int unsigned))
|
||||
sum(cast(100000 as int unsigned)) |
|
||||
====================================
|
||||
100000 |
|
||||
|
||||
taos> select sum(cast(10000000000 as bigint unsigned))
|
||||
sum(cast(10000000000 as bigint unsigned)) |
|
||||
============================================
|
||||
10000000000 |
|
||||
|
||||
taos> select sum(cast(1.1 as float))
|
||||
sum(cast(1.1 as float)) |
|
||||
============================
|
||||
1.100000023841858 |
|
||||
|
||||
taos> select sum(cast(1.1 as double))
|
||||
sum(cast(1.1 as double)) |
|
||||
============================
|
||||
1.100000000000000 |
|
||||
|
|
|
@ -179,6 +179,33 @@ taos> select trim(trailing '空格blank' from '空格blank空格中Tes空格blan
|
|||
===================================================================
|
||||
空格blank空格中Tes空格blank空 |
|
||||
|
||||
taos> select trim(both from nch1) from ts_4893.meters order by ts limit 5
|
||||
trim(both from nch1) |
|
||||
=================================
|
||||
novel |
|
||||
一二三四五六七八九十 |
|
||||
update |
|
||||
prision |
|
||||
novel |
|
||||
|
||||
taos> select trim(leading from nch1) from ts_4893.meters order by ts limit 5
|
||||
trim(leading from nch1) |
|
||||
=================================
|
||||
novel |
|
||||
一二三四五六七八九十 |
|
||||
update |
|
||||
prision |
|
||||
novel |
|
||||
|
||||
taos> select trim(trailing from nch1) from ts_4893.meters order by ts limit 5
|
||||
trim(trailing from nch1) |
|
||||
=================================
|
||||
novel |
|
||||
一二三四五六七八九十 |
|
||||
update |
|
||||
prision |
|
||||
novel |
|
||||
|
||||
taos> select trim(nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
|
||||
trim(nch2 from nch1) |
|
||||
=================================
|
||||
|
|
|
|
@ -0,0 +1,11 @@
|
|||
select avg(1)
|
||||
select avg(cast(1 as tinyint))
|
||||
select avg(cast(100 as smallint))
|
||||
select avg(cast(100000 as int))
|
||||
select avg(cast(10000000000 as bigint))
|
||||
select avg(cast(1 as tinyint unsigned))
|
||||
select avg(cast(100 as smallint unsigned))
|
||||
select avg(cast(100000 as int unsigned))
|
||||
select avg(cast(10000000000 as bigint unsigned))
|
||||
select avg(cast(1.1 as float))
|
||||
select avg(cast(1.1 as double))
|
|
@ -0,0 +1,11 @@
|
|||
select leastsquares(1, 1, 1)
|
||||
select leastsquares(cast(1.1 as float), 1, 1)
|
||||
select leastsquares(cast(1.1 as double), 1, 1)
|
||||
select leastsquares(cast(1 as tinyint), 1, 1)
|
||||
select leastsquares(cast(100 as smallint), 1, 1)
|
||||
select leastsquares(cast(100000 as int), 1, 1)
|
||||
select leastsquares(cast(10000000000 as bigint), 1, 1)
|
||||
select leastsquares(cast(1 as tinyint unsigned), 1, 1)
|
||||
select leastsquares(cast(100 as smallint unsigned), 1, 1)
|
||||
select leastsquares(cast(100000 as int unsigned), 1, 1)
|
||||
select leastsquares(cast(10000000000 as bigint unsigned), 1, 1)
|
|
@ -26,3 +26,14 @@ select log(max(voltage) + 1) from ts_4893.meters
|
|||
select groupid, max(voltage) from ts_4893.meters group by groupid order by groupid
|
||||
select location, max(id) from ts_4893.meters group by location order by location
|
||||
select location, max(current) from ts_4893.meters group by location order by location
|
||||
select max(1)
|
||||
select max(cast(1 as tinyint))
|
||||
select max(cast(100 as smallint))
|
||||
select max(cast(100000 as int))
|
||||
select max(cast(10000000000 as bigint))
|
||||
select max(cast(1 as tinyint unsigned))
|
||||
select max(cast(100 as smallint unsigned))
|
||||
select max(cast(100000 as int unsigned))
|
||||
select max(cast(10000000000 as bigint unsigned))
|
||||
select max(cast(1.1 as float))
|
||||
select max(cast(1.1 as double))
|
||||
|
|
|
@ -26,3 +26,14 @@ select log(min(voltage) + 1) from ts_4893.meters
|
|||
select groupid, min(voltage) from ts_4893.meters group by groupid order by groupid
|
||||
select location, min(current) from ts_4893.meters group by location order by location
|
||||
select location, min(id) from ts_4893.meters group by location order by location
|
||||
select min(1)
|
||||
select min(cast(1 as tinyint))
|
||||
select min(cast(100 as smallint))
|
||||
select min(cast(100000 as int))
|
||||
select min(cast(10000000000 as bigint))
|
||||
select min(cast(1 as tinyint unsigned))
|
||||
select min(cast(100 as smallint unsigned))
|
||||
select min(cast(100000 as int unsigned))
|
||||
select min(cast(10000000000 as bigint unsigned))
|
||||
select min(cast(1.1 as float))
|
||||
select min(cast(1.1 as double))
|
||||
|
|
|
@ -47,3 +47,13 @@ select round(abs(voltage), 2) from ts_4893.meters limit 1
|
|||
select round(pi() * phase, 3) from ts_4893.meters limit 1
|
||||
select round(sqrt(voltage), 2) from ts_4893.meters limit 1
|
||||
select round(log(current), 2) from ts_4893.meters limit 1
|
||||
select round(cast(1.0e+400 as float), 0);
|
||||
select round(cast(1.0e+400 as double), 0);
|
||||
select round(cast(5 as tinyint), 1);
|
||||
select round(cast(50 as smallint), 1);
|
||||
select round(cast(500 as int), 1);
|
||||
select round(cast(50000 as bigint), 1);
|
||||
select round(cast(5 as TINYINT UNSIGNED), 1);
|
||||
select round(cast(50 as smallint unsigned), 1);
|
||||
select round(cast(500 as int unsigned), 1);
|
||||
select round(cast(50000 as bigint unsigned), 1);
|
|
@ -20,6 +20,26 @@ select SIGN(2) * SIGN(1) from ts_4893.meters limit 1
|
|||
select SIGN(2) / SIGN(1) from ts_4893.meters limit 1
|
||||
select SIGN(1) + id from ts_4893.meters order by ts limit 5
|
||||
select SIGN(id) + id from ts_4893.meters order by ts limit 5
|
||||
select sign(cast(1 as tinyint))
|
||||
select sign(cast(1 as smallint))
|
||||
select sign(cast(1 as int))
|
||||
select sign(cast(1 as bigint))
|
||||
select sign(cast(1 as tinyint unsigned))
|
||||
select sign(cast(1 as smallint unsigned))
|
||||
select sign(cast(1 as int unsigned))
|
||||
select sign(cast(1 as bigint unsigned))
|
||||
select sign(cast(1 as float))
|
||||
select sign(cast(1 as double))
|
||||
select sign(cast(NULL as tinyint))
|
||||
select sign(cast(NULL as smallint))
|
||||
select sign(cast(NULL as int))
|
||||
select sign(cast(NULL as bigint))
|
||||
select sign(cast(NULL as tinyint unsigned))
|
||||
select sign(cast(NULL as smallint unsigned))
|
||||
select sign(cast(NULL as int unsigned))
|
||||
select sign(cast(NULL as bigint unsigned))
|
||||
select sign(cast(NULL as float))
|
||||
select sign(cast(NULL as double))
|
||||
select SIGN(abs(10))
|
||||
select SIGN(abs(-10))
|
||||
select abs(SIGN(10))
|
||||
|
@ -34,6 +54,8 @@ select sign(-1)
|
|||
select sign(-10)
|
||||
select sign(current) from ts_4893.d0 order by ts limit 10
|
||||
select sign(current) from ts_4893.meters order by ts limit 10
|
||||
select sign(cast(current as float)) from ts_4893.d0 order by ts limit 10
|
||||
select sign(cast(current as float)) from ts_4893.meters order by ts limit 10
|
||||
select sign(null)
|
||||
select sign(25)
|
||||
select sign(-10)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
select statecount(1, 'GT', 1)
|
||||
select statecount(cast(1 as tinyint), 'GT', 1)
|
||||
select statecount(cast(100 as smallint), 'GT', 1)
|
||||
select statecount(cast(100000 as int), 'GT', 1)
|
||||
select statecount(cast(10000000000 as bigint), 'GT', 1)
|
||||
select statecount(cast(1 as tinyint unsigned), 'GT', 1)
|
||||
select statecount(cast(100 as smallint unsigned), 'GT', 1)
|
||||
select statecount(cast(100000 as int unsigned), 'GT', 1)
|
||||
select statecount(cast(10000000000 as bigint unsigned), 'GT', 1)
|
||||
select statecount(cast(1.1 as float), 'GT', 1)
|
||||
select statecount(cast(1.1 as double), 'GT', 1)
|
|
@ -0,0 +1,11 @@
|
|||
select sum(1)
|
||||
select sum(cast(1 as tinyint))
|
||||
select sum(cast(100 as smallint))
|
||||
select sum(cast(100000 as int))
|
||||
select sum(cast(10000000000 as bigint))
|
||||
select sum(cast(1 as tinyint unsigned))
|
||||
select sum(cast(100 as smallint unsigned))
|
||||
select sum(cast(100000 as int unsigned))
|
||||
select sum(cast(10000000000 as bigint unsigned))
|
||||
select sum(cast(1.1 as float))
|
||||
select sum(cast(1.1 as double))
|
|
@ -34,6 +34,9 @@ select trim('空格blank' from '空格blank空格中Tes空格blank空')
|
|||
select trim(both '空格blank' from '空格blank空格中Tes空格blank空')
|
||||
select trim(leading '空格blank' from '空格blank空格中Tes空格blank空')
|
||||
select trim(trailing '空格blank' from '空格blank空格中Tes空格blank空')
|
||||
select trim(both from nch1) from ts_4893.meters order by ts limit 5
|
||||
select trim(leading from nch1) from ts_4893.meters order by ts limit 5
|
||||
select trim(trailing from nch1) from ts_4893.meters order by ts limit 5
|
||||
select trim(nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
|
||||
select trim(both nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
|
||||
select trim(leading nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
|
||||
|
|
|
@ -294,6 +294,18 @@ class TDTestCase(TBase):
|
|||
|
||||
tdSql.error("select min(nonexistent_column) from ts_4893.meters;")
|
||||
|
||||
def test_sum(self):
|
||||
self.test_normal_query_new("sum")
|
||||
|
||||
def test_statecount(self):
|
||||
self.test_normal_query_new("statecount")
|
||||
|
||||
def test_avg(self):
|
||||
self.test_normal_query_new("avg")
|
||||
|
||||
def test_leastsquares(self):
|
||||
self.test_normal_query_new("leastsquares")
|
||||
|
||||
def test_error(self):
|
||||
tdSql.error("select * from (select to_iso8601(ts, timezone()), timezone() from ts_4893.meters \
|
||||
order by ts desc) limit 1000;", expectErrInfo="Invalid parameter data type : to_iso8601") # TS-5340
|
||||
|
@ -336,6 +348,10 @@ class TDTestCase(TBase):
|
|||
# agg function
|
||||
self.test_stddev_pop()
|
||||
self.test_varpop()
|
||||
self.test_avg()
|
||||
self.test_sum()
|
||||
self.test_leastsquares()
|
||||
self.test_statecount()
|
||||
|
||||
# select function
|
||||
self.test_max()
|
||||
|
|
Loading…
Reference in New Issue