提交 71e5094f 编写于 作者: G Ganlin Zhao

[TD-11216]<feature>: Time window related keywords

上级 b551e85e
......@@ -2516,20 +2516,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
}
colSchema = *tGetTimeWindowColumnSchema(index.columnIndex);
switch (index.columnIndex) {
case TSDB_TSWIN_START_COLUMN_INDEX: {
functionId = TSDB_FUNC_WSTART;
break;
}
case TSDB_TSWIN_STOP_COLUMN_INDEX: {
functionId = TSDB_FUNC_WSTOP;
break;
}
case TSDB_TSWIN_DURATION_COLUMN_INDEX: {
functionId = TSDB_FUNC_WDURATION;
break;
}
}
functionId = getTimeWindowFunctionID(index.columnIndex);
colType = TSDB_COL_NORMAL;
}
char name[TSDB_COL_NAME_LEN] = {0};
......
......@@ -233,6 +233,8 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
int32_t *len, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo);
int32_t isValidFunction(const char* name, int32_t len);
int16_t getTimeWindowFunctionID(int16_t colIndex);
#define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0)
#define IS_MULTIOUTPUT(x) (((x)&TSDB_FUNCSTATE_MO) != 0)
#define IS_SINGLEOUTPUT(x) (((x)&TSDB_FUNCSTATE_SO) != 0)
......
......@@ -5627,6 +5627,22 @@ static void tail_func_finalizer(SQLFunctionCtx *pCtx) {
doFinalizer(pCtx);
}
int16_t getTimeWindowFunctionID(int16_t colIndex) {
switch (colIndex) {
case TSDB_TSWIN_START_COLUMN_INDEX: {
return TSDB_FUNC_WSTART;
}
case TSDB_TSWIN_STOP_COLUMN_INDEX: {
return TSDB_FUNC_WSTOP;
}
case TSDB_TSWIN_DURATION_COLUMN_INDEX: {
return TSDB_FUNC_WDURATION;
}
default:
return TSDB_FUNC_INVALID_ID;
}
}
static void wstart_function(SQLFunctionCtx *pCtx) {
SET_VAL(pCtx, pCtx->size, 1);
*(int64_t *)(pCtx->pOutput) = pCtx->startTs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册