Merge branch '3.0' of https://github.com/taosdata/TDengine into enh/tsdb_optimize
This commit is contained in:
commit
b3e7dd5a62
|
@ -713,6 +713,14 @@ The charset that takes effect is UTF-8.
|
||||||
| Value Range | 0: disable UDF; 1: enabled UDF |
|
| Value Range | 0: disable UDF; 1: enabled UDF |
|
||||||
| Default Value | 1 |
|
| Default Value | 1 |
|
||||||
|
|
||||||
|
### ttlChangeOnWrite
|
||||||
|
|
||||||
|
| Attribute | Description |
|
||||||
|
| ------------- | ----------------------------------------------------------------------------- |
|
||||||
|
| Applicable | Server Only |
|
||||||
|
| Meaning | Whether the ttl expiration time changes with the table modification operation |
|
||||||
|
| Value Range | 0: not change; 1: change by modification |
|
||||||
|
| Default Value | 0 |
|
||||||
|
|
||||||
## 3.0 Parameters
|
## 3.0 Parameters
|
||||||
|
|
||||||
|
@ -770,3 +778,4 @@ The charset that takes effect is UTF-8.
|
||||||
| 52 | charset | Yes | Yes | |
|
| 52 | charset | Yes | Yes | |
|
||||||
| 53 | udf | Yes | Yes | |
|
| 53 | udf | Yes | Yes | |
|
||||||
| 54 | enableCoreFile | Yes | Yes | |
|
| 54 | enableCoreFile | Yes | Yes | |
|
||||||
|
| 55 | ttlChangeOnWrite | No | Yes | |
|
||||||
|
|
|
@ -717,6 +717,15 @@ charset 的有效值是 UTF-8。
|
||||||
| 取值范围 | 0: 不启动;1:启动 |
|
| 取值范围 | 0: 不启动;1:启动 |
|
||||||
| 缺省值 | 1 |
|
| 缺省值 | 1 |
|
||||||
|
|
||||||
|
### ttlChangeOnWrite
|
||||||
|
|
||||||
|
| 属性 | 说明 |
|
||||||
|
| -------- | ------------------ |
|
||||||
|
| 适用范围 | 仅服务端适用 |
|
||||||
|
| 含义 | ttl 到期时间是否伴随表的修改操作改变 |
|
||||||
|
| 取值范围 | 0: 不改变;1:改变 |
|
||||||
|
| 缺省值 | 0 |
|
||||||
|
|
||||||
## 压缩参数
|
## 压缩参数
|
||||||
|
|
||||||
### compressMsgSize
|
### compressMsgSize
|
||||||
|
@ -784,6 +793,7 @@ charset 的有效值是 UTF-8。
|
||||||
| 52 | charset | 是 | 是 | |
|
| 52 | charset | 是 | 是 | |
|
||||||
| 53 | udf | 是 | 是 | |
|
| 53 | udf | 是 | 是 | |
|
||||||
| 54 | enableCoreFile | 是 | 是 | |
|
| 54 | enableCoreFile | 是 | 是 | |
|
||||||
|
| 55 | ttlChangeOnWrite | 否 | 是 | |
|
||||||
|
|
||||||
## 2.x->3.0 的废弃参数
|
## 2.x->3.0 的废弃参数
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef struct SIndefOperatorInfo {
|
||||||
SSDataBlock* pNextGroupRes;
|
SSDataBlock* pNextGroupRes;
|
||||||
} SIndefOperatorInfo;
|
} SIndefOperatorInfo;
|
||||||
|
|
||||||
static SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator);
|
static int32_t doGenerateSourceData(SOperatorInfo* pOperator);
|
||||||
static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator);
|
static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator);
|
||||||
static SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator);
|
static SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator);
|
||||||
static SArray* setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols);
|
static SArray* setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols);
|
||||||
|
@ -267,7 +267,12 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
|
||||||
SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo;
|
SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo;
|
||||||
|
|
||||||
if (downstream == NULL) {
|
if (downstream == NULL) {
|
||||||
return doGenerateSourceData(pOperator);
|
code = doGenerateSourceData(pOperator);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
T_LONG_JMP(pTaskInfo->env, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (pRes->info.rows > 0) ? pRes : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -616,7 +621,7 @@ SArray* setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols) {
|
||||||
return pList;
|
return pList;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) {
|
int32_t doGenerateSourceData(SOperatorInfo* pOperator) {
|
||||||
SProjectOperatorInfo* pProjectInfo = pOperator->info;
|
SProjectOperatorInfo* pProjectInfo = pOperator->info;
|
||||||
|
|
||||||
SExprSupp* pSup = &pOperator->exprSupp;
|
SExprSupp* pSup = &pOperator->exprSupp;
|
||||||
|
@ -630,14 +635,45 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) {
|
||||||
for (int32_t k = 0; k < pSup->numOfExprs; ++k) {
|
for (int32_t k = 0; k < pSup->numOfExprs; ++k) {
|
||||||
int32_t outputSlotId = pExpr[k].base.resSchema.slotId;
|
int32_t outputSlotId = pExpr[k].base.resSchema.slotId;
|
||||||
|
|
||||||
ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE);
|
if (pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE) {
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pRes->pDataBlock, outputSlotId);
|
SColumnInfoData* pColInfoData = taosArrayGet(pRes->pDataBlock, outputSlotId);
|
||||||
|
|
||||||
int32_t type = pExpr[k].base.pParam[0].param.nType;
|
int32_t type = pExpr[k].base.pParam[0].param.nType;
|
||||||
if (TSDB_DATA_TYPE_NULL == type) {
|
if (TSDB_DATA_TYPE_NULL == type) {
|
||||||
colDataSetNNULL(pColInfoData, 0, 1);
|
colDataSetNNULL(pColInfoData, 0, 1);
|
||||||
|
} else {
|
||||||
|
colDataSetVal(pColInfoData, 0, taosVariantGet(&pExpr[k].base.pParam[0].param, type), false);
|
||||||
|
}
|
||||||
|
} else if (pExpr[k].pExpr->nodeType == QUERY_NODE_FUNCTION) {
|
||||||
|
SqlFunctionCtx* pfCtx = &pSup->pCtx[k];
|
||||||
|
|
||||||
|
// UDF scalar functions will be calculated here, for example, select foo(n) from (select 1 n).
|
||||||
|
// UDF aggregate functions will be handled in agg operator.
|
||||||
|
if (fmIsScalarFunc(pfCtx->functionId)) {
|
||||||
|
SArray* pBlockList = taosArrayInit(4, POINTER_BYTES);
|
||||||
|
taosArrayPush(pBlockList, &pRes);
|
||||||
|
|
||||||
|
SColumnInfoData* pResColData = taosArrayGet(pRes->pDataBlock, outputSlotId);
|
||||||
|
SColumnInfoData idata = {.info = pResColData->info, .hasNull = true};
|
||||||
|
|
||||||
|
SScalarParam dest = {.columnData = &idata};
|
||||||
|
int32_t code = scalarCalculate((SNode*)pExpr[k].pExpr->_function.pFunctNode, pBlockList, &dest);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
taosArrayDestroy(pBlockList);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t startOffset = pRes->info.rows;
|
||||||
|
ASSERT(pRes->info.capacity > 0);
|
||||||
|
colDataAssign(pResColData, &idata, dest.numOfRows, &pRes->info);
|
||||||
|
colDataDestroy(&idata);
|
||||||
|
|
||||||
|
taosArrayDestroy(pBlockList);
|
||||||
|
} else {
|
||||||
|
return TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
colDataSetVal(pColInfoData, 0, taosVariantGet(&pExpr[k].base.pParam[0].param, type), false);
|
return TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +689,7 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) {
|
||||||
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (pRes->info.rows > 0) ? pRes : NULL;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setPseudoOutputColInfo(SSDataBlock* pResult, SqlFunctionCtx* pCtx, SArray* pPseudoList) {
|
static void setPseudoOutputColInfo(SSDataBlock* pResult, SqlFunctionCtx* pCtx, SArray* pPseudoList) {
|
||||||
|
|
|
@ -1694,7 +1694,8 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) {
|
||||||
SCL_ERR_JRET(TSDB_CODE_APP_ERROR);
|
SCL_ERR_JRET(TSDB_CODE_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 == res->numOfRows) {
|
SSDataBlock *pb = taosArrayGetP(pBlockList, 0);
|
||||||
|
if (1 == res->numOfRows && pb->info.rows > 0) {
|
||||||
SCL_ERR_JRET(sclExtendResRows(pDst, res, pBlockList));
|
SCL_ERR_JRET(sclExtendResRows(pDst, res, pBlockList));
|
||||||
} else {
|
} else {
|
||||||
colInfoDataEnsureCapacity(pDst->columnData, res->numOfRows, true);
|
colInfoDataEnsureCapacity(pDst->columnData, res->numOfRows, true);
|
||||||
|
|
|
@ -234,6 +234,11 @@ class TDTestCase:
|
||||||
tdSql.checkData(20,6,88)
|
tdSql.checkData(20,6,88)
|
||||||
tdSql.checkData(20,7,1)
|
tdSql.checkData(20,7,1)
|
||||||
|
|
||||||
|
tdSql.query("select udf1(1) from (select 1)")
|
||||||
|
tdSql.checkData(0,0,1)
|
||||||
|
|
||||||
|
tdSql.query("select udf1(n) from (select 1 n)")
|
||||||
|
tdSql.checkData(0,0,1)
|
||||||
|
|
||||||
# aggregate functions
|
# aggregate functions
|
||||||
tdSql.query("select udf2(num1) ,udf2(num2), udf2(num3) from tb")
|
tdSql.query("select udf2(num1) ,udf2(num2), udf2(num3) from tb")
|
||||||
|
|
Loading…
Reference in New Issue