commit
d6e0176771
|
@ -35,6 +35,8 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
|
|||
MESSAGE(STATUS "build version ${VERSION_INFO}")
|
||||
SET_TARGET_PROPERTIES(taos PROPERTIES VERSION ${VERSION_INFO} SOVERSION 1)
|
||||
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
|
||||
ELSEIF (TD_WINDOWS_64)
|
||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows)
|
||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows/win32)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
PROJECT(TDengine)
|
||||
|
||||
FIND_PATH(HEADER_GTEST_INCLUDE_DIR gtest.h /usr/include/gtest /usr/local/include/gtest)
|
||||
FIND_LIBRARY(LIB_GTEST_STATIC_DIR libgtest.a /usr/lib/ /usr/local/lib)
|
||||
|
||||
IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR)
|
||||
MESSAGE(STATUS "gTest library found, build unit test")
|
||||
|
||||
INCLUDE_DIRECTORIES(${HEADER_GTEST_INCLUDE_DIR})
|
||||
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
|
||||
|
||||
ADD_EXECUTABLE(cliTest ${SOURCE_LIST})
|
||||
TARGET_LINK_LIBRARIES(cliTest taos tutil common gtest pthread)
|
||||
ENDIF()
|
|
@ -20,6 +20,7 @@
|
|||
#include "tconfig.h"
|
||||
#include "tutil.h"
|
||||
|
||||
// TODO refactor to set the tz value through parameter
|
||||
void tsSetTimeZone() {
|
||||
SGlobalCfg *cfg_timezone = taosGetConfigOption("timezone");
|
||||
uPrint("timezone is set to %s by %s", tsTimezone, tsCfgStatusStr[cfg_timezone->cfgStatus]);
|
||||
|
|
|
@ -822,7 +822,7 @@ static char *getDataBlock(SQueryRuntimeEnv *pRuntimeEnv, SArithmeticSupport *sas
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* todo set the last value for pQueryTableInfo as in rowwiseapplyfunctions
|
||||
* @param pRuntimeEnv
|
||||
* @param forwardStep
|
||||
* @param tsCols
|
||||
|
@ -1065,15 +1065,17 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS
|
|||
SQuery *pQuery = pRuntimeEnv->pQuery;
|
||||
STableQueryInfo* item = pQuery->current;
|
||||
|
||||
TSKEY *tsCols = (TSKEY*) ((SColumnInfoData *)taosArrayGet(pDataBlock, 0))->pData;
|
||||
bool groupbyStateValue = isGroupbyNormalCol(pQuery->pGroupbyExpr);
|
||||
SColumnInfoData* pColumnInfoData = (SColumnInfoData *)taosArrayGet(pDataBlock, 0);
|
||||
|
||||
TSKEY *tsCols = (pColumnInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP)? (TSKEY*) pColumnInfoData->pData:NULL;
|
||||
bool groupbyColumnValue = isGroupbyNormalCol(pQuery->pGroupbyExpr);
|
||||
SArithmeticSupport *sasArray = calloc((size_t)pQuery->numOfOutput, sizeof(SArithmeticSupport));
|
||||
|
||||
int16_t type = 0;
|
||||
int16_t bytes = 0;
|
||||
|
||||
char *groupbyColumnData = NULL;
|
||||
if (groupbyStateValue) {
|
||||
if (groupbyColumnValue) {
|
||||
groupbyColumnData = getGroupbyColumnData(pQuery, &type, &bytes, pDataBlock);
|
||||
}
|
||||
|
||||
|
@ -1161,7 +1163,7 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS
|
|||
pWindowResInfo->curIndex = index;
|
||||
} else { // other queries
|
||||
// decide which group this rows belongs to according to current state value
|
||||
if (groupbyStateValue) {
|
||||
if (groupbyColumnValue) {
|
||||
char *val = groupbyColumnData + bytes * offset;
|
||||
|
||||
int32_t ret = setGroupResultOutputBuf(pRuntimeEnv, val, type, bytes);
|
||||
|
@ -1187,7 +1189,12 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS
|
|||
}
|
||||
}
|
||||
|
||||
assert(offset >= 0);
|
||||
if (tsCols != NULL) {
|
||||
item->lastKey = tsCols[offset] + step;
|
||||
} else {
|
||||
item->lastKey = (QUERY_IS_ASC_QUERY(pQuery)? pDataBlockInfo->window.ekey:pDataBlockInfo->window.skey) + step;
|
||||
}
|
||||
|
||||
// todo refactor: extract method
|
||||
for(int32_t i = 0; i < pQuery->numOfOutput; ++i) {
|
||||
|
|
|
@ -553,10 +553,18 @@ int tsdbUnlockRepoMeta(STsdbRepo *pRepo) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void tsdbRefTable(STable *pTable) { T_REF_INC(pTable); }
|
||||
void tsdbRefTable(STable *pTable) {
|
||||
int16_t ref = T_REF_INC(pTable);
|
||||
tsdbTrace("ref table:%s, uid:%"PRIu64", tid:%d, ref:%d", TABLE_CHAR_NAME(pTable), pTable->tableId.uid, pTable->tableId.tid, ref);
|
||||
}
|
||||
|
||||
void tsdbUnRefTable(STable *pTable) {
|
||||
if (T_REF_DEC(pTable) == 0) {
|
||||
int16_t ref = T_REF_DEC(pTable);
|
||||
tsdbTrace("unref table:%s, uid:%"PRIu64", tid:%d, ref:%d", TABLE_CHAR_NAME(pTable), pTable->tableId.uid, pTable->tableId.tid, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
tsdbTrace("destroy table:%s uid:%"PRIu64", tid:%d", TABLE_CHAR_NAME(pTable), pTable->tableId.uid, pTable->tableId.tid);
|
||||
|
||||
if (TABLE_TYPE(pTable) == TSDB_CHILD_TABLE) {
|
||||
tsdbUnRefTable(pTable->pSuper);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ static FORCE_INLINE int32_t getSkipListNodeRandomHeight(SSkipList *pSkipList) {
|
|||
const uint32_t factor = 4;
|
||||
|
||||
int32_t n = 1;
|
||||
while ((taosRand() % factor) == 0 && n <= pSkipList->maxLevel) {
|
||||
while ((rand() % factor) == 0 && n <= pSkipList->maxLevel) {
|
||||
n++;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,11 +56,9 @@ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0,
|
|||
year -= 1;
|
||||
}
|
||||
|
||||
//int64_t res = (((((int64_t) (year/4 - year/100 + year/400 + 367*mon/12 + day) +
|
||||
// year*365 - 719499)*24 + hour)*60 + min)*60 + sec);
|
||||
int64_t res;
|
||||
res = 367*((int64_t)mon)/12;
|
||||
res += year/4 - year/100 + year/400 + day + year*365 - 719499;
|
||||
int64_t res = 367*((int64_t)mon)/12;
|
||||
|
||||
res += ((int64_t)(year/4 - year/100 + year/400 + day + year*365) - 719499); // this value may be less than 0
|
||||
res = res*24;
|
||||
res = ((res + hour) * 60 + min) * 60 + sec;
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ print $rows
|
|||
|
||||
sql select ts from group_mt0 where ts>='1970-1-1 8:1:43' and ts<='1970-1-1 8:1:43.500' limit 8000 offset 0;
|
||||
if $rows != 4008 then
|
||||
print expect 4008, actual:$rows
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
Loading…
Reference in New Issue