[td-171] fix bugs in select * for super table.
This commit is contained in:
parent
2ea4875df2
commit
a2f054014d
|
@ -62,7 +62,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||
IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
|
||||
SET(TD_LINUX_64 TRUE)
|
||||
SET(TD_OS_DIR ${TD_COMMUNITY_DIR}/src/os/linux)
|
||||
ADD_DEFINITIONS(-D_M_X64)
|
||||
ADD_DEFINITIONS(-D_M_X64 -D_DEBUG_VIEW)
|
||||
MESSAGE(STATUS "The current platform is Linux 64-bit")
|
||||
ELSEIF (${CMAKE_SIZEOF_VOID_P} MATCHES 4)
|
||||
IF (TD_ARM)
|
||||
|
|
|
@ -98,6 +98,7 @@ int tsdbTableSetSName(STableCfg *config, char *sname, bool dup);
|
|||
void tsdbClearTableCfg(STableCfg *config);
|
||||
|
||||
int32_t tsdbGetTableTagVal(TsdbRepoT *repo, STableId id, int32_t col, int16_t *type, int16_t *bytes, char **val);
|
||||
int32_t tsdbTableGetName(TsdbRepoT *repo, STableId id, char** name);
|
||||
|
||||
int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg);
|
||||
int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId);
|
||||
|
|
|
@ -1383,8 +1383,13 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
|
|||
|
||||
int32_t index = pSqlFuncMsg->colInfo.colIndex;
|
||||
if (TSDB_COL_IS_TAG(pIndex->flag)) {
|
||||
pCtx->inputBytes = pQuery->tagColList[index].bytes;
|
||||
pCtx->inputType = pQuery->tagColList[index].type;
|
||||
if (pIndex->colId == TSDB_TBNAME_COLUMN_INDEX) {
|
||||
pCtx->inputBytes = TSDB_TABLE_NAME_LEN;
|
||||
pCtx->inputType = TSDB_DATA_TYPE_BINARY;
|
||||
} else {
|
||||
pCtx->inputBytes = pQuery->tagColList[index].bytes;
|
||||
pCtx->inputType = pQuery->tagColList[index].type;
|
||||
}
|
||||
} else {
|
||||
pCtx->inputBytes = pQuery->colList[index].bytes;
|
||||
pCtx->inputType = pQuery->colList[index].type;
|
||||
|
@ -2503,8 +2508,19 @@ static void doSetTagValueInParam(void *tsdb, STableId id, int32_t tagColId, tVar
|
|||
int16_t bytes = 0;
|
||||
int16_t type = 0;
|
||||
|
||||
tsdbGetTableTagVal(tsdb, id, tagColId, &type, &bytes, &val);
|
||||
if (tagColId == TSDB_TBNAME_COLUMN_INDEX) {
|
||||
tsdbTableGetName(tsdb, id, &val);
|
||||
bytes = TSDB_TABLE_NAME_LEN;
|
||||
type = TSDB_DATA_TYPE_BINARY;
|
||||
} else {
|
||||
tsdbGetTableTagVal(tsdb, id, tagColId, &type, &bytes, &val);
|
||||
}
|
||||
|
||||
tVariantCreateFromBinary(param, val, bytes, type);
|
||||
|
||||
if (tagColId == TSDB_TBNAME_COLUMN_INDEX) {
|
||||
tfree(val);
|
||||
}
|
||||
}
|
||||
|
||||
void setTagVal(SQueryRuntimeEnv *pRuntimeEnv, STableId id, void *tsdb) {
|
||||
|
@ -5515,9 +5531,12 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SArithExp
|
|||
return code;
|
||||
}
|
||||
|
||||
type = TSDB_DATA_TYPE_DOUBLE;
|
||||
type = TSDB_DATA_TYPE_DOUBLE;
|
||||
bytes = tDataTypeDesc[type].nSize;
|
||||
} else { // parse the normal column
|
||||
} else if (pExprs[i].pBase.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) { // parse the normal column
|
||||
type = TSDB_DATA_TYPE_BINARY;
|
||||
bytes = TSDB_TABLE_NAME_LEN;
|
||||
} else{
|
||||
int32_t j = getColumnIndexInSource(pQueryMsg, &pExprs[i].pBase, pTagCols);
|
||||
assert(j < pQueryMsg->numOfCols);
|
||||
|
||||
|
|
|
@ -251,6 +251,18 @@ int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId id, int32_t colId, int16_t*
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbTableGetName(TsdbRepoT *repo, STableId id, char** name) {
|
||||
STsdbMeta* pMeta = tsdbGetMeta(repo);
|
||||
STable* pTable = tsdbGetTableByUid(pMeta, id.uid);
|
||||
|
||||
*name = strndup(pTable->name, TSDB_TABLE_NAME_LEN);
|
||||
if (*name == NULL) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) {
|
||||
if (tsdbCheckTableCfg(pCfg) < 0) return -1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue