diff --git a/.gitmodules b/.gitmodules index 346f5c00699e51eac39dbfaffdbf96656052b024..a2266c46afd180b52d3aa19003380078894f6a4b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "deps/jemalloc"] path = deps/jemalloc url = https://github.com/jemalloc/jemalloc +[submodule "deps/TSZ"] + path = deps/TSZ + url = https://github.com/taosdata/TSZ.git diff --git a/cmake/input.inc b/cmake/input.inc index 06a23ecb148d3eb77828b8ba6d02fa975ff94a6c..9d716e1e7345955f7b6b844c85ace7e7bd5c6080 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -91,3 +91,12 @@ SET(TD_MEMORY_SANITIZER FALSE) IF (${MEMORY_SANITIZER} MATCHES "true") SET(TD_MEMORY_SANITIZER TRUE) ENDIF () + +IF (${TSZ_ENABLED} MATCHES "true") + # define add + MESSAGE(STATUS "build with TSZ enabled") + ADD_DEFINITIONS(-DTD_TSZ) + set(VAR_TSZ "TSZ" CACHE INTERNAL "global variant tsz" ) +ELSE() + set(VAR_TSZ "" CACHE INTERNAL "global variant empty" ) +ENDIF() diff --git a/cmake/version.inc b/cmake/version.inc index 7c646c67b65b6f52542cc155938f5396c589ae7a..f576627908721da5a2e3e69a02e7ba405d47e3a7 100755 --- a/cmake/version.inc +++ b/cmake/version.inc @@ -4,7 +4,7 @@ PROJECT(TDengine) IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "2.1.4.1") + SET(TD_VER_NUMBER "2.1.5.0") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index eb22459d342da5f726d8688a74b4a5efde2ac5ec..516c752bd101f26f04c3986ed50edd55121c5a40 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -15,7 +15,6 @@ ADD_SUBDIRECTORY(cJson) ADD_SUBDIRECTORY(wepoll) ADD_SUBDIRECTORY(MsvcLibX) ADD_SUBDIRECTORY(rmonotonic) - ADD_SUBDIRECTORY(lua) IF (TD_LINUX AND TD_MQTT) @@ -38,3 +37,7 @@ IF (TD_LINUX_64 AND JEMALLOC_ENABLED) BUILD_COMMAND ${MAKE} ) ENDIF () + +IF (${TSZ_ENABLED} MATCHES "true") + ADD_SUBDIRECTORY(TSZ) +ENDIF() \ No newline at end of file diff --git a/deps/TSZ b/deps/TSZ new file mode 160000 index 0000000000000000000000000000000000000000..0ca5b15a8eac40327dd737be52c926fa5675712c --- /dev/null +++ b/deps/TSZ @@ -0,0 +1 @@ +Subproject commit 0ca5b15a8eac40327dd737be52c926fa5675712c diff --git a/packaging/docker/dockerManifest.sh b/packaging/docker/dockerManifest.sh index 0b30dd702c79038c586af531358fe85e63980a6d..9c5a618f34a8879d0afda9a09229868cbc0e460b 100755 --- a/packaging/docker/dockerManifest.sh +++ b/packaging/docker/dockerManifest.sh @@ -44,6 +44,7 @@ echo "version=${version}" #docker manifest rm tdengine/tdengine #docker manifest rm tdengine/tdengine:${version} if [ "$verType" == "beta" ]; then + docker manifest rm tdengine/tdengine:latest docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version} docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest docker login -u tdengine -p ${passWord} #replace the docker registry username and password @@ -51,11 +52,12 @@ if [ "$verType" == "beta" ]; then docker manifest push tdengine/tdengine-beta:${version} elif [ "$verType" == "stable" ]; then + docker manifest rm tdengine/tdengine:latest docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version} docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest docker login -u tdengine -p ${passWord} #replace the docker registry username and password docker manifest push tdengine/tdengine:latest - docker manifest push tdengine/tdengine:${version} + docker manifest push tdengine/tdengine:${version} else echo "unknow verType, nor stabel or beta" diff --git a/packaging/docker/dockerbuild.sh b/packaging/docker/dockerbuild.sh index 861f00f854bcfa2dad5c1285724a36df72b33922..c0e52f6dce5a95f3a073251fd8f221c648e4e7f9 100755 --- a/packaging/docker/dockerbuild.sh +++ b/packaging/docker/dockerbuild.sh @@ -67,8 +67,10 @@ done if [ "$verType" == "beta" ]; then dockername=${cpuType}-${verType} + dirName=${pkgFile%-beta*} elif [ "$verType" == "stable" ]; then dockername=${cpuType} + dirName=${pkgFile%-Linux*} else echo "unknow verType, nor stabel or beta" exit 1 @@ -84,11 +86,10 @@ comunityArchiveDir=/nas/TDengine/v$version/community # community version’pac cd ${scriptDir} cp -f ${comunityArchiveDir}/${pkgFile} . -dirName=${pkgFile%-Linux*} echo "dirName=${dirName}" -docker build --rm -f "Dockerfile" -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} +docker build --rm -f "Dockerfile" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} docker login -u tdengine -p ${passWord} #replace the docker registry username and password docker push tdengine/tdengine-${dockername}:${version} diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 2b631caa69eba7ae63bccc336cb582e61925d014..7851587c826c1667386d6dc9c91f1eef748927db 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -421,7 +421,7 @@ function install_service() { } function update_TDengine() { - echo -e "${GREEN}Start to update TDEngine...${NC}" + echo -e "${GREEN}Start to update TDengine...${NC}" # Stop the service if running if [ "$osType" != "Darwin" ]; then diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index a7dc931882ad1f3a642b27e8132c0dd9fc09dcfe..97e80088bea0dfedb5967071787b54380f89c170 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -195,15 +195,6 @@ if [ "$pagMode" == "lite" ]; then pkg_name=${pkg_name}-Lite fi -if [ "$verType" == "beta" ]; then - pkg_name=${pkg_name}-${verType} -elif [ "$verType" == "stable" ]; then - pkg_name=${pkg_name} -else - echo "unknow verType, nor stable or beta" - exit 1 -fi - if [ "$osType" != "Darwin" ]; then tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files || : else diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index fe60dca6ed5f7838eb9ba557da2524553b7409e0..aef706311d5b2dda657eec064cfd96c9a91ab30b 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: tdengine base: core18 -version: '2.1.4.1' +version: '2.1.5.0' icon: snap/gui/t-dengine.svg summary: an open-source big data platform designed and optimized for IoT. description: | @@ -72,7 +72,7 @@ parts: - usr/bin/taosd - usr/bin/taos - usr/bin/taosdemo - - usr/lib/libtaos.so.2.1.4.1 + - usr/lib/libtaos.so.2.1.5.0 - usr/lib/libtaos.so.1 - usr/lib/libtaos.so diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index b84525dedbeea6ad42f0c26da979b5987b5a9e60..2f83557d63c288173f8b541caf32fe9fe2e73338 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -11,7 +11,7 @@ IF (TD_LINUX) # set the static lib name ADD_LIBRARY(taos_static STATIC ${SRC}) - TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m rt) + TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m rt ${VAR_TSZ}) SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static") SET_TARGET_PROPERTIES(taos_static PROPERTIES CLEAN_DIRECT_OUTPUT 1) diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 5b5224e92eed6c18409d063222d9a6220ad6dcdf..83ec28898cde23256f1048b1f2eba55b5f22fd33 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -412,6 +412,7 @@ int32_t tscSQLSyntaxErrMsg(char* msg, const char* additionalInfo, const char* s int32_t tscValidateSqlInfo(SSqlObj *pSql, struct SSqlInfo *pInfo); +int32_t tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_t numOfRows); extern int32_t sentinel; extern SHashObj *tscVgroupMap; extern SHashObj *tscTableMetaInfo; diff --git a/src/client/src/TSDBJNIConnector.c b/src/client/src/TSDBJNIConnector.c index 379cf86301f6d52f202cb0fc4916db33d8d5896c..c9b00800e6f3fe950895279d17ca5b7fbb587be5 100644 --- a/src/client/src/TSDBJNIConnector.c +++ b/src/client/src/TSDBJNIConnector.c @@ -946,3 +946,34 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setTableNameTagsI return JNI_SUCCESS; } + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(JNIEnv *env, jobject jobj, + jobjectArray lines, jlong conn) { + TAOS *taos = (TAOS *)conn; + if (taos == NULL) { + jniError("jobj:%p, connection already closed", jobj); + return JNI_CONNECTION_NULL; + } + + int numLines = (*env)->GetArrayLength(env, lines); + char** c_lines = calloc(numLines, sizeof(char*)); + + for (int i = 0; i < numLines; ++i) { + jstring line = (jstring) ((*env)->GetObjectArrayElement(env, lines, i)); + c_lines[i] = (char*)(*env)->GetStringUTFChars(env, line, 0); + } + + int code = taos_insert_lines(taos, c_lines, numLines); + + for (int i = 0; i < numLines; ++i) { + jstring line = (jstring) ((*env)->GetObjectArrayElement(env, lines, i)); + (*env)->ReleaseStringUTFChars(env, line, c_lines[i]); + } + + if (code != TSDB_CODE_SUCCESS) { + jniError("jobj:%p, conn:%p, code:%s", jobj, taos, tstrerror(code)); + return JNI_TDENGINE_ERROR; + } + + return code; +} \ No newline at end of file diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index d26cbebc34e53287e1184f95c52a8ba35d88b70c..98a22835e59324ec35e9f50b70ecf4dda31782bf 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1904,7 +1904,6 @@ int tsInsertInitialCheck(SSqlObj *pSql) { int tsParseSql(SSqlObj *pSql, bool initial) { int32_t ret = TSDB_CODE_SUCCESS; SSqlCmd* pCmd = &pSql->cmd; - if (!initial) { tscDebug("0x%"PRIx64" resume to parse sql: %s", pSql->self, pCmd->insertParam.sql); } diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index 37264e8eaa6b22444af893f12205d85dec8ad795..cccc81274df0aec89cd97d52f12c51ff2af75cfe 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -17,6 +17,7 @@ #include "tscLog.h" #include "taos.h" + typedef struct { char sTableName[TSDB_TABLE_NAME_LEN]; SHashObj* tagHash; @@ -33,7 +34,7 @@ typedef struct { char* value; //=================================== - SSchema* schema; + size_t fieldSchemaIdx; } TAOS_SML_KV; typedef struct { @@ -48,9 +49,17 @@ typedef struct { int fieldNum; //================================ - SSmlSTableSchema* schema; + size_t schemaIdx; } TAOS_SML_DATA_POINT; +typedef enum { + SML_TIME_STAMP_NOW, + SML_TIME_STAMP_SECONDS, + SML_TIME_STAMP_MILLI_SECONDS, + SML_TIME_STAMP_MICRO_SECONDS, + SML_TIME_STAMP_NANO_SECONDS +} SMLTimeStampType; + //================================================================================================= int compareSmlColKv(const void* p1, const void* p2) { @@ -117,10 +126,12 @@ static int32_t getFieldBytesFromSmlKv(TAOS_SML_KV* kv, int32_t* bytes) { static int32_t buildSmlKvSchema(TAOS_SML_KV* smlKv, SHashObj* hash, SArray* array) { SSchema* pField = NULL; - SSchema** ppField = taosHashGet(hash, smlKv->key, strlen(smlKv->key)); + size_t* pFieldIdx = taosHashGet(hash, smlKv->key, strlen(smlKv->key)); + size_t fieldIdx = -1; int32_t code = 0; - if (ppField) { - pField = *ppField; + if (pFieldIdx) { + fieldIdx = *pFieldIdx; + pField = taosArrayGet(array, fieldIdx); if (pField->type != smlKv->type) { tscError("type mismatch. key %s, type %d. type before %d", smlKv->key, smlKv->type, pField->type); @@ -149,10 +160,11 @@ static int32_t buildSmlKvSchema(TAOS_SML_KV* smlKv, SHashObj* hash, SArray* arra field.bytes = bytes; pField = taosArrayPush(array, &field); - taosHashPut(hash, field.name, tagKeyLen, &pField, POINTER_BYTES); + fieldIdx = taosArrayGetSize(array) - 1; + taosHashPut(hash, field.name, tagKeyLen, &fieldIdx, sizeof(fieldIdx)); } - smlKv->schema = pField; + smlKv->fieldSchemaIdx = fieldIdx; return 0; } @@ -165,10 +177,12 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint, for (int i = 0; i < numPoint; ++i) { TAOS_SML_DATA_POINT* point = &points[i]; size_t stableNameLen = strlen(point->stableName); - SSmlSTableSchema** ppStableSchema = taosHashGet(sname2shema, point->stableName, stableNameLen); + size_t* pStableIdx = taosHashGet(sname2shema, point->stableName, stableNameLen); SSmlSTableSchema* pStableSchema = NULL; - if (ppStableSchema) { - pStableSchema= *ppStableSchema; + size_t stableIdx = -1; + if (pStableIdx) { + pStableSchema= taosArrayGet(stableSchemas, *pStableIdx); + stableIdx = *pStableIdx; } else { SSmlSTableSchema schema; strncpy(schema.sTableName, point->stableName, stableNameLen); @@ -179,7 +193,8 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint, schema.fieldHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); pStableSchema = taosArrayPush(stableSchemas, &schema); - taosHashPut(sname2shema, schema.sTableName, stableNameLen, &pStableSchema, POINTER_BYTES); + stableIdx = taosArrayGetSize(stableSchemas) - 1; + taosHashPut(sname2shema, schema.sTableName, stableNameLen, &stableIdx, sizeof(size_t)); } for (int j = 0; j < point->tagNum; ++j) { @@ -200,7 +215,7 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint, } } - point->schema = pStableSchema; + point->schemaIdx = stableIdx; } size_t numStables = taosArrayGetSize(stableSchemas); @@ -221,11 +236,12 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint, return 0; } -static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash, bool isTag, char sTableName[], +static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash, SArray* dbAttrArray, bool isTag, char sTableName[], SSchemaAction* action, bool* actionNeeded) { - SSchema** ppDbAttr = taosHashGet(dbAttrHash, pointColField->name, strlen(pointColField->name)); - if (ppDbAttr) { - SSchema* dbAttr = *ppDbAttr; + size_t* pDbIndex = taosHashGet(dbAttrHash, pointColField->name, strlen(pointColField->name)); + if (pDbIndex) { + SSchema* dbAttr = taosArrayGet(dbAttrArray, *pDbIndex); + assert(strcasecmp(dbAttr->name, pointColField->name) == 0); if (pointColField->type != dbAttr->type) { tscError("point type and db type mismatch. key: %s. point type: %d, db type: %d", pointColField->name, pointColField->type, dbAttr->type); @@ -282,9 +298,9 @@ static int32_t buildColumnDescription(SSchema* field, static int32_t applySchemaAction(TAOS* taos, SSchemaAction* action) { int32_t code = 0; - int32_t capacity = TSDB_MAX_BINARY_LEN; int32_t outBytes = 0; - char *result = (char *)calloc(1, capacity); + char *result = (char *)calloc(1, tsMaxSQLStringLen+1); + int32_t capacity = tsMaxSQLStringLen + 1; tscDebug("apply schema action: %d", action->action); switch (action->action) { @@ -437,8 +453,9 @@ int32_t loadTableMeta(TAOS* taos, char* tableName, SSmlSTableSchema* schema) { tstrncpy(field.name, tableMeta->schema[i].name, strlen(tableMeta->schema[i].name)+1); field.type = tableMeta->schema[i].type; field.bytes = tableMeta->schema[i].bytes; - SSchema* pField = taosArrayPush(schema->fields, &field); - taosHashPut(schema->fieldHash, field.name, strlen(field.name), &pField, POINTER_BYTES); + taosArrayPush(schema->fields, &field); + size_t fieldIndex = taosArrayGetSize(schema->fields) - 1; + taosHashPut(schema->fieldHash, field.name, strlen(field.name), &fieldIndex, sizeof(fieldIndex)); } for (int i=0; itableInfo.numOfTags; ++i) { @@ -447,8 +464,9 @@ int32_t loadTableMeta(TAOS* taos, char* tableName, SSmlSTableSchema* schema) { tstrncpy(field.name, tableMeta->schema[j].name, strlen(tableMeta->schema[j].name)+1); field.type = tableMeta->schema[j].type; field.bytes = tableMeta->schema[j].bytes; - SSchema* pField = taosArrayPush(schema->tags, &field); - taosHashPut(schema->tagHash, field.name, strlen(field.name), &pField, POINTER_BYTES); + taosArrayPush(schema->tags, &field); + size_t tagIndex = taosArrayGetSize(schema->tags) - 1; + taosHashPut(schema->tagHash, field.name, strlen(field.name), &tagIndex, sizeof(tagIndex)); } tscDebug("load table meta succeed. %s, columns number: %d, tag number: %d, precision: %d", tableName, tableMeta->tableInfo.numOfColumns, tableMeta->tableInfo.numOfTags, schema->precision); @@ -476,6 +494,7 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) { code = loadTableMeta(taos, pointSchema->sTableName, &dbSchema); if (code != 0) { tscError("reconcile point schema failed. can not create %s", pointSchema->sTableName); + return code; } else { pointSchema->precision = dbSchema.precision; destroySmlSTableSchema(&dbSchema); @@ -491,7 +510,7 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) { SSchema* pointTag = taosArrayGet(pointSchema->tags, j); SSchemaAction schemaAction = {0}; bool actionNeeded = false; - generateSchemaAction(pointTag, dbTagHash, true, pointSchema->sTableName, &schemaAction, &actionNeeded); + generateSchemaAction(pointTag, dbTagHash, dbSchema.tags, true, pointSchema->sTableName, &schemaAction, &actionNeeded); if (actionNeeded) { applySchemaAction(taos, &schemaAction); } @@ -505,7 +524,7 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) { SSchema* pointCol = taosArrayGet(pointSchema->fields, j); SSchemaAction schemaAction = {0}; bool actionNeeded = false; - generateSchemaAction(pointCol, dbFieldHash, false, pointSchema->sTableName, &schemaAction, &actionNeeded); + generateSchemaAction(pointCol, dbFieldHash, dbSchema.fields,false, pointSchema->sTableName, &schemaAction, &actionNeeded); if (actionNeeded) { applySchemaAction(taos, &schemaAction); } @@ -522,7 +541,8 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) { return 0; } -static int32_t getChildTableName(TAOS_SML_DATA_POINT* point, char* tableName, int* tableNameLen) { +static int32_t getSmlMd5ChildTableName(TAOS_SML_DATA_POINT* point, char* tableName, int* tableNameLen) { + tscDebug("taos_sml_insert get child table name through md5"); qsort(point->tags, point->tagNum, sizeof(TAOS_SML_KV), compareSmlColKv); SStringBuilder sb; memset(&sb, 0, sizeof(sb)); @@ -552,8 +572,8 @@ static int32_t getChildTableName(TAOS_SML_DATA_POINT* point, char* tableName, in static int32_t creatChildTableIfNotExists(TAOS* taos, const char* cTableName, const char* sTableName, SArray* tagsSchema, SArray* tagsBind) { size_t numTags = taosArrayGetSize(tagsSchema); - char sql[TSDB_MAX_BINARY_LEN] = {0}; - int freeBytes = TSDB_MAX_BINARY_LEN; + char* sql = malloc(tsMaxSQLStringLen+1); + int freeBytes = tsMaxSQLStringLen + 1; sprintf(sql, "create table if not exists %s using %s", cTableName, sTableName); snprintf(sql+strlen(sql), freeBytes-strlen(sql), "("); @@ -569,12 +589,15 @@ static int32_t creatChildTableIfNotExists(TAOS* taos, const char* cTableName, co snprintf(sql+strlen(sql), freeBytes-strlen(sql), "?,"); } snprintf(sql + strlen(sql) - 1, freeBytes-strlen(sql)+1, ")"); + sql[strlen(sql)] = '\0'; tscDebug("create table : %s", sql); TAOS_STMT* stmt = taos_stmt_init(taos); int32_t code; code = taos_stmt_prepare(stmt, sql, (unsigned long)strlen(sql)); + free(sql); + if (code != 0) { tscError("%s", taos_stmt_errstr(stmt)); return code; @@ -592,14 +615,18 @@ static int32_t creatChildTableIfNotExists(TAOS* taos, const char* cTableName, co return code; } - taos_stmt_close(stmt); - return 0; + code = taos_stmt_close(stmt); + if (code != 0) { + tscError("%s", taos_stmt_errstr(stmt)); + return code; + } + return code; } static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* colsSchema, SArray* rowsBind) { size_t numCols = taosArrayGetSize(colsSchema); - char sql[TSDB_MAX_BINARY_LEN]; - int32_t freeBytes = TSDB_MAX_BINARY_LEN; + char* sql = malloc(tsMaxSQLStringLen+1); + int32_t freeBytes = tsMaxSQLStringLen + 1 ; sprintf(sql, "insert into ? ("); for (int i = 0; i < numCols; ++i) { @@ -612,6 +639,7 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols snprintf(sql+strlen(sql), freeBytes-strlen(sql), "?,"); } snprintf(sql + strlen(sql)-1, freeBytes-strlen(sql)+1, ")"); + sql[strlen(sql)] = '\0'; tscDebug("insert rows %zu into child table %s. ", taosArrayGetSize(rowsBind), cTableName); @@ -619,8 +647,10 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols int32_t try = 0; TAOS_STMT* stmt = taos_stmt_init(taos); - + code = taos_stmt_prepare(stmt, sql, (unsigned long)strlen(sql)); + free(sql); + if (code != 0) { tscError("%s", taos_stmt_errstr(stmt)); return code; @@ -665,23 +695,26 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols return code; } -static int32_t arrangePointsByChildTableName(TAOS_SML_DATA_POINT* points, int numPoints, SHashObj* cname2points) { +static int32_t arrangePointsByChildTableName(TAOS_SML_DATA_POINT* points, int numPoints, + SHashObj* cname2points, SArray* stableSchemas) { for (int32_t i = 0; i < numPoints; ++i) { TAOS_SML_DATA_POINT * point = points + i; if (!point->childTableName) { char childTableName[TSDB_TABLE_NAME_LEN]; int32_t tableNameLen = TSDB_TABLE_NAME_LEN; - getChildTableName(point, childTableName, &tableNameLen); + getSmlMd5ChildTableName(point, childTableName, &tableNameLen); point->childTableName = calloc(1, tableNameLen+1); strncpy(point->childTableName, childTableName, tableNameLen); point->childTableName[tableNameLen] = '\0'; } + SSmlSTableSchema* stableSchema = taosArrayGet(stableSchemas, point->schemaIdx); + for (int j = 0; j < point->tagNum; ++j) { TAOS_SML_KV* kv = point->tags + j; if (kv->type == TSDB_DATA_TYPE_TIMESTAMP) { int64_t ts = *(int64_t*)(kv->value); - ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, point->schema->precision); + ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, stableSchema->precision); *(int64_t*)(kv->value) = ts; } } @@ -690,7 +723,7 @@ static int32_t arrangePointsByChildTableName(TAOS_SML_DATA_POINT* points, int nu TAOS_SML_KV* kv = point->fields + j; if (kv->type == TSDB_DATA_TYPE_TIMESTAMP) { int64_t ts = *(int64_t*)(kv->value); - ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, point->schema->precision); + ts = convertTimePrecision(ts, TSDB_TIME_PRECISION_NANO, stableSchema->precision); *(int64_t*)(kv->value) = ts; } } @@ -709,10 +742,12 @@ static int32_t arrangePointsByChildTableName(TAOS_SML_DATA_POINT* points, int nu return 0; } -static int32_t insertPoints(TAOS* taos, TAOS_SML_DATA_POINT* points, int32_t numPoints) { +static int32_t insertPoints(TAOS* taos, TAOS_SML_DATA_POINT* points, int32_t numPoints, SArray* stableSchemas) { + int32_t code = TSDB_CODE_SUCCESS; + SHashObj* cname2points = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); - arrangePointsByChildTableName(points, numPoints, cname2points); + arrangePointsByChildTableName(points, numPoints, cname2points, stableSchemas); int isNullColBind = TSDB_TRUE; SArray** pCTablePoints = taosHashIterate(cname2points, NULL); @@ -720,8 +755,9 @@ static int32_t insertPoints(TAOS* taos, TAOS_SML_DATA_POINT* points, int32_t num SArray* cTablePoints = *pCTablePoints; TAOS_SML_DATA_POINT * point = taosArrayGetP(cTablePoints, 0); - size_t numTags = taosArrayGetSize(point->schema->tags); - size_t numCols = taosArrayGetSize(point->schema->fields); + SSmlSTableSchema* sTableSchema = taosArrayGet(stableSchemas, point->schemaIdx); + size_t numTags = taosArrayGetSize(sTableSchema->tags); + size_t numCols = taosArrayGetSize(sTableSchema->fields); SArray* tagBinds = taosArrayInit(numTags, sizeof(TAOS_BIND)); taosArraySetSize(tagBinds, numTags); @@ -731,8 +767,7 @@ static int32_t insertPoints(TAOS* taos, TAOS_SML_DATA_POINT* points, int32_t num } for (int j = 0; j < point->tagNum; ++j) { TAOS_SML_KV* kv = point->tags + j; - size_t idx = TARRAY_ELEM_IDX(point->schema->tags, kv->schema); - TAOS_BIND* bind = taosArrayGet(tagBinds, idx); + TAOS_BIND* bind = taosArrayGet(tagBinds, kv->fieldSchemaIdx); bind->buffer_type = kv->type; bind->length = malloc(sizeof(uintptr_t*)); *bind->length = kv->length; @@ -747,14 +782,17 @@ static int32_t insertPoints(TAOS* taos, TAOS_SML_DATA_POINT* points, int32_t num point = taosArrayGetP(cTablePoints, i); TAOS_BIND* colBinds = calloc(numCols, sizeof(TAOS_BIND)); + if (colBinds == NULL) { + tscError("taos_sml_insert insert points, failed to allocated memory for TAOS_BIND, " + "num of rows: %zu, num of cols: %zu", rows, numCols); + } for (int j = 0; j < numCols; ++j) { TAOS_BIND* bind = colBinds + j; bind->is_null = &isNullColBind; } for (int j = 0; j < point->fieldNum; ++j) { TAOS_SML_KV* kv = point->fields + j; - size_t idx = TARRAY_ELEM_IDX(point->schema->fields, kv->schema); - TAOS_BIND* bind = colBinds + idx; + TAOS_BIND* bind = colBinds + kv->fieldSchemaIdx; bind->buffer_type = kv->type; bind->length = malloc(sizeof(uintptr_t*)); *bind->length = kv->length; @@ -764,14 +802,21 @@ static int32_t insertPoints(TAOS* taos, TAOS_SML_DATA_POINT* points, int32_t num taosArrayPush(rowsBind, &colBinds); } - creatChildTableIfNotExists(taos, point->childTableName, point->stableName, point->schema->tags, tagBinds); + code = creatChildTableIfNotExists(taos, point->childTableName, point->stableName, sTableSchema->tags, tagBinds); + if (code == 0) { + code = insertChildTableBatch(taos, point->childTableName, sTableSchema->fields, rowsBind); + if (code != 0) { + tscError("insert into child table %s failed. error %s", point->childTableName, tstrerror(code)); + } + } else { + tscError("Create Child Table %s failed, error %s", point->childTableName, tstrerror(code)); + } + for (int i = 0; i < taosArrayGetSize(tagBinds); ++i) { TAOS_BIND* bind = taosArrayGet(tagBinds, i); free(bind->length); } taosArrayDestroy(tagBinds); - - insertChildTableBatch(taos, point->childTableName, point->schema->fields, rowsBind); for (int i = 0; i < rows; ++i) { TAOS_BIND* colBinds = taosArrayGetP(rowsBind, i); for (int j = 0; j < numCols; ++j) { @@ -782,12 +827,14 @@ static int32_t insertPoints(TAOS* taos, TAOS_SML_DATA_POINT* points, int32_t num } taosArrayDestroy(rowsBind); taosArrayDestroy(cTablePoints); - + if (code != 0) { + break; + } pCTablePoints = taosHashIterate(cname2points, pCTablePoints); } taosHashCleanup(cname2points); - return 0; + return code; } int taos_sml_insert(TAOS* taos, TAOS_SML_DATA_POINT* points, int numPoint) { @@ -808,7 +855,7 @@ int taos_sml_insert(TAOS* taos, TAOS_SML_DATA_POINT* points, int numPoint) { goto clean_up; } - code = insertPoints(taos, points, numPoint); + code = insertPoints(taos, points, numPoint, stableSchemas); if (code != 0) { tscError("error insert points : %s", tstrerror(code)); } @@ -825,305 +872,886 @@ clean_up: //========================================================================= -typedef enum { - LP_ITEM_TAG, - LP_ITEM_FIELD -} LPItemKind; +/* Field Escape charaters + 1: measurement Comma,Space + 2: tag_key, tag_value, field_key Comma,Equal Sign,Space + 3: field_value Double quote,Backslash +*/ +static void escapeSpecialCharacter(uint8_t field, const char **pos) { + const char *cur = *pos; + if (*cur != '\\') { + return; + } + switch (field) { + case 1: + switch (*(cur + 1)) { + case ',': + case ' ': + cur++; + break; + default: + break; + } + break; + case 2: + switch (*(cur + 1)) { + case ',': + case ' ': + case '=': + cur++; + break; + default: + break; + } + break; + case 3: + switch (*(cur + 1)) { + case '"': + case '\\': + cur++; + break; + default: + break; + } + break; + default: + break; + } + *pos = cur; +} -typedef struct { - SStrToken keyToken; - SStrToken valueToken; +static bool isValidInteger(char *str) { + char *c = str; + if (*c != '+' && *c != '-' && !isdigit(*c)) { + return false; + } + c++; + while (*c != '\0') { + if (!isdigit(*c)) { + return false; + } + c++; + } + return true; +} - char key[TSDB_COL_NAME_LEN]; - int8_t type; - int16_t length; +static bool isValidFloat(char *str) { + char *c = str; + uint8_t has_dot, has_exp, has_sign; + has_dot = 0; + has_exp = 0; + has_sign = 0; - char* value; -}SLPItem; + if (*c != '+' && *c != '-' && *c != '.' && !isdigit(*c)) { + return false; + } + if (*c == '.' && isdigit(*(c + 1))) { + has_dot = 1; + } + c++; + while (*c != '\0') { + if (!isdigit(*c)) { + switch (*c) { + case '.': { + if (!has_dot && !has_exp && isdigit(*(c + 1))) { + has_dot = 1; + } else { + return false; + } + break; + } + case 'e': + case 'E': { + if (!has_exp && isdigit(*(c - 1)) && + (isdigit(*(c + 1)) || + *(c + 1) == '+' || + *(c + 1) == '-')) { + has_exp = 1; + } else { + return false; + } + break; + } + case '+': + case '-': { + if (!has_sign && has_exp && isdigit(*(c + 1))) { + has_sign = 1; + } else { + return false; + } + break; + } + default: { + return false; + } + } + } + c++; + } //while + return true; +} -typedef struct { - SStrToken measToken; - SStrToken tsToken; +static bool isTinyInt(char *pVal, uint16_t len) { + if (len <= 2) { + return false; + } + if (!strcmp(&pVal[len - 2], "i8")) { + //printf("Type is int8(%s)\n", pVal); + return true; + } + return false; +} - char sTableName[TSDB_TABLE_NAME_LEN]; - SArray* tags; - SArray* fields; - int64_t ts; +static bool isTinyUint(char *pVal, uint16_t len) { + if (len <= 2) { + return false; + } + if (pVal[0] == '-') { + return false; + } + if (!strcmp(&pVal[len - 2], "u8")) { + //printf("Type is uint8(%s)\n", pVal); + return true; + } + return false; +} -} SLPPoint; +static bool isSmallInt(char *pVal, uint16_t len) { + if (len <= 3) { + return false; + } + if (!strcmp(&pVal[len - 3], "i16")) { + //printf("Type is int16(%s)\n", pVal); + return true; + } + return false; +} -typedef enum { - LP_MEASUREMENT, - LP_TAG_KEY, - LP_TAG_VALUE, - LP_FIELD_KEY, - LP_FIELD_VALUE -} LPPart; +static bool isSmallUint(char *pVal, uint16_t len) { + if (len <= 3) { + return false; + } + if (pVal[0] == '-') { + return false; + } + if (strcmp(&pVal[len - 3], "u16") == 0) { + //printf("Type is uint16(%s)\n", pVal); + return true; + } + return false; +} -int32_t scanToCommaOrSpace(SStrToken s, int32_t start, int32_t* index, LPPart part) { - for (int32_t i = start; i < s.n; ++i) { - if (s.z[i] == ',' || s.z[i] == ' ') { - *index = i; - return 0; - } +static bool isInt(char *pVal, uint16_t len) { + if (len <= 3) { + return false; } - return -1; + if (strcmp(&pVal[len - 3], "i32") == 0) { + //printf("Type is int32(%s)\n", pVal); + return true; + } + return false; } -int32_t scanToEqual(SStrToken s, int32_t start, int32_t* index) { - for (int32_t i = start; i < s.n; ++i) { - if (s.z[i] == '=') { - *index = i; - return 0; - } +static bool isUint(char *pVal, uint16_t len) { + if (len <= 3) { + return false; } - return -1; + if (pVal[0] == '-') { + return false; + } + if (strcmp(&pVal[len - 3], "u32") == 0) { + //printf("Type is uint32(%s)\n", pVal); + return true; + } + return false; } -int32_t setPointMeasurement(SLPPoint* point, SStrToken token) { - point->measToken = token; - if (point->measToken.n < TSDB_TABLE_NAME_LEN) { - strncpy(point->sTableName, point->measToken.z, point->measToken.n); - point->sTableName[point->measToken.n] = '\0'; +static bool isBigInt(char *pVal, uint16_t len) { + if (len <= 3) { + return false; } - return 0; + if (strcmp(&pVal[len - 3], "i64") == 0) { + //printf("Type is int64(%s)\n", pVal); + return true; + } + return false; } -int32_t setItemKey(SLPItem* item, SStrToken key, LPPart part) { - item->keyToken = key; - if (item->keyToken.n < TSDB_COL_NAME_LEN) { - strncpy(item->key, item->keyToken.z, item->keyToken.n); - item->key[item->keyToken.n] = '\0'; +static bool isBigUint(char *pVal, uint16_t len) { + if (len <= 3) { + return false; } - return 0; + if (pVal[0] == '-') { + return false; + } + if (strcmp(&pVal[len - 3], "u64") == 0) { + //printf("Type is uint64(%s)\n", pVal); + return true; + } + return false; } -int32_t setItemValue(SLPItem* item, SStrToken value, LPPart part) { - item->valueToken = value; - return 0; +static bool isFloat(char *pVal, uint16_t len) { + if (len <= 3) { + return false; + } + if (strcmp(&pVal[len - 3], "f32") == 0) { + //printf("Type is float(%s)\n", pVal); + return true; + } + return false; } -int32_t parseItemValue(SLPItem* item, LPItemKind kind) { - char* sv = item->valueToken.z; - char* last = item->valueToken.z + item->valueToken.n - 1; - - if (isdigit(sv[0]) || sv[0] == '-') { - if (*last == 'i') { - item->type = TSDB_DATA_TYPE_BIGINT; - item->length = (int16_t)tDataTypes[item->type].bytes; - item->value = malloc(item->length); - char* endptr = NULL; - *(int64_t*)(item->value) = strtoll(sv, &endptr, 10); - } else if (*last == 'u') { - item->type = TSDB_DATA_TYPE_UBIGINT; - item->length = (int16_t)tDataTypes[item->type].bytes; - item->value = malloc(item->length); - char* endptr = NULL; - *(uint64_t*)(item->value) = (uint64_t)strtoull(sv, &endptr, 10); - } else if (*last == 'b') { - item->type = TSDB_DATA_TYPE_TINYINT; - item->length = (int16_t)tDataTypes[item->type].bytes; - item->value = malloc(item->length); - char* endptr = NULL; - *(int8_t*)(item->value) = (int8_t)strtoll(sv, &endptr, 10); - } else if (*last == 's') { - item->type = TSDB_DATA_TYPE_SMALLINT; - item->length = (int16_t)tDataTypes[item->type].bytes; - item->value = malloc(item->length); - char* endptr = NULL; - *(int16_t*)(item->value) = (int16_t)strtoll(sv, &endptr, 10); - } else if (*last == 'w') { - item->type = TSDB_DATA_TYPE_INT; - item->length = (int16_t)tDataTypes[item->type].bytes; - item->value = malloc(item->length); - char* endptr = NULL; - *(int32_t*)(item->value) = (int32_t)strtoll(sv, &endptr, 10); - } else if (*last == 'f') { - item->type = TSDB_DATA_TYPE_FLOAT; - item->length = (int16_t)tDataTypes[item->type].bytes; - item->value = malloc(item->length); - char* endptr = NULL; - *(float*)(item->value) = (float)strtold(sv, &endptr); - } else { - item->type = TSDB_DATA_TYPE_DOUBLE; - item->length = (int16_t)tDataTypes[item->type].bytes; - item->value = malloc(item->length); - char* endptr = NULL; - *(double*)(item->value) = strtold(sv, &endptr); - } - } else if ((sv[0] == 'L' && sv[1] =='"') || sv[0] == '"' ) { - if (sv[0] == 'L') { - item->type = TSDB_DATA_TYPE_NCHAR; - uint32_t bytes = item->valueToken.n - 3; - item->length = bytes; - item->value = malloc(bytes); - memcpy(item->value, sv+2, bytes); - } else if (sv[0]=='"'){ - item->type = TSDB_DATA_TYPE_BINARY; - uint32_t bytes = item->valueToken.n - 2; - item->length = bytes; - item->value = malloc(bytes); - memcpy(item->value, sv+1, bytes); - } - } else if (sv[0] == 't' || sv[0] == 'f' || sv[0]=='T' || sv[0] == 'F') { - item->type = TSDB_DATA_TYPE_BOOL; - item->length = tDataTypes[item->type].bytes; - item->value = malloc(tDataTypes[item->type].bytes); - *(uint8_t*)(item->value) = tolower(sv[0])=='t' ? TSDB_TRUE : TSDB_FALSE; +static bool isDouble(char *pVal, uint16_t len) { + if (len <= 3) { + return false; } - return 0; + if (strcmp(&pVal[len - 3], "f64") == 0) { + //printf("Type is double(%s)\n", pVal); + return true; + } + return false; } -int32_t compareLPItemKey(const void* p1, const void* p2) { - const SLPItem* t1 = p1; - const SLPItem* t2 = p2; - uint32_t min = (t1->keyToken.n < t2->keyToken.n) ? t1->keyToken.n : t2->keyToken.n; - int res = strncmp(t1->keyToken.z, t2->keyToken.z, min); - if (res != 0) { - return res; - } else { - return (int)(t1->keyToken.n) - (int)(t2->keyToken.n); +static bool isBool(char *pVal, uint16_t len, bool *bVal) { + if ((len == 1) && + (pVal[len - 1] == 't' || + pVal[len - 1] == 'T')) { + //printf("Type is bool(%c)\n", pVal[len - 1]); + *bVal = true; + return true; + } + + if ((len == 1) && + (pVal[len - 1] == 'f' || + pVal[len - 1] == 'F')) { + //printf("Type is bool(%c)\n", pVal[len - 1]); + *bVal = false; + return true; + } + + if((len == 4) && + (!strcmp(&pVal[len - 4], "true") || + !strcmp(&pVal[len - 4], "True") || + !strcmp(&pVal[len - 4], "TRUE"))) { + //printf("Type is bool(%s)\n", &pVal[len - 4]); + *bVal = true; + return true; } + if((len == 5) && + (!strcmp(&pVal[len - 5], "false") || + !strcmp(&pVal[len - 5], "False") || + !strcmp(&pVal[len - 5], "FALSE"))) { + //printf("Type is bool(%s)\n", &pVal[len - 5]); + *bVal = false; + return true; + } + return false; } -int32_t setPointTimeStamp(SLPPoint* point, SStrToken tsToken) { - point->tsToken = tsToken; - return 0; +static bool isBinary(char *pVal, uint16_t len) { + //binary: "abc" + if (len < 2) { + return false; + } + //binary + if (pVal[0] == '"' && pVal[len - 1] == '"') { + //printf("Type is binary(%s)\n", pVal); + return true; + } + return false; +} + +static bool isNchar(char *pVal, uint16_t len) { + //nchar: L"abc" + if (len < 3) { + return false; + } + if (pVal[0] == 'L' && pVal[1] == '"' && pVal[len - 1] == '"') { + //printf("Type is nchar(%s)\n", pVal); + return true; + } + return false; +} + +static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType) { + if (len == 0) { + return true; + } + if ((len == 1) && pVal[0] == '0') { + *tsType = SML_TIME_STAMP_NOW; + //printf("Type is timestamp(%s)\n", pVal); + return true; + } + if (len < 2) { + return false; + } + //No appendix use usec as default + if (isdigit(pVal[len - 1]) && isdigit(pVal[len - 2])) { + *tsType = SML_TIME_STAMP_MICRO_SECONDS; + //printf("Type is timestamp(%s)\n", pVal); + return true; + } + if (pVal[len - 1] == 's') { + switch (pVal[len - 2]) { + case 'm': + *tsType = SML_TIME_STAMP_MILLI_SECONDS; + break; + case 'u': + *tsType = SML_TIME_STAMP_MICRO_SECONDS; + break; + case 'n': + *tsType = SML_TIME_STAMP_NANO_SECONDS; + break; + default: + if (isdigit(pVal[len - 2])) { + *tsType = SML_TIME_STAMP_SECONDS; + break; + } else { + return false; + } + } + //printf("Type is timestamp(%s)\n", pVal); + return true; + } + return false; +} + +//len does not include '\0' from value. +static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, + uint16_t len) { + if (len <= 0) { + return false; + } + + //integer number + if (isTinyInt(value, len)) { + pVal->type = TSDB_DATA_TYPE_TINYINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 2] = '\0'; + if (!isValidInteger(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + int8_t val = (int8_t)strtoll(value, NULL, 10); + memcpy(pVal->value, &val, pVal->length); + return true; + } + if (isTinyUint(value, len)) { + pVal->type = TSDB_DATA_TYPE_UTINYINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 2] = '\0'; + if (!isValidInteger(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + uint8_t val = (uint8_t)strtoul(value, NULL, 10); + memcpy(pVal->value, &val, pVal->length); + return true; + } + if (isSmallInt(value, len)) { + pVal->type = TSDB_DATA_TYPE_SMALLINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 3] = '\0'; + if (!isValidInteger(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + int16_t val = (int16_t)strtoll(value, NULL, 10); + memcpy(pVal->value, &val, pVal->length); + return true; + } + if (isSmallUint(value, len)) { + pVal->type = TSDB_DATA_TYPE_USMALLINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 3] = '\0'; + if (!isValidInteger(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + uint16_t val = (uint16_t)strtoul(value, NULL, 10); + memcpy(pVal->value, &val, pVal->length); + //memcpy(pVal->value, &val, pVal->length); + return true; + } + if (isInt(value, len)) { + pVal->type = TSDB_DATA_TYPE_INT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 3] = '\0'; + if (!isValidInteger(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + int32_t val = (int32_t)strtoll(value, NULL, 10); + memcpy(pVal->value, &val, pVal->length); + return true; + } + if (isUint(value, len)) { + pVal->type = TSDB_DATA_TYPE_UINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 3] = '\0'; + if (!isValidInteger(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + uint32_t val = (uint32_t)strtoul(value, NULL, 10); + memcpy(pVal->value, &val, pVal->length); + return true; + } + if (isBigInt(value, len)) { + pVal->type = TSDB_DATA_TYPE_BIGINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 3] = '\0'; + if (!isValidInteger(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + int64_t val = (int64_t)strtoll(value, NULL, 10); + memcpy(pVal->value, &val, pVal->length); + return true; + } + if (isBigUint(value, len)) { + pVal->type = TSDB_DATA_TYPE_UBIGINT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 3] = '\0'; + if (!isValidInteger(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + uint64_t val = (uint64_t)strtoul(value, NULL, 10); + memcpy(pVal->value, &val, pVal->length); + return true; + } + //floating number + if (isFloat(value, len)) { + pVal->type = TSDB_DATA_TYPE_FLOAT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 3] = '\0'; + if (!isValidFloat(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + float val = (float)strtold(value, NULL); + memcpy(pVal->value, &val, pVal->length); + return true; + } + if (isDouble(value, len)) { + pVal->type = TSDB_DATA_TYPE_DOUBLE; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + value[len - 3] = '\0'; + if (!isValidFloat(value)) { + return false; + } + pVal->value = calloc(pVal->length, 1); + double val = (double)strtold(value, NULL); + memcpy(pVal->value, &val, pVal->length); + return true; + } + //binary + if (isBinary(value, len)) { + pVal->type = TSDB_DATA_TYPE_BINARY; + pVal->length = len - 2; + pVal->value = calloc(pVal->length, 1); + //copy after " + memcpy(pVal->value, value + 1, pVal->length); + return true; + } + //nchar + if (isNchar(value, len)) { + pVal->type = TSDB_DATA_TYPE_NCHAR; + pVal->length = len - 3; + pVal->value = calloc(pVal->length, 1); + //copy after L" + memcpy(pVal->value, value + 2, pVal->length); + return true; + } + //bool + bool bVal; + if (isBool(value, len, &bVal)) { + pVal->type = TSDB_DATA_TYPE_BOOL; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = calloc(pVal->length, 1); + memcpy(pVal->value, &bVal, pVal->length); + return true; + } + //Handle default(no appendix) as float + if (isValidInteger(value) || isValidFloat(value)) { + pVal->type = TSDB_DATA_TYPE_FLOAT; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = calloc(pVal->length, 1); + float val = (float)strtold(value, NULL); + memcpy(pVal->value, &val, pVal->length); + return true; + } + return false; } -int32_t parsePointTime(SLPPoint* point) { - if (point->tsToken.n <= 0) { - point->ts = taosGetTimestampNs(); +static int32_t getTimeStampValue(char *value, uint16_t len, + SMLTimeStampType type, int64_t *ts) { + + if (len >= 2) { + for (int i = 0; i < len - 2; ++i) { + if(!isdigit(value[i])) { + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; + } + } + } + //No appendix or no timestamp given (len = 0) + if (len >= 1 && isdigit(value[len - 1]) && type != SML_TIME_STAMP_NOW) { + type = SML_TIME_STAMP_MICRO_SECONDS; + } + if (len != 0) { + *ts = (int64_t)strtoll(value, NULL, 10); } else { - char* endptr = NULL; - point->ts = strtoll(point->tsToken.z, &endptr, 10); - char* last = point->tsToken.z + point->tsToken.n - 1; - if (*last == 's') { - point->ts *= (int64_t)1e9; - } else if (*last == 'a') { - point->ts *= (int64_t)1e6; - } else if (*last == 'u') { - point->ts *= (int64_t)1e3; - } else if (*last == 'b') { - point->ts *= 1; + type = SML_TIME_STAMP_NOW; + } + switch (type) { + case SML_TIME_STAMP_NOW: { + *ts = taosGetTimestampNs(); + break; + } + case SML_TIME_STAMP_SECONDS: { + *ts = (int64_t)(*ts * 1e9); + break; + } + case SML_TIME_STAMP_MILLI_SECONDS: { + *ts = convertTimePrecision(*ts, TSDB_TIME_PRECISION_MILLI, TSDB_TIME_PRECISION_NANO); + break; + } + case SML_TIME_STAMP_MICRO_SECONDS: { + *ts = convertTimePrecision(*ts, TSDB_TIME_PRECISION_MICRO, TSDB_TIME_PRECISION_NANO); + break; + } + case SML_TIME_STAMP_NANO_SECONDS: { + *ts = *ts * 1; + break; + } + default: { + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; } } - return 0; + return TSDB_CODE_SUCCESS; } -int32_t tscParseLine(SStrToken line, SLPPoint* point) { - int32_t pos = 0; +static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, + uint16_t len) { + int32_t ret; + SMLTimeStampType type; + int64_t tsVal; - int32_t start = 0; - int32_t err = scanToCommaOrSpace(line, start, &pos, LP_MEASUREMENT); - if (err != 0) { - tscError("a"); - return err; + if (!isTimeStamp(value, len, &type)) { + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; } - SStrToken measurement = {.z = line.z+start, .n = pos-start}; - setPointMeasurement(point, measurement); - point->tags = taosArrayInit(64, sizeof(SLPItem)); - start = pos; - while (line.z[start] == ',') { - SLPItem item; + ret = getTimeStampValue(value, len, type, &tsVal); + if (ret) { + return ret; + } + tscDebug("Timestamp after conversion:%"PRId64, tsVal); - start++; - err = scanToEqual(line, start, &pos); - if (err != 0) { - tscError("b"); - goto error; + pVal->type = TSDB_DATA_TYPE_TIMESTAMP; + pVal->length = (int16_t)tDataTypes[pVal->type].bytes; + pVal->value = calloc(pVal->length, 1); + memcpy(pVal->value, &tsVal, pVal->length); + return TSDB_CODE_SUCCESS; +} + +static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index) { + const char *start, *cur; + int32_t ret = TSDB_CODE_SUCCESS; + int len = 0; + char key[] = "_ts"; + char *value = NULL; + + start = cur = *index; + *pTS = calloc(1, sizeof(TAOS_SML_KV)); + + while(*cur != '\0') { + cur++; + len++; + } + + if (len > 0) { + value = calloc(len + 1, 1); + memcpy(value, start, len); + } + + ret = convertSmlTimeStamp(*pTS, value, len); + if (ret) { + free(value); + free(*pTS); + return ret; + } + free(value); + + (*pTS)->key = calloc(sizeof(key), 1); + memcpy((*pTS)->key, key, sizeof(key)); + return ret; +} + +static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index) { + const char *cur = *index; + char key[TSDB_COL_NAME_LEN]; + uint16_t len = 0; + + //key field cannot start with digit + if (isdigit(*cur)) { + tscError("Tag key cannnot start with digit\n"); + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; + } + while (*cur != '\0') { + if (len > TSDB_COL_NAME_LEN) { + tscDebug("Key field cannot exceeds 65 characters"); + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; + } + //unescaped '=' identifies a tag key + if (*cur == '=' && *(cur - 1) != '\\') { + break; } + //Escape special character + if (*cur == '\\') { + escapeSpecialCharacter(2, &cur); + } + key[len] = *cur; + cur++; + len++; + } + key[len] = '\0'; - SStrToken tagKey = {.z = line.z + start, .n = pos-start}; - setItemKey(&item, tagKey, LP_TAG_KEY); + pKV->key = calloc(len + 1, 1); + memcpy(pKV->key, key, len + 1); + //tscDebug("Key:%s|len:%d", pKV->key, len); + *index = cur + 1; + return TSDB_CODE_SUCCESS; +} - start = pos + 1; - err = scanToCommaOrSpace(line, start, &pos, LP_TAG_VALUE); - if (err != 0) { - tscError("c"); - goto error; + +static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index, + bool *is_last_kv) { + const char *start, *cur; + char *value = NULL; + uint16_t len = 0; + start = cur = *index; + + while (1) { + // unescaped ',' or ' ' or '\0' identifies a value + if ((*cur == ',' || *cur == ' ' || *cur == '\0') && *(cur - 1) != '\\') { + //unescaped ' ' or '\0' indicates end of value + *is_last_kv = (*cur == ' ' || *cur == '\0') ? true : false; + break; + } + //Escape special character + if (*cur == '\\') { + escapeSpecialCharacter(2, &cur); } + cur++; + len++; + } - SStrToken tagValue = {.z = line.z + start, .n = pos-start}; - setItemValue(&item, tagValue, LP_TAG_VALUE); + value = calloc(len + 1, 1); + memcpy(value, start, len); + value[len] = '\0'; + if (!convertSmlValueType(pKV, value, len)) { + //free previous alocated key field + free(pKV->key); + free(value); + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; + } + free(value); - parseItemValue(&item, LP_ITEM_TAG); - taosArrayPush(point->tags, &item); + *index = (*cur == '\0') ? cur : cur + 1; + return TSDB_CODE_SUCCESS; +} - start = pos; +static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index, + uint8_t *has_tags) { + const char *cur = *index; + uint16_t len = 0; + + pSml->stableName = calloc(TSDB_TABLE_NAME_LEN, 1); + if (isdigit(*cur)) { + tscError("Measurement field cannnot start with digit"); + free(pSml->stableName); + pSml->stableName = NULL; + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; } - taosArraySort(point->tags, compareLPItemKey); + while (*cur != '\0') { + if (len > TSDB_TABLE_NAME_LEN) { + tscError("Measurement field cannot exceeds 193 characters"); + free(pSml->stableName); + pSml->stableName = NULL; + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; + } + //first unescaped comma or space identifies measurement + //if space detected first, meaning no tag in the input + if (*cur == ',' && *(cur - 1) != '\\') { + *has_tags = 1; + break; + } + if (*cur == ' ' && *(cur - 1) != '\\') { + break; + } + //Comma, Space, Backslash needs to be escaped if any + if (*cur == '\\') { + escapeSpecialCharacter(1, &cur); + } + pSml->stableName[len] = *cur; + cur++; + len++; + } + pSml->stableName[len] = '\0'; + *index = cur + 1; + tscDebug("Stable name in measurement:%s|len:%d", pSml->stableName, len); - point->fields = taosArrayInit(64, sizeof(SLPItem)); + return TSDB_CODE_SUCCESS; +} - start++; - do { - SLPItem item; +static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, + const char **index, bool isField, TAOS_SML_DATA_POINT* smlData) { + const char *cur = *index; + int32_t ret = TSDB_CODE_SUCCESS; + TAOS_SML_KV *pkv; + bool is_last_kv = false; + + int32_t capacity = 0; + if (isField) { + capacity = 64; + *pKVs = calloc(capacity, sizeof(TAOS_SML_KV)); + // leave space for timestamp; + pkv = *pKVs; + pkv++; + } else { + capacity = 8; + *pKVs = calloc(capacity, sizeof(TAOS_SML_KV)); + pkv = *pKVs; + } - err = scanToEqual(line, start, &pos); - if (err != 0) { + while (*cur != '\0') { + ret = parseSmlKey(pkv, &cur); + if (ret) { + tscError("Unable to parse key field"); goto error; } - SStrToken fieldKey = {.z = line.z + start, .n = pos- start}; - setItemKey(&item, fieldKey, LP_FIELD_KEY); - - start = pos + 1; - err = scanToCommaOrSpace(line, start, &pos, LP_FIELD_VALUE); - if (err != 0) { + ret = parseSmlValue(pkv, &cur, &is_last_kv); + if (ret) { + tscError("Unable to parse value field"); goto error; } - SStrToken fieldValue = {.z = line.z + start, .n = pos - start}; - setItemValue(&item, fieldValue, LP_TAG_VALUE); - - parseItemValue(&item, LP_ITEM_FIELD); - taosArrayPush(point->fields, &item); - - start = pos + 1; - } while (line.z[pos] == ','); + if (!isField && + (strcasecmp(pkv->key, "ID") == 0) && pkv->type == TSDB_DATA_TYPE_BINARY) { + smlData->childTableName = malloc( pkv->length + 1); + memcpy(smlData->childTableName, pkv->value, pkv->length); + smlData->childTableName[pkv->length] = '\0'; + free(pkv->key); + free(pkv->value); + } else { + *num_kvs += 1; + } + if (is_last_kv) { + //tscDebug("last key-value field detected"); + goto done; + } - taosArraySort(point->fields, compareLPItemKey); + //reallocate addtional memory for more kvs + TAOS_SML_KV *more_kvs = NULL; - SStrToken tsToken = {.z = line.z+start, .n = line.n-start}; - setPointTimeStamp(point, tsToken); - parsePointTime(point); + if (isField) { + if ((*num_kvs + 2) > capacity) { + capacity *= 3; capacity /= 2; + more_kvs = realloc(*pKVs, capacity * sizeof(TAOS_SML_KV)); + } else { + more_kvs = *pKVs; + } + } else { + if ((*num_kvs + 1) > capacity) { + capacity *= 3; capacity /= 2; + more_kvs = realloc(*pKVs, capacity * sizeof(TAOS_SML_KV)); + } else { + more_kvs = *pKVs; + } + } + if (!more_kvs) { + goto error; + } + *pKVs = more_kvs; + //move pKV points to next TAOS_SML_KV block + if (isField) { + pkv = *pKVs + *num_kvs + 1; + } else { + pkv = *pKVs + *num_kvs; + } + } goto done; - error: - // free array - return err; - done: - return 0; +error: + return ret; +done: + *index = cur; + return ret; +} + +static void moveTimeStampToFirstKv(TAOS_SML_DATA_POINT** smlData, TAOS_SML_KV *ts) { + TAOS_SML_KV* tsField = (*smlData)->fields; + tsField->length = ts->length; + tsField->type = ts->type; + tsField->value = malloc(ts->length); + tsField->key = malloc(strlen(ts->key) + 1); + memcpy(tsField->key, ts->key, strlen(ts->key) + 1); + memcpy(tsField->value, ts->value, ts->length); + (*smlData)->fieldNum = (*smlData)->fieldNum + 1; + + free(ts->key); + free(ts->value); + free(ts); } +int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData) { + const char* index = sql; + int32_t ret = TSDB_CODE_SUCCESS; + uint8_t has_tags = 0; + TAOS_SML_KV *timestamp = NULL; -int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* failedLines) { - for (int32_t i = 0; i < numLines; ++i) { - SStrToken tkLine = {.z = lines[i], .n = (uint32_t)strlen(lines[i])}; - SLPPoint point; - tscParseLine(tkLine, &point); - taosArrayPush(points, &point); + ret = parseSmlMeasurement(smlData, &index, &has_tags); + if (ret) { + tscError("Unable to parse measurement"); + return ret; } - return 0; -} + tscDebug("Parse measurement finished, has_tags:%d", has_tags); + + //Parse Tags + if (has_tags) { + ret = parseSmlKvPairs(&smlData->tags, &smlData->tagNum, &index, false, smlData); + if (ret) { + tscError("Unable to parse tag"); + return ret; + } + } + tscDebug("Parse tags finished, num of tags:%d", smlData->tagNum); -void destroyLPPoint(void* p) { - SLPPoint* lpPoint = p; - for (int i=0; ifields); ++i) { - SLPItem* item = taosArrayGet(lpPoint->fields, i); - free(item->value); + //Parse fields + ret = parseSmlKvPairs(&smlData->fields, &smlData->fieldNum, &index, true, smlData); + if (ret) { + tscError("Unable to parse field"); + return ret; } - taosArrayDestroy(lpPoint->fields); + tscDebug("Parse fields finished, num of fields:%d", smlData->fieldNum); - for (int i=0; itags); ++i) { - SLPItem* item = taosArrayGet(lpPoint->tags, i); - free(item->value); + //Parse timestamp + ret = parseSmlTimeStamp(×tamp, &index); + if (ret) { + tscError("Unable to parse timestamp"); + return ret; } - taosArrayDestroy(lpPoint->tags); + moveTimeStampToFirstKv(&smlData, timestamp); + tscDebug("Parse timestamp finished"); + + return TSDB_CODE_SUCCESS; } +//========================================================================= + void destroySmlDataPoint(TAOS_SML_DATA_POINT* point) { for (int i=0; itagNum; ++i) { free((point->tags+i)->key); @@ -1139,76 +1767,67 @@ void destroySmlDataPoint(TAOS_SML_DATA_POINT* point) { free(point->childTableName); } -int taos_insert_lines(TAOS* taos, char* lines[], int numLines) { - SArray* lpPoints = taosArrayInit(numLines, sizeof(SLPPoint)); - tscParseLines(lines, numLines, lpPoints, NULL); - - size_t numPoints = taosArrayGetSize(lpPoints); - TAOS_SML_DATA_POINT* points = calloc(numPoints, sizeof(TAOS_SML_DATA_POINT)); - for (int i = 0; i < numPoints; ++i) { - SLPPoint* lpPoint = taosArrayGet(lpPoints, i); - TAOS_SML_DATA_POINT* point = points+i; - point->stableName = calloc(1, strlen(lpPoint->sTableName)+1); - strncpy(point->stableName, lpPoint->sTableName, strlen(lpPoint->sTableName)); - point->stableName[strlen(lpPoint->sTableName)] = '\0'; - - size_t lpTagSize = taosArrayGetSize(lpPoint->tags); - point->tags = calloc(lpTagSize, sizeof(TAOS_SML_KV)); - point->tagNum = (int)lpTagSize; - for (int j=0; jtags, j); - TAOS_SML_KV* tagKv = point->tags + j; +int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* failedLines) { + for (int32_t i = 0; i < numLines; ++i) { + TAOS_SML_DATA_POINT point = {0}; + int32_t code = tscParseLine(lines[i], &point); + if (code != TSDB_CODE_SUCCESS) { + tscError("data point line parse failed. line %d : %s", i, lines[i]); + destroySmlDataPoint(&point); + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; + } else { + tscDebug("data point line parse success. line %d", i); + } - size_t kenLen = strlen(lpTag->key); - tagKv->key = calloc(1, kenLen+1); - strncpy(tagKv->key, lpTag->key, kenLen); - tagKv->key[kenLen] = '\0'; + taosArrayPush(points, &point); + } + return 0; +} - tagKv->type = lpTag->type; - tagKv->length = lpTag->length; - tagKv->value = malloc(tagKv->length); - memcpy(tagKv->value, lpTag->value, tagKv->length); - } +int taos_insert_lines(TAOS* taos, char* lines[], int numLines) { + int32_t code = 0; - size_t lpFieldsSize = taosArrayGetSize(lpPoint->fields); - point->fields = calloc(lpFieldsSize + 1, sizeof(TAOS_SML_KV)); - point->fieldNum = (int)(lpFieldsSize + 1); + if (numLines <= 0 || numLines > 65536) { + tscError("taos_insert_lines numLines should be between 1 and 65536. numLines: %d", numLines); + code = TSDB_CODE_TSC_APP_ERROR; + return code; + } - TAOS_SML_KV* tsField = point->fields + 0; - char tsKey[256]; - snprintf(tsKey, 256, "_%s_ts", point->stableName); - size_t tsKeyLen = strlen(tsKey); - tsField->key = calloc(1, tsKeyLen+1); - strncpy(tsField->key, tsKey, tsKeyLen); - tsField->key[tsKeyLen] = '\0'; - tsField->type = TSDB_DATA_TYPE_TIMESTAMP; - tsField->length = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes; - tsField->value = malloc(tsField->length); - memcpy(tsField->value, &(lpPoint->ts), tsField->length); + for (int i = 0; i < numLines; ++i) { + if (lines[i] == NULL) { + tscError("taos_insert_lines line %d is NULL", i); + code = TSDB_CODE_TSC_APP_ERROR; + return code; + } + } - for (int j=0; jfields, j); - TAOS_SML_KV* fieldKv = point->fields + j + 1; + SArray* lpPoints = taosArrayInit(numLines, sizeof(TAOS_SML_DATA_POINT)); + if (lpPoints == NULL) { + tscError("taos_insert_lines failed to allocate memory"); + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } - size_t kenLen = strlen(lpField->key); - fieldKv->key = calloc(1, kenLen+1); - strncpy(fieldKv->key, lpField->key, kenLen); - fieldKv->key[kenLen] = '\0'; + tscDebug("taos_insert_lines begin inserting %d lines, first line: %s", numLines, lines[0]); + code = tscParseLines(lines, numLines, lpPoints, NULL); + size_t numPoints = taosArrayGetSize(lpPoints); - fieldKv->type = lpField->type; - fieldKv->length = lpField->length; - fieldKv->value = malloc(fieldKv->length); - memcpy(fieldKv->value, lpField->value, fieldKv->length); - } + if (code != 0) { + goto cleanup; } - taos_sml_insert(taos, points, (int)numPoints); + TAOS_SML_DATA_POINT* points = TARRAY_GET_START(lpPoints); + code = taos_sml_insert(taos, points, (int)numPoints); + if (code != 0) { + tscError("taos_sml_insert error: %s", tstrerror((code))); + } +cleanup: + tscDebug("taos_insert_lines finish inserting %d lines. code: %d", numLines, code); for (int i=0; iprevTS = INT64_MIN; } + tsSetBlockInfo(pBlk, (*t1)->pTableMeta, pBlk->numOfRows); + taosHashPut(pCmd->insertParam.pTableBlockHashList, (void *)&pStmt->mtb.currentUid, sizeof(pStmt->mtb.currentUid), (void*)t1, POINTER_BYTES); tscDebug("0x%"PRIx64" table:%s is already prepared, uid:%" PRIu64, pSql->self, name, pStmt->mtb.currentUid); diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index adea1cc4537018ee3e148ca08e1b914a5d5471aa..c0627f4c31dc13c3d3a1d576d6f6ae6b5a69cc6b 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2023,6 +2023,11 @@ static int32_t checkForUdf(SSqlObj* pSql, SQueryInfo* pQueryInfo, SArray* pSelec */ static SUdfInfo* isValidUdf(SArray* pUdfInfo, const char* name, int32_t len) { + if(pUdfInfo == NULL){ + tscError("udfinfo is null"); + return NULL; + } + size_t t = taosArrayGetSize(pUdfInfo); for(int32_t i = 0; i < t; ++i) { SUdfInfo* pUdf = taosArrayGet(pUdfInfo, i); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index a78e5fa5f2e117c73f58d5f3f31857712d7230b4..0d69fe173f6d9dd85f0d057e12c78f43ec5edd8b 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -3561,6 +3561,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t pNew->pTscObj = pSql->pTscObj; pNew->signature = pNew; pNew->sqlstr = strdup(pSql->sqlstr); + tsem_init(&pNew->rspSem, 0, 0); SSqlCmd* pnCmd = &pNew->cmd; memcpy(pnCmd, pCmd, sizeof(SSqlCmd)); @@ -3921,7 +3922,7 @@ bool tscIsUpdateQuery(SSqlObj* pSql) { } SSqlCmd* pCmd = &pSql->cmd; - return ((pCmd->command >= TSDB_SQL_INSERT && pCmd->command <= TSDB_SQL_DROP_DNODE) || TSDB_SQL_USE_DB == pCmd->command); + return ((pCmd->command >= TSDB_SQL_INSERT && pCmd->command <= TSDB_SQL_DROP_DNODE) || TSDB_SQL_RESET_CACHE == pCmd->command || TSDB_SQL_USE_DB == pCmd->command); } char* tscGetSqlStr(SSqlObj* pSql) { @@ -4770,15 +4771,6 @@ static void freeContent(void* p) { tfree(ptr); } -static int32_t contCompare(const void* p1, const void* p2) { - int32_t ret = strcmp(p1, p2); - if (ret == 0) { - return 0; - } else { - return ret > 0 ? 1:-1; - } -} - int tscTransferTableNameList(SSqlObj *pSql, const char *pNameList, int32_t length, SArray* pNameArray) { SSqlCmd *pCmd = &pSql->cmd; @@ -4826,7 +4818,7 @@ int tscTransferTableNameList(SSqlObj *pSql, const char *pNameList, int32_t lengt } taosArraySort(pNameArray, nameComparFn); - taosArrayRemoveDuplicate(pNameArray, contCompare, freeContent); + taosArrayRemoveDuplicate(pNameArray, nameComparFn, freeContent); return TSDB_CODE_SUCCESS; } diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index e35e805efefb7c017dd5c0c828023ecbe6e0c460..7290db6ec978b85ad71ea744b7ea37c6488cb9fa 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -205,6 +205,16 @@ extern int32_t wDebugFlag; extern int32_t cqDebugFlag; extern int32_t debugFlag; +#ifdef TD_TSZ +// lossy +extern char lossyColumns[]; +extern double fPrecision; +extern double dPrecision; +extern uint32_t maxRange; +extern uint32_t curRange; +extern char Compressor[]; +#endif + typedef struct { char dir[TSDB_FILENAME_LEN]; int level; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 913b0936dbde52e5c1ef12540889f24b61fe8ca1..34ccfbc3fe5c5279fd668663546c8064181daa13 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -244,6 +244,19 @@ int32_t tsdbDebugFlag = 131; int32_t cqDebugFlag = 131; int32_t fsDebugFlag = 135; +#ifdef TD_TSZ +// +// lossy compress 6 +// +char lossyColumns[32] = ""; // "float|double" means all float and double columns can be lossy compressed. set empty can close lossy compress. +// below option can take effect when tsLossyColumns not empty +double fPrecision = 1E-8; // float column precision +double dPrecision = 1E-16; // double column precision +uint32_t maxRange = 500; // max range +uint32_t curRange = 100; // range +char Compressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRESSOR +#endif + int32_t (*monStartSystemFp)() = NULL; void (*monStopSystemFp)() = NULL; void (*monExecuteSQLFp)(char *sql) = NULL; @@ -1517,6 +1530,62 @@ static void doInitGlobalConfig(void) { cfg.ptrLength = tListLen(tsTempDir); cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + +#ifdef TD_TSZ + // lossy compress + cfg.option = "lossyColumns"; + cfg.ptr = lossyColumns; + cfg.valType = TAOS_CFG_VTYPE_STRING; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = 0; + cfg.maxValue = 0; + cfg.ptrLength = tListLen(lossyColumns); + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + + cfg.option = "fPrecision"; + cfg.ptr = &fPrecision; + cfg.valType = TAOS_CFG_VTYPE_DOUBLE; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = MIN_FLOAT; + cfg.maxValue = MAX_FLOAT; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + + + taosInitConfigOption(cfg); + + cfg.option = "dPrecision"; + cfg.ptr = &dPrecision; + cfg.valType = TAOS_CFG_VTYPE_DOUBLE; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = MIN_FLOAT; + cfg.maxValue = MAX_FLOAT; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + + cfg.option = "maxRange"; + cfg.ptr = &maxRange; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = 0; + cfg.maxValue = 65536; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + + cfg.option = "range"; + cfg.ptr = &curRange; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = 0; + cfg.maxValue = 65536; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); +#endif + } void taosInitGlobalCfg() { diff --git a/src/connector/jdbc/pom.xml b/src/connector/jdbc/pom.xml index a1aa41b351ebfb7309a9a8f8de40a939001a5db7..0043536daf3b070e48ac5e0310f6d34e08ed600c 100644 --- a/src/connector/jdbc/pom.xml +++ b/src/connector/jdbc/pom.xml @@ -37,13 +37,6 @@ - - junit - junit - 4.13.1 - test - - org.apache.httpcomponents httpclient @@ -52,12 +45,18 @@ com.alibaba fastjson - 1.2.58 + 1.2.76 com.google.guava guava - 30.0-jre + 30.1.1-jre + + + junit + junit + 4.13.1 + test diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java index b3887d436bcacd9748d169d0a7666a7bfa85589a..9950dbeb64c8cf4457b692a834d587ff8fd2e808 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java @@ -171,11 +171,7 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti // do nothing } - @Override - public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - if (isClosed()) - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED); - + private void checkResultSetTypeAndResultSetConcurrency(int resultSetType, int resultSetConcurrency) throws SQLException { switch (resultSetType) { case ResultSet.TYPE_FORWARD_ONLY: break; @@ -194,7 +190,14 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti default: throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE); } + } + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { + if (isClosed()) + throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED); + + checkResultSetTypeAndResultSetConcurrency(resultSetType, resultSetConcurrency); return createStatement(); } @@ -203,24 +206,7 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti if (isClosed()) throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED); - switch (resultSetType) { - case ResultSet.TYPE_FORWARD_ONLY: - break; - case ResultSet.TYPE_SCROLL_INSENSITIVE: - case ResultSet.TYPE_SCROLL_SENSITIVE: - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNSUPPORTED_METHOD); - default: - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE); - } - - switch (resultSetConcurrency) { - case ResultSet.CONCUR_READ_ONLY: - break; - case ResultSet.CONCUR_UPDATABLE: - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNSUPPORTED_METHOD); - default: - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE); - } + checkResultSetTypeAndResultSetConcurrency(resultSetType, resultSetConcurrency); return prepareStatement(sql); } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/EmptyResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/EmptyResultSet.java index 64b4276e93497f9aab8117df83de90ba28e74b78..fa8bf9e7e99ed38cf8ff718e00731c4fae0158a9 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/EmptyResultSet.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/EmptyResultSet.java @@ -326,7 +326,7 @@ public class EmptyResultSet implements ResultSet { @Override public int getFetchDirection() throws SQLException { - return 0; + return ResultSet.FETCH_FORWARD; } @Override @@ -341,12 +341,12 @@ public class EmptyResultSet implements ResultSet { @Override public int getType() throws SQLException { - return 0; + return ResultSet.TYPE_FORWARD_ONLY; } @Override public int getConcurrency() throws SQLException { - return 0; + return ResultSet.CONCUR_READ_ONLY; } @Override @@ -746,7 +746,7 @@ public class EmptyResultSet implements ResultSet { @Override public int getHoldability() throws SQLException { - return 0; + return ResultSet.CLOSE_CURSORS_AT_COMMIT; } @Override diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java index 714162b563d7358a1ed0b20476b0775d9cb343cb..a796e6d86f69d9c41317094f05e941a21b2ff23c 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java @@ -40,7 +40,7 @@ public class TSDBErrorNumbers { public static final int ERROR_JNI_FETCH_END = 0x2358; // fetch to the end of resultSet public static final int ERROR_JNI_OUT_OF_MEMORY = 0x2359; // JNI alloc memory failed - private static final Set errorNumbers = new HashSet(); + private static final Set errorNumbers = new HashSet<>(); static { errorNumbers.add(ERROR_CONNECTION_CLOSED); diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java index 7f400fc1eeae2efc3d0ab800083969404c50a469..051eca7e10ad18daea6a7b1ad55f148b786e0798 100755 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java @@ -348,4 +348,13 @@ public class TSDBJNIConnector { } private native int closeStmt(long stmt, long con); + + public void insertLines(String[] lines) throws SQLException { + int code = insertLinesImp(lines, this.taos); + if (code != TSDBConstants.JNI_SUCCESS) { + throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN, "failed to insertLines"); + } + } + + private native int insertLinesImp(String[] lines, long conn); } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java index d435062ef6d231e4c4f3545e75b8299e9876739a..f0ea03638f620dacda03a6045cc0979975cea698 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java @@ -61,7 +61,7 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet { return; // parse row data for (int rowIndex = 0; rowIndex < data.size(); rowIndex++) { - List row = new ArrayList(); + List row = new ArrayList<>(); JSONArray jsonRow = data.getJSONArray(rowIndex); for (int colIndex = 0; colIndex < this.metaData.getColumnCount(); colIndex++) { row.add(parseColumnData(jsonRow, colIndex, columns.get(colIndex).taos_type)); diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java index 715b051b74840cd01968957ab35493db2f53c5f6..e10bdb5aa93ddeae29e22018fb9fe6bd08a6d44e 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java @@ -9,6 +9,7 @@ import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.conn.ConnectionKeepAliveStrategy; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicHeaderElementIterator; @@ -34,7 +35,11 @@ public class HttpClientPoolUtil { PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); connectionManager.setDefaultMaxPerRoute(DEFAULT_MAX_PER_ROUTE); connectionManager.setMaxTotal(DEFAULT_MAX_TOTAL); - httpClient = HttpClients.custom().setKeepAliveStrategy(DEFAULT_KEEP_ALIVE_STRATEGY).setConnectionManager(connectionManager).build(); + httpClient = HttpClients.custom() + .setKeepAliveStrategy(DEFAULT_KEEP_ALIVE_STRATEGY) + .setConnectionManager(connectionManager) + .setRetryHandler(new DefaultHttpRequestRetryHandler(3, true)) + .build(); } } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/OSUtils.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/OSUtils.java index a67b4763f99164a58439df25d944cac913ab36d9..1af3e9666c238b8728ffc396a3c2f8998ab931a0 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/OSUtils.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/OSUtils.java @@ -4,14 +4,14 @@ public class OSUtils { private static final String OS = System.getProperty("os.name").toLowerCase(); public static boolean isWindows() { - return OS.indexOf("win") >= 0; + return OS.contains("win"); } public static boolean isMac() { - return OS.indexOf("mac") >= 0; + return OS.contains("mac"); } public static boolean isLinux() { - return OS.indexOf("nux") >= 0; + return OS.contains("nux"); } } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java index 15faa41a27c8aef9359ef938975648b5c10f4a9f..0f99ff4f661ec48f1df4bba07cf50a410084b7df 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java @@ -16,7 +16,7 @@ package com.taosdata.jdbc.utils; public class SqlSyntaxValidator { - private static final String[] SQL = {"select", "insert", "import", "create", "use", "alter", "drop", "set", "show", "describe"}; + private static final String[] SQL = {"select", "insert", "import", "create", "use", "alter", "drop", "set", "show", "describe", "reset"}; private static final String[] updateSQL = {"insert", "import", "create", "use", "alter", "drop", "set"}; private static final String[] querySQL = {"select", "show", "describe"}; @@ -61,29 +61,11 @@ public class SqlSyntaxValidator { public static boolean isUseSql(String sql) { return sql.trim().toLowerCase().startsWith("use"); -// || sql.trim().toLowerCase().matches("create\\s*database.*") || sql.toLowerCase().toLowerCase().matches("drop\\s*database.*"); - } - - public static boolean isShowSql(String sql) { - return sql.trim().toLowerCase().startsWith("show"); - } - - public static boolean isDescribeSql(String sql) { - return sql.trim().toLowerCase().startsWith("describe"); - } - - - public static boolean isInsertSql(String sql) { - return sql.trim().toLowerCase().startsWith("insert") || sql.trim().toLowerCase().startsWith("import"); } public static boolean isSelectSql(String sql) { return sql.trim().toLowerCase().startsWith("select"); } - public static boolean isShowDatabaseSql(String sql) { - return sql.trim().toLowerCase().matches("show\\s*databases"); - } - } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TaosInfo.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TaosInfo.java index ee1364ce217c639cbf864f87f83ad6f5ddd6c137..a427103770cff7f51355024688454824d7263c77 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TaosInfo.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TaosInfo.java @@ -7,9 +7,9 @@ import java.util.concurrent.atomic.AtomicLong; public class TaosInfo implements TaosInfoMBean { private static volatile TaosInfo instance; - private AtomicLong connect_open = new AtomicLong(); - private AtomicLong connect_close = new AtomicLong(); - private AtomicLong statement_count = new AtomicLong(); + private final AtomicLong connect_open = new AtomicLong(); + private final AtomicLong connect_close = new AtomicLong(); + private final AtomicLong statement_count = new AtomicLong(); static { try { diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java index c91bacbfdc7435e35a6be7cc1f756381de968424..9cf61903f001e84f237e25c3c10fdbb8aac28fd7 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java @@ -22,8 +22,7 @@ import java.util.stream.IntStream; public class Utils { - private static Pattern ptn = Pattern.compile(".*?'"); - + private static final Pattern ptn = Pattern.compile(".*?'"); private static final DateTimeFormatter milliSecFormatter = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd HH:mm:ss.SSS").toFormatter(); private static final DateTimeFormatter microSecFormatter = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd HH:mm:ss.SSSSSS").toFormatter(); private static final DateTimeFormatter nanoSecFormatter = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd HH:mm:ss.SSSSSSSSS").toFormatter(); @@ -74,7 +73,7 @@ public class Utils { public static String escapeSingleQuota(String origin) { Matcher m = ptn.matcher(origin); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); int end = 0; while (m.find()) { end = m.end(); @@ -87,7 +86,7 @@ public class Utils { sb.append(seg); } } else { // len > 1 - sb.append(seg.substring(0, seg.length() - 2)); + sb.append(seg, 0, seg.length() - 2); char lastcSec = seg.charAt(seg.length() - 2); if (lastcSec == '\\') { sb.append("\\'"); @@ -195,7 +194,7 @@ public class Utils { public static String formatTimestamp(Timestamp timestamp) { int nanos = timestamp.getNanos(); - if (nanos % 1000000l != 0) + if (nanos % 1000000L != 0) return timestamp.toLocalDateTime().format(microSecFormatter); return timestamp.toLocalDateTime().format(milliSecFormatter); } diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java index 30c6d99a4093f4781c20dcd0a960b4456ef50dbe..7cdda572a7e6950005d47798bece6cc5c6fef7d1 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import javax.management.OperationsException; import java.sql.*; import java.util.Properties; diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java index b5f8114bffe9a4490f3189a54cf724354e9394a5..88ff5d3a811e17aaabbeb0a451fbff010307ab6d 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java @@ -1,16 +1,16 @@ package com.taosdata.jdbc; import org.junit.Test; -import static org.junit.Assert.*; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.sql.SQLException; import java.sql.SQLWarning; import java.util.ArrayList; import java.util.List; -import java.lang.management.ManagementFactory; -import java.lang.management.RuntimeMXBean; -import java.lang.management.ThreadMXBean; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class TSDBJNIConnectorTest { @@ -114,6 +114,10 @@ public class TSDBJNIConnectorTest { throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_RESULT_SET_NULL); } // close statement + connector.executeQuery("use d"); + String[] lines = new String[] {"st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", + "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns"}; + connector.insertLines(lines); // close connection connector.closeConnection(); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java index 83caf1bebb72ec813683b083388e51b9dab2afc9..dc41d85cf38c5fbedb6e5f5c26d593c8c9d5c4d7 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java @@ -1,6 +1,5 @@ package com.taosdata.jdbc; -import com.taosdata.jdbc.rs.RestfulParameterMetaData; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java index e48237755f3de9981d4e3ddccdf59fb378d87ff4..6bddd3f42835e6706ef922f2175d6e9a36dcf509 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java @@ -2,7 +2,6 @@ package com.taosdata.jdbc; import org.junit.*; -import java.io.IOException; import java.math.BigDecimal; import java.sql.*; import java.util.ArrayList; @@ -26,7 +25,7 @@ public class TSDBPreparedStatementTest { long ts = System.currentTimeMillis(); pstmt_insert.setTimestamp(1, new Timestamp(ts)); pstmt_insert.setInt(2, 2); - pstmt_insert.setLong(3, 3l); + pstmt_insert.setLong(3, 3L); pstmt_insert.setFloat(4, 3.14f); pstmt_insert.setDouble(5, 3.1415); pstmt_insert.setShort(6, (short) 6); @@ -53,8 +52,8 @@ public class TSDBPreparedStatementTest { Assert.assertEquals(ts, rs.getTimestamp(1).getTime()); Assert.assertEquals(2, rs.getInt(2)); Assert.assertEquals(2, rs.getInt("f1")); - Assert.assertEquals(3l, rs.getLong(3)); - Assert.assertEquals(3l, rs.getLong("f2")); + Assert.assertEquals(3L, rs.getLong(3)); + Assert.assertEquals(3L, rs.getLong("f2")); Assert.assertEquals(3.14f, rs.getFloat(4), 0.0); Assert.assertEquals(3.14f, rs.getFloat("f3"), 0.0); Assert.assertEquals(3.1415, rs.getDouble(5), 0.0); @@ -312,14 +311,14 @@ public class TSDBPreparedStatementTest { Random r = new Random(); s.setTableName("weather_test"); - ArrayList ts = new ArrayList(); + ArrayList ts = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { ts.add(System.currentTimeMillis() + i); } s.setTimestamp(0, ts); int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); + ArrayList s2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s2.add(null); @@ -330,7 +329,7 @@ public class TSDBPreparedStatementTest { s.setNString(1, s2, 4); random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); + ArrayList s3 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s3.add(null); @@ -341,7 +340,7 @@ public class TSDBPreparedStatementTest { s.setFloat(2, s3); random = 10 + r.nextInt(5); - ArrayList s4 = new ArrayList(); + ArrayList s4 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s4.add(null); @@ -352,7 +351,7 @@ public class TSDBPreparedStatementTest { s.setDouble(3, s4); random = 10 + r.nextInt(5); - ArrayList ts2 = new ArrayList(); + ArrayList ts2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { ts2.add(null); @@ -379,13 +378,13 @@ public class TSDBPreparedStatementTest { if (i % random == 0) { sb.add(null); } else { - sb.add(i % 2 == 0 ? true : false); + sb.add(i % 2 == 0); } } s.setBoolean(6, sb); random = 10 + r.nextInt(5); - ArrayList s5 = new ArrayList(); + ArrayList s5 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s5.add(null); @@ -424,14 +423,14 @@ public class TSDBPreparedStatementTest { Random r = new Random(); s.setTableName("weather_test"); - ArrayList ts = new ArrayList(); + ArrayList ts = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { ts.add(System.currentTimeMillis() + i); } s.setTimestamp(0, ts); int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); + ArrayList s2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s2.add(null); @@ -442,7 +441,7 @@ public class TSDBPreparedStatementTest { s.setNString(1, s2, 4); random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); + ArrayList s3 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s3.add(null); @@ -471,7 +470,7 @@ public class TSDBPreparedStatementTest { public void bindDataWithSingleTagTest() throws SQLException { Statement stmt = conn.createStatement(); - String types[] = new String[]{"tinyint", "smallint", "int", "bigint", "bool", "float", "double", "binary(10)", "nchar(10)"}; + String[] types = new String[]{"tinyint", "smallint", "int", "bigint", "bool", "float", "double", "binary(10)", "nchar(10)"}; for (String type : types) { stmt.execute("drop table if exists weather_test"); @@ -510,21 +509,21 @@ public class TSDBPreparedStatementTest { } - ArrayList ts = new ArrayList(); + ArrayList ts = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { ts.add(System.currentTimeMillis() + i); } s.setTimestamp(0, ts); int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); + ArrayList s2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { s2.add("分支" + i % 4); } s.setNString(1, s2, 10); random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); + ArrayList s3 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { s3.add("test" + i % 4); } @@ -561,13 +560,13 @@ public class TSDBPreparedStatementTest { s.setTagString(1, "test"); - ArrayList ts = new ArrayList(); + ArrayList ts = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { ts.add(System.currentTimeMillis() + i); } s.setTimestamp(0, ts); - ArrayList s2 = new ArrayList(); + ArrayList s2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { s2.add("test" + i % 4); } @@ -788,7 +787,7 @@ public class TSDBPreparedStatementTest { public void setBigDecimal() throws SQLException { // given long ts = System.currentTimeMillis(); - BigDecimal bigDecimal = new BigDecimal(3.14444); + BigDecimal bigDecimal = new BigDecimal("3.14444"); // when pstmt_insert.setTimestamp(1, new Timestamp(ts)); @@ -999,7 +998,7 @@ public class TSDBPreparedStatementTest { long ts = System.currentTimeMillis(); pstmt_insert.setTimestamp(1, new Timestamp(ts)); pstmt_insert.setInt(2, 2); - pstmt_insert.setLong(3, 3l); + pstmt_insert.setLong(3, 3L); pstmt_insert.setFloat(4, 3.14f); pstmt_insert.setDouble(5, 3.1415); pstmt_insert.setShort(6, (short) 6); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java index ec54a44b7c889236676b65fea9fdf689b7207df9..f72cbbec8c1b4c0acad1c83ffcbcb35c1fb8ea7b 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java @@ -95,13 +95,13 @@ public class TSDBResultSetTest { @Test public void getBigDecimal() throws SQLException { BigDecimal f1 = rs.getBigDecimal("f1"); - Assert.assertEquals(1609430400000l, f1.longValue()); + Assert.assertEquals(1609430400000L, f1.longValue()); BigDecimal f2 = rs.getBigDecimal("f2"); Assert.assertEquals(1, f2.intValue()); BigDecimal f3 = rs.getBigDecimal("f3"); - Assert.assertEquals(100l, f3.longValue()); + Assert.assertEquals(100L, f3.longValue()); BigDecimal f4 = rs.getBigDecimal("f4"); Assert.assertEquals(3.1415f, f4.floatValue(), 0.00000f); @@ -125,13 +125,13 @@ public class TSDBResultSetTest { Assert.assertEquals(1, Ints.fromByteArray(f2)); byte[] f3 = rs.getBytes("f3"); - Assert.assertEquals(100l, Longs.fromByteArray(f3)); + Assert.assertEquals(100L, Longs.fromByteArray(f3)); byte[] f4 = rs.getBytes("f4"); - Assert.assertEquals(3.1415f, Float.valueOf(new String(f4)), 0.000000f); + Assert.assertEquals(3.1415f, Float.parseFloat(new String(f4)), 0.000000f); byte[] f5 = rs.getBytes("f5"); - Assert.assertEquals(3.1415926, Double.valueOf(new String(f5)), 0.000000f); + Assert.assertEquals(3.1415926, Double.parseDouble(new String(f5)), 0.000000f); byte[] f6 = rs.getBytes("f6"); Assert.assertTrue(Arrays.equals("abc".getBytes(), f6)); @@ -223,7 +223,7 @@ public class TSDBResultSetTest { Object f3 = rs.getObject("f3"); Assert.assertEquals(Long.class, f3.getClass()); - Assert.assertEquals(100l, f3); + Assert.assertEquals(100L, f3); Object f4 = rs.getObject("f4"); Assert.assertEquals(Float.class, f4.getClass()); @@ -421,7 +421,7 @@ public class TSDBResultSetTest { @Test(expected = SQLFeatureNotSupportedException.class) public void updateLong() throws SQLException { - rs.updateLong(1, 1l); + rs.updateLong(1, 1L); } @Test(expected = SQLFeatureNotSupportedException.class) diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BadLocaleSettingTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BadLocaleSettingTest.java index b351ee94bbcea3a4b6f79715bc03a405ff8d0c00..2211e0fa176c67329ac13ee4374daf4667da933b 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BadLocaleSettingTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BadLocaleSettingTest.java @@ -3,12 +3,13 @@ package com.taosdata.jdbc.cases; import com.taosdata.jdbc.TSDBDriver; import org.junit.AfterClass; -import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import java.io.IOException; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; import java.util.Properties; public class BadLocaleSettingTest { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java index 31893527aff2b3fd5f5512c729d60e0b8a137aa0..fcb6ab7aaff2406acf59262a9cdef90b628b8934 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java @@ -1,6 +1,7 @@ package com.taosdata.jdbc.cases; import com.taosdata.jdbc.TSDBDriver; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -9,13 +10,13 @@ import java.util.Properties; public class ConnectMultiTaosdByRestfulWithDifferentTokenTest { - private static String host1 = "192.168.17.156"; - private static String user1 = "root"; - private static String password1 = "tqueue"; + private static final String host1 = "192.168.17.156"; + private static final String user1 = "root"; + private static final String password1 = "tqueue"; private Connection conn1; - private static String host2 = "192.168.17.82"; - private static String user2 = "root"; - private static String password2 = "taosdata"; + private static final String host2 = "192.168.17.82"; + private static final String user2 = "root"; + private static final String password2 = "taosdata"; private Connection conn2; @Test @@ -30,6 +31,7 @@ public class ConnectMultiTaosdByRestfulWithDifferentTokenTest { try (Statement stmt = connection.createStatement()) { ResultSet rs = stmt.executeQuery("select server_status()"); ResultSetMetaData meta = rs.getMetaData(); + Assert.assertNotNull(meta); while (rs.next()) { } } catch (SQLException e) { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DriverAutoloadTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DriverAutoloadTest.java index 6c8aed1b066236371496813301f77db32fb4e0f9..a00c8f4f97aad40c05e71fa63e34a2253b706046 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DriverAutoloadTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DriverAutoloadTest.java @@ -13,7 +13,7 @@ import java.util.Properties; public class DriverAutoloadTest { private Properties properties; - private String host = "127.0.0.1"; + private final String host = "127.0.0.1"; @Test public void testRestful() throws SQLException { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java index 84149775c3d2bbda6a66930159e19eb27d95a6d1..beea990456ec98c2ab51fc2086034e0b31b570b6 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java @@ -13,9 +13,9 @@ import java.util.Random; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class InsertDbwithoutUseDbTest { - private static String host = "127.0.0.1"; + private static final String host = "127.0.0.1"; private static Properties properties; - private static Random random = new Random(System.currentTimeMillis()); + private static final Random random = new Random(System.currentTimeMillis()); @Test public void case001() throws ClassNotFoundException, SQLException { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java index 4b4e83719ff64578e0ca5b34cd4cfe11ea8d98f3..9f8243542f0c2cf760ca192a0d39293531a5e42c 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java @@ -8,14 +8,14 @@ public class InsertSpecialCharacterJniTest { private static final String host = "127.0.0.1"; private static Connection conn; - private static String dbName = "spec_char_test"; - private static String tbname1 = "test"; - private static String tbname2 = "weather"; - private static String special_character_str_1 = "$asd$$fsfsf$"; - private static String special_character_str_2 = "\\\\asdfsfsf\\\\"; - private static String special_character_str_3 = "\\\\asdfsfsf\\"; - private static String special_character_str_4 = "?asd??fsf?sf?"; - private static String special_character_str_5 = "?#sd@$f(('<(s[P)>\"){]}f?s[]{}%vaew|\"fsfs^a&d*jhg)(j))(f@~!?$"; + private static final String dbName = "spec_char_test"; + private static final String tbname1 = "test"; + private static final String tbname2 = "weather"; + private static final String special_character_str_1 = "$asd$$fsfsf$"; + private static final String special_character_str_2 = "\\\\asdfsfsf\\\\"; + private static final String special_character_str_3 = "\\\\asdfsfsf\\"; + private static final String special_character_str_4 = "?asd??fsf?sf?"; + private static final String special_character_str_5 = "?#sd@$f(('<(s[P)>\"){]}f?s[]{}%vaew|\"fsfs^a&d*jhg)(j))(f@~!?$"; @Test public void testCase01() throws SQLException { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java index fa6cbd22b5da0869d4a74e90de12c952fecd22c7..2e981e7f414590c8d8be46659a415cb244a949ae 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java @@ -8,14 +8,14 @@ public class InsertSpecialCharacterRestfulTest { private static final String host = "127.0.0.1"; private static Connection conn; - private static String dbName = "spec_char_test"; - private static String tbname1 = "test"; - private static String tbname2 = "weather"; - private static String special_character_str_1 = "$asd$$fsfsf$"; - private static String special_character_str_2 = "\\\\asdfsfsf\\\\"; - private static String special_character_str_3 = "\\\\asdfsfsf\\"; - private static String special_character_str_4 = "?asd??fsf?sf?"; - private static String special_character_str_5 = "?#sd@$f(('<(s[P)>\"){]}f?s[]{}%vaew|\"fsfs^a&d*jhg)(j))(f@~!?$"; + private static final String dbName = "spec_char_test"; + private static final String tbname1 = "test"; + private static final String tbname2 = "weather"; + private static final String special_character_str_1 = "$asd$$fsfsf$"; + private static final String special_character_str_2 = "\\\\asdfsfsf\\\\"; + private static final String special_character_str_3 = "\\\\asdfsfsf\\"; + private static final String special_character_str_4 = "?asd??fsf?sf?"; + private static final String special_character_str_5 = "?#sd@$f(('<(s[P)>\"){]}f?s[]{}%vaew|\"fsfs^a&d*jhg)(j))(f@~!?$"; @Test public void testCase01() throws SQLException { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java index f3d79b1df1594edc4fffd626244bc742ea13ec75..6febdd84972113e1ea779cd620865b0a25595486 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java @@ -8,13 +8,13 @@ import java.util.Properties; public class InvalidResultSetPointerTest { - private static String host = "127.0.0.1"; + private static final String host = "127.0.0.1"; private static final String dbName = "test"; private static final String stbName = "stb"; private static final String tbName = "tb"; private static Connection connection; - private static int numOfSTb = 30000; - private static int numOfTb = 3; + private static final int numOfSTb = 30000; + private static final int numOfTb = 3; private static int numOfThreads = 100; @Test @@ -74,7 +74,7 @@ public class InvalidResultSetPointerTest { b = numOfSTb % numOfThreads; } - multiThreadingClass instance[] = new multiThreadingClass[numOfThreads]; + multiThreadingClass[] instance = new multiThreadingClass[numOfThreads]; int last = 0; for (int i = 0; i < numOfThreads; i++) { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatementTest.java index da6853d2fa06fb8436e79b95e9b7f1c2fa0785e2..73da79f357b1c066943e2f39bf9f8bdc86382d7e 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatementTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatementTest.java @@ -9,8 +9,7 @@ import java.util.concurrent.TimeUnit; public class MultiThreadsWithSameStatementTest { - - private class Service { + private static class Service { public Connection conn; public Statement stmt; diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4eebbd08e87b2e85ce319bc0bc98bc4515bd2077 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java @@ -0,0 +1,51 @@ +package com.taosdata.jdbc.cases; + +import com.taosdata.jdbc.TSDBDriver; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.sql.*; +import java.util.Properties; + +import static org.junit.Assert.assertEquals; + +public class ResetQueryCacheTest { + + static Connection connection; + static Statement statement; + static String host = "127.0.0.1"; + + @Before + public void init() { + try { + Properties properties = new Properties(); + properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); + properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); + properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); + connection = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/", properties); + statement = connection.createStatement(); + } catch (SQLException e) { + return; + } + } + + @Test + public void testResetQueryCache() throws SQLException { + String resetSql = "reset query cache"; + statement.execute(resetSql); + } + + @After + public void close() { + try { + if (statement != null) + statement.close(); + if (connection != null) + connection.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java index 332c171c380e061b747c74328ebeef37225e9b2d..1600fec13d1f2a56caf3905b863aa132fe1de830 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java @@ -16,9 +16,9 @@ import static org.junit.Assert.assertEquals; public class StableTest { private static Connection connection; - private static String dbName = "test"; - private static String stbName = "st"; - private static String host = "127.0.0.1"; + private static final String dbName = "test"; + private static final String stbName = "st"; + private static final String host = "127.0.0.1"; @BeforeClass public static void createDatabase() { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TaosInfoMonitorTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TaosInfoMonitorTest.java index e9e36e20c4f83e98d6dd808da3a58ee628f418f0..7df9f7380704eefb51b26214295624995811c84f 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TaosInfoMonitorTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TaosInfoMonitorTest.java @@ -25,7 +25,7 @@ public class TaosInfoMonitorTest { return null; }).collect(Collectors.toList()); - connectionList.stream().forEach(conn -> { + connectionList.forEach(conn -> { try (Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery("show databases"); while (rs.next()) { @@ -37,7 +37,7 @@ public class TaosInfoMonitorTest { } }); - connectionList.stream().forEach(conn -> { + connectionList.forEach(conn -> { try { conn.close(); TimeUnit.MILLISECONDS.sleep(100); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java index 042d76d576b0c17fa9ec49e9ac88be851b3b47f7..72734cb0ecdfe67cbd02306acef3ae8625f942b0 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java @@ -22,7 +22,7 @@ public class TimestampPrecisionInNanoInJniTest { private static final long timestamp3 = (timestamp1 + 10) * 1000_000 + 123456; private static final Format format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); private static final String date1 = format.format(new Date(timestamp1)); - private static final String date4 = format.format(new Date(timestamp1 + 10l)); + private static final String date4 = format.format(new Date(timestamp1 + 10L)); private static final String date2 = date1 + "123455"; private static final String date3 = date4 + "123456"; diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java index fb23c0e64aa7469443d5476de47af305cfd3c09f..e4149793aca46ebe5df47aec002828441fef481d 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java @@ -44,7 +44,7 @@ public class UnsignedNumberJniTest { Assert.assertEquals(127, rs.getByte(2)); Assert.assertEquals(32767, rs.getShort(3)); Assert.assertEquals(2147483647, rs.getInt(4)); - Assert.assertEquals(9223372036854775807l, rs.getLong(5)); + Assert.assertEquals(9223372036854775807L, rs.getLong(5)); } } catch (SQLException e) { e.printStackTrace(); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java index a659a490cb557f3825deb4bb58d32941b47a62ab..3bdf5ae4f2404db5f56e27b740d4e4951e10818d 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java @@ -45,7 +45,7 @@ public class UnsignedNumberRestfulTest { Assert.assertEquals(127, rs.getByte(2)); Assert.assertEquals(32767, rs.getShort(3)); Assert.assertEquals(2147483647, rs.getInt(4)); - Assert.assertEquals(9223372036854775807l, rs.getLong(5)); + Assert.assertEquals(9223372036854775807L, rs.getLong(5)); } } catch (SQLException e) { e.printStackTrace(); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java index 81e762c5ca9646875f21acd89f55bd939440cfd4..21a91669b270df4dc2e8f7b4885fb9e8eedbfdf7 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java @@ -95,13 +95,13 @@ public class RestfulResultSetTest { public void getBigDecimal() throws SQLException { BigDecimal f1 = rs.getBigDecimal("f1"); long actual = (f1 == null) ? 0 : f1.longValue(); - Assert.assertEquals(1609430400000l, actual); + Assert.assertEquals(1609430400000L, actual); BigDecimal f2 = rs.getBigDecimal("f2"); Assert.assertEquals(1, f2.intValue()); BigDecimal f3 = rs.getBigDecimal("f3"); - Assert.assertEquals(100l, f3.longValue()); + Assert.assertEquals(100L, f3.longValue()); BigDecimal f4 = rs.getBigDecimal("f4"); Assert.assertEquals(3.1415f, f4.floatValue(), 0.00000f); @@ -125,13 +125,13 @@ public class RestfulResultSetTest { Assert.assertEquals(1, Ints.fromByteArray(f2)); byte[] f3 = rs.getBytes("f3"); - Assert.assertEquals(100l, Longs.fromByteArray(f3)); + Assert.assertEquals(100L, Longs.fromByteArray(f3)); byte[] f4 = rs.getBytes("f4"); - Assert.assertEquals(3.1415f, Float.valueOf(new String(f4)), 0.000000f); + Assert.assertEquals(3.1415f, Float.parseFloat(new String(f4)), 0.000000f); byte[] f5 = rs.getBytes("f5"); - Assert.assertEquals(3.1415926, Double.valueOf(new String(f5)), 0.000000f); + Assert.assertEquals(3.1415926, Double.parseDouble(new String(f5)), 0.000000f); byte[] f6 = rs.getBytes("f6"); Assert.assertEquals("abc", new String(f6)); @@ -222,7 +222,7 @@ public class RestfulResultSetTest { Object f3 = rs.getObject("f3"); Assert.assertEquals(Long.class, f3.getClass()); - Assert.assertEquals(100l, f3); + Assert.assertEquals(100L, f3); Object f4 = rs.getObject("f4"); Assert.assertEquals(Float.class, f4.getClass()); @@ -434,7 +434,7 @@ public class RestfulResultSetTest { @Test(expected = SQLFeatureNotSupportedException.class) public void updateLong() throws SQLException { - rs.updateLong(1, 1l); + rs.updateLong(1, 1L); } @Test(expected = SQLFeatureNotSupportedException.class) diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/OSUtilsTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/OSUtilsTest.java index fd6c83ad1cacfb351bcc1d35a5cf777213ad876d..269a19e7a031560cfa1c7c33af77ae1c0a6ff268 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/OSUtilsTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/OSUtilsTest.java @@ -10,17 +10,17 @@ public class OSUtilsTest { @Test public void inWindows() { - Assert.assertEquals(OS.indexOf("win") >= 0, OSUtils.isWindows()); + Assert.assertEquals(OS.contains("win"), OSUtils.isWindows()); } @Test public void isMac() { - Assert.assertEquals(OS.indexOf("mac") >= 0, OSUtils.isMac()); + Assert.assertEquals(OS.contains("mac"), OSUtils.isMac()); } @Test public void isLinux() { - Assert.assertEquals(OS.indexOf("nux") >= 0, OSUtils.isLinux()); + Assert.assertEquals(OS.contains("nux"), OSUtils.isLinux()); } @Before diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/TimestampUtil.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/TimestampUtil.java index 16f8269d246f094558bbe7f6b11ac4bd90eb888f..eaebd92d8e8d9ef4022e9d5e9cb5a5bfceac878c 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/TimestampUtil.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/TimestampUtil.java @@ -21,47 +21,4 @@ public class TimestampUtil { SimpleDateFormat sdf = new SimpleDateFormat(datetimeFormat); return sdf.format(new Date(time)); } - - public static class TimeTuple { - public Long start; - public Long end; - public Long timeGap; - - TimeTuple(long start, long end, long timeGap) { - this.start = start; - this.end = end; - this.timeGap = timeGap; - } - } - - public static TimeTuple range(long start, long timeGap, long size) { - long now = System.currentTimeMillis(); - if (timeGap < 1) - timeGap = 1; - if (start == 0) - start = now - size * timeGap; - - // 如果size小于1异常 - if (size < 1) - throw new IllegalArgumentException("size less than 1."); - // 如果timeGap为1,已经超长,需要前移start - if (start + size > now) { - start = now - size; - return new TimeTuple(start, now, 1); - } - long end = start + (long) (timeGap * size); - if (end > now) { - //压缩timeGap - end = now; - double gap = (end - start) / (size * 1.0f); - if (gap < 1.0f) { - timeGap = 1; - start = end - size; - } else { - timeGap = (long) gap; - end = start + (long) (timeGap * size); - } - } - return new TimeTuple(start, end, timeGap); - } } diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/UtilsTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/UtilsTest.java index 4b8ec61078e8dbb812940d62737c638dc9a49f41..1cbd95b2492284b9c85f31bd6b6848d9c223df18 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/UtilsTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/UtilsTest.java @@ -3,8 +3,6 @@ package com.taosdata.jdbc.utils; import org.junit.Assert; import org.junit.Test; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Stream; public class UtilsTest { @@ -19,14 +17,14 @@ public class UtilsTest { Assert.assertEquals("\\'\\'\\'\\'\\'a\\'", news); // given - s = "\'''''a\\'"; + s = "'''''a\\'"; // when news = Utils.escapeSingleQuota(s); // then Assert.assertEquals("\\'\\'\\'\\'\\'a\\'", news); // given - s = "\'\'\'\''a\\'"; + s = "'''''a\\'"; // when news = Utils.escapeSingleQuota(s); // then diff --git a/src/connector/python/taos/cinterface.py b/src/connector/python/taos/cinterface.py index cc7c279458c779b924564cdb17c88989014e3193..6d8ceb7a293ef71c7e8944772e6b8a6a0ed8e7a9 100644 --- a/src/connector/python/taos/cinterface.py +++ b/src/connector/python/taos/cinterface.py @@ -403,6 +403,20 @@ class CTaosInterface(object): """ return CTaosInterface.libtaos.taos_affected_rows(result) + @staticmethod + def insertLines(connection, lines): + ''' + insert through lines protocol + @lines: list of str + @rtype: tsdb error codes + ''' + numLines = len(lines) + c_lines_type = ctypes.c_char_p*numLines + c_lines = c_lines_type() + for i in range(numLines): + c_lines[i] = ctypes.c_char_p(lines[i].encode('utf-8')) + return CTaosInterface.libtaos.taos_insert_lines(connection, c_lines, ctypes.c_int(numLines)) + @staticmethod def subscribe(connection, restart, topic, sql, interval): """Create a subscription diff --git a/src/connector/python/taos/connection.py b/src/connector/python/taos/connection.py index f6c395342c9c39a24bda6022f0ed36cb7bfe045b..88d06cd7186018788aeb25c982fc205441193cb8 100644 --- a/src/connector/python/taos/connection.py +++ b/src/connector/python/taos/connection.py @@ -66,6 +66,14 @@ class TDengineConnection(object): self._conn, restart, topic, sql, interval) return TDengineSubscription(sub) + def insertLines(self, lines): + """ + insert lines through line protocol + """ + if self._conn is None: + return None + return CTaosInterface.insertLines(self._conn, lines) + def cursor(self): """Return a new Cursor object using the connection. """ diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index af63b10bc55cac9db50f034f98fb8e54428e7550..eac04fe7bb2c53bd55dcbf8b6f5044d99007dc6c 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -43,6 +43,7 @@ #include "mnode.h" #include "qScript.h" #include "tcache.h" +#include "tscompression.h" #if !defined(_MODULE) || !defined(_TD_LINUX) int32_t moduleStart() { return 0; } @@ -238,6 +239,12 @@ static void dnodeCheckDataDirOpenned(char *dir) { } static int32_t dnodeInitStorage() { +#ifdef TD_TSZ + // compress module init + tsCompressInit(); +#endif + + // storage module init if (tsDiskCfgNum == 1 && dnodeCreateDir(tsDataDir) < 0) { dError("failed to create dir: %s, reason: %s", tsDataDir, strerror(errno)); return -1; @@ -313,7 +320,15 @@ static int32_t dnodeInitStorage() { return 0; } -static void dnodeCleanupStorage() { tfsDestroy(); } +static void dnodeCleanupStorage() { + // storage destroy + tfsDestroy(); + + #ifdef TD_TSZ + // compress destroy + tsCompressExit(); + #endif +} bool dnodeIsFirstDeploy() { return strcmp(tsFirst, tsLocalEp) == 0; diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index eefa0ed92aa610899f69bc965e03d7c0ea5ee917..f57e553e3f43053552e30a5191abbd7374032f9d 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -101,6 +101,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_TSC_INVALID_TABLE_NAME TAOS_DEF_ERROR_CODE(0, 0x0218) //"Table does not exist") #define TSDB_CODE_TSC_EXCEED_SQL_LIMIT TAOS_DEF_ERROR_CODE(0, 0x0219) //"SQL statement too long check maxSQLLength config") #define TSDB_CODE_TSC_FILE_EMPTY TAOS_DEF_ERROR_CODE(0, 0x021A) //"File is empty") +#define TSDB_CODE_TSC_LINE_SYNTAX_ERROR TAOS_DEF_ERROR_CODE(0, 0x021B) //"Syntax error in Line") // mnode #define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) //"Message not processed") diff --git a/src/kit/CMakeLists.txt b/src/kit/CMakeLists.txt index 7053052007c5e00a5ac001d72b64029dc08ddf8b..fdf58d5ae1c21ebd8b2948114d9643d38dccae3e 100644 --- a/src/kit/CMakeLists.txt +++ b/src/kit/CMakeLists.txt @@ -4,3 +4,4 @@ PROJECT(TDengine) ADD_SUBDIRECTORY(shell) ADD_SUBDIRECTORY(taosdemo) ADD_SUBDIRECTORY(taosdump) +ADD_SUBDIRECTORY(taospack) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index cd00d96ac3adcabcf20692de1977ffc12207188b..f9b147d43d44943964ac5237836da300d0cab795 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -16,7 +16,7 @@ /* when in some thread query return error, thread don't exit, but return, otherwise coredump in other thread. -*/ + */ #include #include @@ -24,24 +24,24 @@ #define CURL_STATICLIB #ifdef LINUX - #include - #include - #ifndef _ALPINE - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include +#include +#include +#ifndef _ALPINE +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #else - #include - #include +#include +#include #endif #include @@ -55,16 +55,17 @@ #define STMT_IFACE_ENABLED 1 #define NANO_SECOND_ENABLED 1 +#define SET_THREADNAME_ENABLED 1 + +#if SET_THREADNAME_ENABLED == 0 +#define setThreadName(name) +#endif #define REQ_EXTRA_BUF_LEN 1024 #define RESP_BUF_LEN 4096 extern char configDir[]; -#define INSERT_JSON_NAME "insert.json" -#define QUERY_JSON_NAME "query.json" -#define SUBSCRIBE_JSON_NAME "subscribe.json" - #define STR_INSERT_INTO "INSERT INTO " #define MAX_RECORDS_PER_REQ 32766 @@ -74,9 +75,10 @@ extern char configDir[]; #define BUFFER_SIZE TSDB_MAX_ALLOWED_SQL_LEN #define COND_BUF_LEN (BUFFER_SIZE - 30) #define COL_BUFFER_LEN ((TSDB_COL_NAME_LEN + 15) * TSDB_MAX_COLUMNS) + #define MAX_USERNAME_SIZE 64 #define MAX_PASSWORD_SIZE 64 -#define MAX_HOSTNAME_SIZE 64 +#define MAX_HOSTNAME_SIZE 253 // https://man7.org/linux/man-pages/man7/hostname.7.html #define MAX_TB_NAME_SIZE 64 #define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space #define OPT_ABORT 1 /* –abort */ @@ -90,11 +92,16 @@ extern char configDir[]; #define MAX_SUPER_TABLE_COUNT 200 #define MAX_QUERY_SQL_COUNT 100 -#define MAX_QUERY_SQL_LENGTH 1024 +#define MAX_QUERY_SQL_LENGTH BUFFER_SIZE #define MAX_DATABASE_COUNT 256 #define INPUT_BUF_LEN 256 +#define TBNAME_PREFIX_LEN (TSDB_TABLE_NAME_LEN - 20) // 20 characters reserved for seq +#define SMALL_BUFF_LEN 8 +#define DATATYPE_BUFF_LEN (SMALL_BUFF_LEN*3) +#define NOTE_BUFF_LEN (SMALL_BUFF_LEN*16) + #define DEFAULT_TIMESTAMP_STEP 1 @@ -220,6 +227,7 @@ typedef struct SArguments_S { uint32_t num_of_CPR; uint32_t num_of_threads; uint64_t insert_interval; + uint64_t timestamp_step; int64_t query_times; uint32_t interlace_rows; uint32_t num_of_RPR; // num_of_records_per_req @@ -238,16 +246,15 @@ typedef struct SArguments_S { typedef struct SColumn_S { char field[TSDB_COL_NAME_LEN]; - char dataType[16]; + char dataType[DATATYPE_BUFF_LEN]; uint32_t dataLen; - char note[128]; + char note[NOTE_BUFF_LEN]; } StrColumn; typedef struct SSuperTable_S { char sTblName[TSDB_TABLE_NAME_LEN]; - char dataSource[MAX_TB_NAME_SIZE]; // rand_gen or sample - char childTblPrefix[TSDB_TABLE_NAME_LEN - 20]; // 20 characters reserved for seq - char insertMode[MAX_TB_NAME_SIZE]; // taosc, rest + char dataSource[SMALL_BUFF_LEN]; // rand_gen or sample + char childTblPrefix[TBNAME_PREFIX_LEN]; uint16_t childTblExists; int64_t childTblCount; uint64_t batchCreateTableNum; // 0: no batch, > 0: batch table number in one sql @@ -266,7 +273,7 @@ typedef struct SSuperTable_S { int64_t insertRows; int64_t timeStampStep; char startTimestamp[MAX_TB_NAME_SIZE]; - char sampleFormat[MAX_TB_NAME_SIZE]; // csv, json + char sampleFormat[SMALL_BUFF_LEN]; // csv, json char sampleFile[MAX_FILE_NAME_LEN]; char tagsFile[MAX_FILE_NAME_LEN]; @@ -302,7 +309,7 @@ typedef struct { int16_t replica; int16_t quorum; int16_t days; - char keeplist[32]; + char keeplist[64]; int32_t cache; //MB int32_t blocks; int32_t minrows; @@ -311,7 +318,7 @@ typedef struct { int32_t fsync; int8_t comp; int8_t cachelast; - char precision[8]; // time resolution + char precision[SMALL_BUFF_LEN]; // time resolution int8_t update; char status[16]; } SDbInfo; @@ -331,7 +338,7 @@ typedef struct SDbCfg_S { int cache; int blocks; int quorum; - char precision[8]; + char precision[SMALL_BUFF_LEN]; } SDbCfg; typedef struct SDataBase_S { @@ -397,7 +404,7 @@ typedef struct SuperQueryInfo_S { int subscribeKeepProgress; uint64_t queryTimes; int64_t childTblCount; - char childTblPrefix[TSDB_TABLE_NAME_LEN - 20]; // 20 characters reserved for seq + char childTblPrefix[TBNAME_PREFIX_LEN]; // 20 characters reserved for seq int sqlCount; char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH+1]; char result[MAX_QUERY_SQL_COUNT][MAX_FILE_NAME_LEN]; @@ -417,7 +424,7 @@ typedef struct SQueryMetaInfo_S { char user[MAX_USERNAME_SIZE]; char password[MAX_PASSWORD_SIZE]; char dbName[TSDB_DB_NAME_LEN]; - char queryMode[MAX_TB_NAME_SIZE]; // taosc, rest + char queryMode[SMALL_BUFF_LEN]; // taosc, rest SpecifiedQueryInfo specifiedQueryInfo; SuperQueryInfo superQueryInfo; @@ -480,42 +487,42 @@ typedef unsigned __int32 uint32_t; #pragma comment ( lib, "ws2_32.lib" ) // Some old MinGW/CYGWIN distributions don't define this: #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING - #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 +#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 #endif // ENABLE_VIRTUAL_TERMINAL_PROCESSING static HANDLE g_stdoutHandle; static DWORD g_consoleMode; static void setupForAnsiEscape(void) { - DWORD mode = 0; - g_stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD mode = 0; + g_stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE); - if(g_stdoutHandle == INVALID_HANDLE_VALUE) { - exit(GetLastError()); - } + if(g_stdoutHandle == INVALID_HANDLE_VALUE) { + exit(GetLastError()); + } - if(!GetConsoleMode(g_stdoutHandle, &mode)) { - exit(GetLastError()); - } + if(!GetConsoleMode(g_stdoutHandle, &mode)) { + exit(GetLastError()); + } - g_consoleMode = mode; + g_consoleMode = mode; - // Enable ANSI escape codes - mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + // Enable ANSI escape codes + mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; - if(!SetConsoleMode(g_stdoutHandle, mode)) { - exit(GetLastError()); - } + if(!SetConsoleMode(g_stdoutHandle, mode)) { + exit(GetLastError()); + } } static void resetAfterAnsiEscape(void) { - // Reset colors - printf("\x1b[0m"); + // Reset colors + printf("\x1b[0m"); - // Reset console mode - if(!SetConsoleMode(g_stdoutHandle, g_consoleMode)) { - exit(GetLastError()); - } + // Reset console mode + if(!SetConsoleMode(g_stdoutHandle, g_consoleMode)) { + exit(GetLastError()); + } } static int taosRandom() @@ -529,15 +536,15 @@ static int taosRandom() static void setupForAnsiEscape(void) {} static void resetAfterAnsiEscape(void) { - // Reset colors - printf("\x1b[0m"); + // Reset colors + printf("\x1b[0m"); } #include static int taosRandom() { - return rand(); + return rand(); } #endif // ifdef Windows @@ -600,6 +607,7 @@ SArguments g_args = { 4, // num_of_CPR 10, // num_of_connections/thread 0, // insert_interval + DEFAULT_TIMESTAMP_STEP, // timestamp_step 1, // query_times 0, // interlace_rows; 30000, // num_of_RPR @@ -629,7 +637,7 @@ static FILE * g_fpOfInsertResult = NULL; #define debugPrint(fmt, ...) \ do { if (g_args.debug_print || g_args.verbose_print) \ - fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0) + fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0) #define verbosePrint(fmt, ...) \ do { if (g_args.verbose_print) \ @@ -735,6 +743,9 @@ static void printHelp() { "The number of threads. Default is 10."); printf("%s%s%s%s\n", indent, "-i", indent, "The sleep time (ms) between insertion. Default is 0."); + printf("%s%s%s%s%d\n", indent, "-S", indent, + "The timestamp step between insertion. Default is %d.", + DEFAULT_TIMESTAMP_STEP); printf("%s%s%s%s\n", indent, "-r", indent, "The number of records per request. Default is 30000."); printf("%s%s%s%s\n", indent, "-t", indent, @@ -876,6 +887,14 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) { exit(EXIT_FAILURE); } arguments->insert_interval = atoi(argv[++i]); + } else if (strcmp(argv[i], "-S") == 0) { + if ((argc == i+1) || + (!isStringNumber(argv[i+1]))) { + printHelp(); + errorPrint("\n\t%s%s", argv[i], " need a number following!\n"); + exit(EXIT_FAILURE); + } + arguments->timestamp_step = atoi(argv[++i]); } else if (strcmp(argv[i], "-qt") == 0) { if ((argc == i+1) || (!isStringNumber(argv[i+1]))) { @@ -1358,14 +1377,14 @@ static const char charNum[] = "0123456789"; static void nonrand_string(char *, int) __attribute__ ((unused)); // reserve for debugging purpose static void nonrand_string(char *str, int size) { - str[0] = 0; - if (size > 0) { - int n; - for (n = 0; n < size; n++) { - str[n] = charNum[n % 10]; - } - str[n] = 0; - } + str[0] = 0; + if (size > 0) { + int n; + for (n = 0; n < size; n++) { + str[n] = charNum[n % 10]; + } + str[n] = 0; + } } #endif @@ -1431,8 +1450,8 @@ static int printfInsertMeta() { if (g_args.iface != INTERFACE_BUT) { // first time if no iface specified printf("interface: \033[33m%s\033[0m\n", - (g_args.iface==TAOSC_IFACE)?"taosc": - (g_args.iface==REST_IFACE)?"rest":"stmt"); + (g_args.iface==TAOSC_IFACE)?"taosc": + (g_args.iface==REST_IFACE)?"rest":"stmt"); } printf("host: \033[33m%s:%u\033[0m\n", @@ -2216,24 +2235,24 @@ static int postProceSql(char *host, struct sockaddr_in *pServAddr, uint16_t port request_buf = malloc(req_buf_len); if (NULL == request_buf) { - errorPrint("%s", "ERROR, cannot allocate memory.\n"); - exit(EXIT_FAILURE); + errorPrint("%s", "ERROR, cannot allocate memory.\n"); + exit(EXIT_FAILURE); } char userpass_buf[INPUT_BUF_LEN]; int mod_table[] = {0, 2, 1}; static char base64[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', - 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', - 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', - 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', - 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', - 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', - 'w', 'x', 'y', 'z', '0', '1', '2', '3', - '4', '5', '6', '7', '8', '9', '+', '/'}; + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', '+', '/'}; snprintf(userpass_buf, INPUT_BUF_LEN, "%s:%s", - g_Dbs.user, g_Dbs.password); + g_Dbs.user, g_Dbs.password); size_t userpass_buf_len = strlen(userpass_buf); size_t encoded_len = 4 * ((userpass_buf_len +2) / 3); @@ -2265,22 +2284,22 @@ static int postProceSql(char *host, struct sockaddr_in *pServAddr, uint16_t port memset(base64_buf, 0, INPUT_BUF_LEN); for (int n = 0, m = 0; n < userpass_buf_len;) { - uint32_t oct_a = n < userpass_buf_len ? - (unsigned char) userpass_buf[n++]:0; - uint32_t oct_b = n < userpass_buf_len ? - (unsigned char) userpass_buf[n++]:0; - uint32_t oct_c = n < userpass_buf_len ? - (unsigned char) userpass_buf[n++]:0; - uint32_t triple = (oct_a << 0x10) + (oct_b << 0x08) + oct_c; + uint32_t oct_a = n < userpass_buf_len ? + (unsigned char) userpass_buf[n++]:0; + uint32_t oct_b = n < userpass_buf_len ? + (unsigned char) userpass_buf[n++]:0; + uint32_t oct_c = n < userpass_buf_len ? + (unsigned char) userpass_buf[n++]:0; + uint32_t triple = (oct_a << 0x10) + (oct_b << 0x08) + oct_c; - base64_buf[m++] = base64[(triple >> 3* 6) & 0x3f]; - base64_buf[m++] = base64[(triple >> 2* 6) & 0x3f]; - base64_buf[m++] = base64[(triple >> 1* 6) & 0x3f]; - base64_buf[m++] = base64[(triple >> 0* 6) & 0x3f]; + base64_buf[m++] = base64[(triple >> 3* 6) & 0x3f]; + base64_buf[m++] = base64[(triple >> 2* 6) & 0x3f]; + base64_buf[m++] = base64[(triple >> 1* 6) & 0x3f]; + base64_buf[m++] = base64[(triple >> 0* 6) & 0x3f]; } for (int l = 0; l < mod_table[userpass_buf_len % 3]; l++) - base64_buf[encoded_len - 1 - l] = '='; + base64_buf[encoded_len - 1 - l] = '='; debugPrint("%s() LN%d: auth string base64 encoded: %s\n", __func__, __LINE__, base64_buf); @@ -2338,7 +2357,7 @@ static int postProceSql(char *host, struct sockaddr_in *pServAddr, uint16_t port printf("Response:\n%s\n", response_buf); if (strlen(pThreadInfo->filePath) > 0) { - appendResultBufToFile(response_buf, pThreadInfo); + appendResultBufToFile(response_buf, pThreadInfo); } free(request_buf); @@ -2367,7 +2386,25 @@ static char* getTagValueFromTagSample(SSuperTable* stbInfo, int tagUsePos) { return dataBuf; } -static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) { +static char *generateBinaryNCharTagValues(int64_t tableSeq, uint32_t len) +{ + char* buf = (char*)calloc(len, 1); + if (NULL == buf) { + printf("calloc failed! size:%d\n", len); + return NULL; + } + + if (tableSeq % 2) { + tstrncpy(buf, "beijing", len); + } else { + tstrncpy(buf, "shanghai", len); + } + //rand_string(buf, stbInfo->tags[i].dataLen); + + return buf; +} + +static char* generateTagValuesForStb(SSuperTable* stbInfo, int64_t tableSeq) { char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1); if (NULL == dataBuf) { printf("calloc failed! size:%d\n", TSDB_MAX_SQL_LEN+1); @@ -2388,20 +2425,12 @@ static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) { return NULL; } - int tagBufLen = stbInfo->tags[i].dataLen + 1; - char* buf = (char*)calloc(tagBufLen, 1); + int32_t tagBufLen = stbInfo->tags[i].dataLen + 1; + char *buf = generateBinaryNCharTagValues(tableSeq, tagBufLen); if (NULL == buf) { - printf("calloc failed! size:%d\n", stbInfo->tags[i].dataLen); tmfree(dataBuf); return NULL; } - - if (tableSeq % 2) { - tstrncpy(buf, "beijing", tagBufLen); - } else { - tstrncpy(buf, "shanghai", tagBufLen); - } - //rand_string(buf, stbInfo->tags[i].dataLen); dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, "\'%s\',", buf); tmfree(buf); @@ -2410,11 +2439,11 @@ static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) { if ((g_args.demo_mode) && (i == 0)) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%d,", tableSeq % 10); + "%"PRId64",", tableSeq % 10); } else { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%d,", tableSeq); + "%"PRId64",", tableSeq); } } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "bigint", strlen("bigint"))) { @@ -2445,7 +2474,7 @@ static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, "%"PRId64",", rand_bigint()); } else { - printf("No support data type: %s\n", stbInfo->tags[i].dataType); + errorPrint("No support data type: %s\n", stbInfo->tags[i].dataType); tmfree(dataBuf); return NULL; } @@ -2457,72 +2486,72 @@ static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) { } static int calcRowLen(SSuperTable* superTbls) { - int colIndex; - int lenOfOneRow = 0; - - for (colIndex = 0; colIndex < superTbls->columnCount; colIndex++) { - char* dataType = superTbls->columns[colIndex].dataType; - - if (strcasecmp(dataType, "BINARY") == 0) { - lenOfOneRow += superTbls->columns[colIndex].dataLen + 3; - } else if (strcasecmp(dataType, "NCHAR") == 0) { - lenOfOneRow += superTbls->columns[colIndex].dataLen + 3; - } else if (strcasecmp(dataType, "INT") == 0) { - lenOfOneRow += 11; - } else if (strcasecmp(dataType, "BIGINT") == 0) { - lenOfOneRow += 21; - } else if (strcasecmp(dataType, "SMALLINT") == 0) { - lenOfOneRow += 6; - } else if (strcasecmp(dataType, "TINYINT") == 0) { - lenOfOneRow += 4; - } else if (strcasecmp(dataType, "BOOL") == 0) { - lenOfOneRow += 6; - } else if (strcasecmp(dataType, "FLOAT") == 0) { - lenOfOneRow += 22; - } else if (strcasecmp(dataType, "DOUBLE") == 0) { - lenOfOneRow += 42; - } else if (strcasecmp(dataType, "TIMESTAMP") == 0) { - lenOfOneRow += 21; - } else { - printf("get error data type : %s\n", dataType); - exit(-1); - } - } - - superTbls->lenOfOneRow = lenOfOneRow + 20; // timestamp - - int tagIndex; - int lenOfTagOfOneRow = 0; - for (tagIndex = 0; tagIndex < superTbls->tagCount; tagIndex++) { - char* dataType = superTbls->tags[tagIndex].dataType; - - if (strcasecmp(dataType, "BINARY") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 3; - } else if (strcasecmp(dataType, "NCHAR") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 3; - } else if (strcasecmp(dataType, "INT") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 11; - } else if (strcasecmp(dataType, "BIGINT") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 21; - } else if (strcasecmp(dataType, "SMALLINT") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 6; - } else if (strcasecmp(dataType, "TINYINT") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 4; - } else if (strcasecmp(dataType, "BOOL") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 6; - } else if (strcasecmp(dataType, "FLOAT") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 22; - } else if (strcasecmp(dataType, "DOUBLE") == 0) { - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 42; - } else { - printf("get error tag type : %s\n", dataType); - exit(-1); + int colIndex; + int lenOfOneRow = 0; + + for (colIndex = 0; colIndex < superTbls->columnCount; colIndex++) { + char* dataType = superTbls->columns[colIndex].dataType; + + if (strcasecmp(dataType, "BINARY") == 0) { + lenOfOneRow += superTbls->columns[colIndex].dataLen + 3; + } else if (strcasecmp(dataType, "NCHAR") == 0) { + lenOfOneRow += superTbls->columns[colIndex].dataLen + 3; + } else if (strcasecmp(dataType, "INT") == 0) { + lenOfOneRow += 11; + } else if (strcasecmp(dataType, "BIGINT") == 0) { + lenOfOneRow += 21; + } else if (strcasecmp(dataType, "SMALLINT") == 0) { + lenOfOneRow += 6; + } else if (strcasecmp(dataType, "TINYINT") == 0) { + lenOfOneRow += 4; + } else if (strcasecmp(dataType, "BOOL") == 0) { + lenOfOneRow += 6; + } else if (strcasecmp(dataType, "FLOAT") == 0) { + lenOfOneRow += 22; + } else if (strcasecmp(dataType, "DOUBLE") == 0) { + lenOfOneRow += 42; + } else if (strcasecmp(dataType, "TIMESTAMP") == 0) { + lenOfOneRow += 21; + } else { + printf("get error data type : %s\n", dataType); + exit(-1); + } } - } - superTbls->lenOfTagOfOneRow = lenOfTagOfOneRow; + superTbls->lenOfOneRow = lenOfOneRow + 20; // timestamp - return 0; + int tagIndex; + int lenOfTagOfOneRow = 0; + for (tagIndex = 0; tagIndex < superTbls->tagCount; tagIndex++) { + char* dataType = superTbls->tags[tagIndex].dataType; + + if (strcasecmp(dataType, "BINARY") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 3; + } else if (strcasecmp(dataType, "NCHAR") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 3; + } else if (strcasecmp(dataType, "INT") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 11; + } else if (strcasecmp(dataType, "BIGINT") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 21; + } else if (strcasecmp(dataType, "SMALLINT") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 6; + } else if (strcasecmp(dataType, "TINYINT") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 4; + } else if (strcasecmp(dataType, "BOOL") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 6; + } else if (strcasecmp(dataType, "FLOAT") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 22; + } else if (strcasecmp(dataType, "DOUBLE") == 0) { + lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 42; + } else { + printf("get error tag type : %s\n", dataType); + exit(-1); + } + } + + superTbls->lenOfTagOfOneRow = lenOfTagOfOneRow; + + return 0; } @@ -2530,84 +2559,84 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos, char* dbName, char* sTblName, char** childTblNameOfSuperTbl, int64_t* childTblCountOfSuperTbl, int64_t limit, uint64_t offset) { - char command[BUFFER_SIZE] = "\0"; - char limitBuf[100] = "\0"; + char command[BUFFER_SIZE] = "\0"; + char limitBuf[100] = "\0"; - TAOS_RES * res; - TAOS_ROW row = NULL; + TAOS_RES * res; + TAOS_ROW row = NULL; - char* childTblName = *childTblNameOfSuperTbl; + char* childTblName = *childTblNameOfSuperTbl; - if (offset >= 0) { - snprintf(limitBuf, 100, " limit %"PRId64" offset %"PRIu64"", - limit, offset); - } + if (offset >= 0) { + snprintf(limitBuf, 100, " limit %"PRId64" offset %"PRIu64"", + limit, offset); + } - //get all child table name use cmd: select tbname from superTblName; - snprintf(command, BUFFER_SIZE, "select tbname from %s.%s %s", - dbName, sTblName, limitBuf); + //get all child table name use cmd: select tbname from superTblName; + snprintf(command, BUFFER_SIZE, "select tbname from %s.%s %s", + dbName, sTblName, limitBuf); - res = taos_query(taos, command); - int32_t code = taos_errno(res); - if (code != 0) { - taos_free_result(res); - taos_close(taos); - errorPrint("%s() LN%d, failed to run command %s\n", - __func__, __LINE__, command); - exit(-1); - } - - int64_t childTblCount = (limit < 0)?10000:limit; - int64_t count = 0; - if (childTblName == NULL) { - childTblName = (char*)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN); - if (NULL == childTblName) { - taos_free_result(res); + res = taos_query(taos, command); + int32_t code = taos_errno(res); + if (code != 0) { + taos_free_result(res); taos_close(taos); - errorPrint("%s() LN%d, failed to allocate memory!\n", __func__, __LINE__); + errorPrint("%s() LN%d, failed to run command %s\n", + __func__, __LINE__, command); exit(-1); } - } - char* pTblName = childTblName; - while((row = taos_fetch_row(res)) != NULL) { - int32_t* len = taos_fetch_lengths(res); - - if (0 == strlen((char *)row[0])) { - errorPrint("%s() LN%d, No.%"PRId64" table return empty name\n", - __func__, __LINE__, count); - exit(-1); + int64_t childTblCount = (limit < 0)?10000:limit; + int64_t count = 0; + if (childTblName == NULL) { + childTblName = (char*)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN); + if (NULL == childTblName) { + taos_free_result(res); + taos_close(taos); + errorPrint("%s() LN%d, failed to allocate memory!\n", __func__, __LINE__); + exit(-1); + } } - tstrncpy(pTblName, (char *)row[0], len[0]+1); - //printf("==== sub table name: %s\n", pTblName); - count++; - if (count >= childTblCount - 1) { - char *tmp = realloc(childTblName, - (size_t)childTblCount*1.5*TSDB_TABLE_NAME_LEN+1); - if (tmp != NULL) { - childTblName = tmp; - childTblCount = (int)(childTblCount*1.5); - memset(childTblName + count*TSDB_TABLE_NAME_LEN, 0, - (size_t)((childTblCount-count)*TSDB_TABLE_NAME_LEN)); - } else { - // exit, if allocate more memory failed - errorPrint("%s() LN%d, realloc fail for save child table name of %s.%s\n", - __func__, __LINE__, dbName, sTblName); - tmfree(childTblName); - taos_free_result(res); - taos_close(taos); - exit(-1); - } + char* pTblName = childTblName; + while((row = taos_fetch_row(res)) != NULL) { + int32_t* len = taos_fetch_lengths(res); + + if (0 == strlen((char *)row[0])) { + errorPrint("%s() LN%d, No.%"PRId64" table return empty name\n", + __func__, __LINE__, count); + exit(-1); + } + + tstrncpy(pTblName, (char *)row[0], len[0]+1); + //printf("==== sub table name: %s\n", pTblName); + count++; + if (count >= childTblCount - 1) { + char *tmp = realloc(childTblName, + (size_t)childTblCount*1.5*TSDB_TABLE_NAME_LEN+1); + if (tmp != NULL) { + childTblName = tmp; + childTblCount = (int)(childTblCount*1.5); + memset(childTblName + count*TSDB_TABLE_NAME_LEN, 0, + (size_t)((childTblCount-count)*TSDB_TABLE_NAME_LEN)); + } else { + // exit, if allocate more memory failed + errorPrint("%s() LN%d, realloc fail for save child table name of %s.%s\n", + __func__, __LINE__, dbName, sTblName); + tmfree(childTblName); + taos_free_result(res); + taos_close(taos); + exit(-1); + } + } + pTblName = childTblName + count * TSDB_TABLE_NAME_LEN; } - pTblName = childTblName + count * TSDB_TABLE_NAME_LEN; - } - *childTblCountOfSuperTbl = count; - *childTblNameOfSuperTbl = childTblName; + *childTblCountOfSuperTbl = count; + *childTblNameOfSuperTbl = childTblName; - taos_free_result(res); - return 0; + taos_free_result(res); + return 0; } static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, @@ -2622,82 +2651,86 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, static int getSuperTableFromServer(TAOS * taos, char* dbName, SSuperTable* superTbls) { - char command[BUFFER_SIZE] = "\0"; - TAOS_RES * res; - TAOS_ROW row = NULL; - int count = 0; - - //get schema use cmd: describe superTblName; - snprintf(command, BUFFER_SIZE, "describe %s.%s", dbName, superTbls->sTblName); - res = taos_query(taos, command); - int32_t code = taos_errno(res); - if (code != 0) { - printf("failed to run command %s\n", command); + char command[BUFFER_SIZE] = "\0"; + TAOS_RES * res; + TAOS_ROW row = NULL; + int count = 0; + + //get schema use cmd: describe superTblName; + snprintf(command, BUFFER_SIZE, "describe %s.%s", dbName, superTbls->sTblName); + res = taos_query(taos, command); + int32_t code = taos_errno(res); + if (code != 0) { + printf("failed to run command %s\n", command); + taos_free_result(res); + return -1; + } + + int tagIndex = 0; + int columnIndex = 0; + TAOS_FIELD *fields = taos_fetch_fields(res); + while((row = taos_fetch_row(res)) != NULL) { + if (0 == count) { + count++; + continue; + } + + if (strcmp((char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX], "TAG") == 0) { + tstrncpy(superTbls->tags[tagIndex].field, + (char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX], + fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes); + tstrncpy(superTbls->tags[tagIndex].dataType, + (char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], + min(DATATYPE_BUFF_LEN, + fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1); + superTbls->tags[tagIndex].dataLen = + *((int *)row[TSDB_DESCRIBE_METRIC_LENGTH_INDEX]); + tstrncpy(superTbls->tags[tagIndex].note, + (char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX], + min(NOTE_BUFF_LEN, + fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes) + 1); + tagIndex++; + } else { + tstrncpy(superTbls->columns[columnIndex].field, + (char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX], + fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes); + tstrncpy(superTbls->columns[columnIndex].dataType, + (char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], + min(DATATYPE_BUFF_LEN, + fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1); + superTbls->columns[columnIndex].dataLen = + *((int *)row[TSDB_DESCRIBE_METRIC_LENGTH_INDEX]); + tstrncpy(superTbls->columns[columnIndex].note, + (char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX], + min(NOTE_BUFF_LEN, + fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes) + 1); + columnIndex++; + } + count++; + } + + superTbls->columnCount = columnIndex; + superTbls->tagCount = tagIndex; taos_free_result(res); - return -1; - } - - int tagIndex = 0; - int columnIndex = 0; - TAOS_FIELD *fields = taos_fetch_fields(res); - while((row = taos_fetch_row(res)) != NULL) { - if (0 == count) { - count++; - continue; - } - - if (strcmp((char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX], "TAG") == 0) { - tstrncpy(superTbls->tags[tagIndex].field, - (char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX], - fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes); - tstrncpy(superTbls->tags[tagIndex].dataType, - (char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], - min(15, fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes)); - superTbls->tags[tagIndex].dataLen = - *((int *)row[TSDB_DESCRIBE_METRIC_LENGTH_INDEX]); - tstrncpy(superTbls->tags[tagIndex].note, - (char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX], - fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes); - tagIndex++; - } else { - tstrncpy(superTbls->columns[columnIndex].field, - (char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX], - fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes); - tstrncpy(superTbls->columns[columnIndex].dataType, - (char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], - min(15, fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes)); - superTbls->columns[columnIndex].dataLen = - *((int *)row[TSDB_DESCRIBE_METRIC_LENGTH_INDEX]); - tstrncpy(superTbls->columns[columnIndex].note, - (char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX], - fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes); - columnIndex++; - } - count++; - } - - superTbls->columnCount = columnIndex; - superTbls->tagCount = tagIndex; - taos_free_result(res); - - calcRowLen(superTbls); -/* - if (TBL_ALREADY_EXISTS == superTbls->childTblExists) { + calcRowLen(superTbls); + + /* + if (TBL_ALREADY_EXISTS == superTbls->childTblExists) { //get all child table name use cmd: select tbname from superTblName; int childTblCount = 10000; superTbls->childTblName = (char*)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN); if (superTbls->childTblName == NULL) { - errorPrint("%s() LN%d, alloc memory failed!\n", __func__, __LINE__); - return -1; + errorPrint("%s() LN%d, alloc memory failed!\n", __func__, __LINE__); + return -1; } getAllChildNameOfSuperTable(taos, dbName, - superTbls->sTblName, - &superTbls->childTblName, - &superTbls->childTblCount); - } - */ - return 0; + superTbls->sTblName, + &superTbls->childTblName, + &superTbls->childTblCount); + } + */ + return 0; } static int createSuperTable( @@ -2733,8 +2766,8 @@ static int createSuperTable( lenOfOneRow += superTbl->columns[colIndex].dataLen + 3; } else if (strcasecmp(dataType, "INT") == 0) { if ((g_args.demo_mode) && (colIndex == 1)) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, - ",VOLTAGE INT"); + len += snprintf(cols + len, COL_BUFFER_LEN - len, + ", VOLTAGE INT"); } else { len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "INT"); } @@ -2756,9 +2789,9 @@ static int createSuperTable( } else if (strcasecmp(dataType, "FLOAT") == 0) { if (g_args.demo_mode) { if (colIndex == 0) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ",CURRENT FLOAT"); + len += snprintf(cols + len, COL_BUFFER_LEN - len, ", CURRENT FLOAT"); } else if (colIndex == 2) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ",PHASE FLOAT"); + len += snprintf(cols + len, COL_BUFFER_LEN - len, ", PHASE FLOAT"); } } else { len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "FLOAT"); @@ -3206,7 +3239,7 @@ static void createChildTables() { continue; } verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, - g_Dbs.db[i].superTbls[j].colsOfCreateChildTable); + g_Dbs.db[i].superTbls[j].colsOfCreateChildTable); uint64_t startFrom = 0; g_totalChildTables += g_Dbs.db[i].superTbls[j].childTblCount; @@ -3254,295 +3287,298 @@ static void createChildTables() { } /* - Read 10000 lines at most. If more than 10000 lines, continue to read after using -*/ + Read 10000 lines at most. If more than 10000 lines, continue to read after using + */ static int readTagFromCsvFileToMem(SSuperTable * superTblInfo) { - size_t n = 0; - ssize_t readLen = 0; - char * line = NULL; - - FILE *fp = fopen(superTblInfo->tagsFile, "r"); - if (fp == NULL) { - printf("Failed to open tags file: %s, reason:%s\n", - superTblInfo->tagsFile, strerror(errno)); - return -1; - } - - if (superTblInfo->tagDataBuf) { - free(superTblInfo->tagDataBuf); - superTblInfo->tagDataBuf = NULL; - } - - int tagCount = 10000; - int count = 0; - char* tagDataBuf = calloc(1, superTblInfo->lenOfTagOfOneRow * tagCount); - if (tagDataBuf == NULL) { - printf("Failed to calloc, reason:%s\n", strerror(errno)); - fclose(fp); - return -1; - } + size_t n = 0; + ssize_t readLen = 0; + char * line = NULL; - while((readLen = tgetline(&line, &n, fp)) != -1) { - if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { - line[--readLen] = 0; + FILE *fp = fopen(superTblInfo->tagsFile, "r"); + if (fp == NULL) { + printf("Failed to open tags file: %s, reason:%s\n", + superTblInfo->tagsFile, strerror(errno)); + return -1; } - if (readLen == 0) { - continue; + if (superTblInfo->tagDataBuf) { + free(superTblInfo->tagDataBuf); + superTblInfo->tagDataBuf = NULL; } - memcpy(tagDataBuf + count * superTblInfo->lenOfTagOfOneRow, line, readLen); - count++; - - if (count >= tagCount - 1) { - char *tmp = realloc(tagDataBuf, - (size_t)tagCount*1.5*superTblInfo->lenOfTagOfOneRow); - if (tmp != NULL) { - tagDataBuf = tmp; - tagCount = (int)(tagCount*1.5); - memset(tagDataBuf + count*superTblInfo->lenOfTagOfOneRow, - 0, (size_t)((tagCount-count)*superTblInfo->lenOfTagOfOneRow)); - } else { - // exit, if allocate more memory failed - printf("realloc fail for save tag val from %s\n", superTblInfo->tagsFile); - tmfree(tagDataBuf); - free(line); + int tagCount = 10000; + int count = 0; + char* tagDataBuf = calloc(1, superTblInfo->lenOfTagOfOneRow * tagCount); + if (tagDataBuf == NULL) { + printf("Failed to calloc, reason:%s\n", strerror(errno)); fclose(fp); return -1; - } } - } - superTblInfo->tagDataBuf = tagDataBuf; - superTblInfo->tagSampleCount = count; + while((readLen = tgetline(&line, &n, fp)) != -1) { + if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { + line[--readLen] = 0; + } + + if (readLen == 0) { + continue; + } + + memcpy(tagDataBuf + count * superTblInfo->lenOfTagOfOneRow, line, readLen); + count++; + + if (count >= tagCount - 1) { + char *tmp = realloc(tagDataBuf, + (size_t)tagCount*1.5*superTblInfo->lenOfTagOfOneRow); + if (tmp != NULL) { + tagDataBuf = tmp; + tagCount = (int)(tagCount*1.5); + memset(tagDataBuf + count*superTblInfo->lenOfTagOfOneRow, + 0, (size_t)((tagCount-count)*superTblInfo->lenOfTagOfOneRow)); + } else { + // exit, if allocate more memory failed + printf("realloc fail for save tag val from %s\n", superTblInfo->tagsFile); + tmfree(tagDataBuf); + free(line); + fclose(fp); + return -1; + } + } + } + + superTblInfo->tagDataBuf = tagDataBuf; + superTblInfo->tagSampleCount = count; - free(line); - fclose(fp); - return 0; + free(line); + fclose(fp); + return 0; } /* - Read 10000 lines at most. If more than 10000 lines, continue to read after using -*/ + Read 10000 lines at most. If more than 10000 lines, continue to read after using + */ static int readSampleFromCsvFileToMem( SSuperTable* superTblInfo) { - size_t n = 0; - ssize_t readLen = 0; - char * line = NULL; - int getRows = 0; - - FILE* fp = fopen(superTblInfo->sampleFile, "r"); - if (fp == NULL) { - errorPrint( "Failed to open sample file: %s, reason:%s\n", - superTblInfo->sampleFile, strerror(errno)); - return -1; - } - - assert(superTblInfo->sampleDataBuf); - memset(superTblInfo->sampleDataBuf, 0, - MAX_SAMPLES_ONCE_FROM_FILE * superTblInfo->lenOfOneRow); - while(1) { - readLen = tgetline(&line, &n, fp); - if (-1 == readLen) { - if(0 != fseek(fp, 0, SEEK_SET)) { - errorPrint( "Failed to fseek file: %s, reason:%s\n", + size_t n = 0; + ssize_t readLen = 0; + char * line = NULL; + int getRows = 0; + + FILE* fp = fopen(superTblInfo->sampleFile, "r"); + if (fp == NULL) { + errorPrint( "Failed to open sample file: %s, reason:%s\n", superTblInfo->sampleFile, strerror(errno)); - fclose(fp); return -1; - } - continue; } - if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { - line[--readLen] = 0; - } + assert(superTblInfo->sampleDataBuf); + memset(superTblInfo->sampleDataBuf, 0, + MAX_SAMPLES_ONCE_FROM_FILE * superTblInfo->lenOfOneRow); + while(1) { + readLen = tgetline(&line, &n, fp); + if (-1 == readLen) { + if(0 != fseek(fp, 0, SEEK_SET)) { + errorPrint( "Failed to fseek file: %s, reason:%s\n", + superTblInfo->sampleFile, strerror(errno)); + fclose(fp); + return -1; + } + continue; + } - if (readLen == 0) { - continue; - } + if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { + line[--readLen] = 0; + } - if (readLen > superTblInfo->lenOfOneRow) { - printf("sample row len[%d] overflow define schema len[%"PRIu64"], so discard this row\n", - (int32_t)readLen, superTblInfo->lenOfOneRow); - continue; - } + if (readLen == 0) { + continue; + } + + if (readLen > superTblInfo->lenOfOneRow) { + printf("sample row len[%d] overflow define schema len[%"PRIu64"], so discard this row\n", + (int32_t)readLen, superTblInfo->lenOfOneRow); + continue; + } - memcpy(superTblInfo->sampleDataBuf + getRows * superTblInfo->lenOfOneRow, - line, readLen); - getRows++; + memcpy(superTblInfo->sampleDataBuf + getRows * superTblInfo->lenOfOneRow, + line, readLen); + getRows++; - if (getRows == MAX_SAMPLES_ONCE_FROM_FILE) { - break; + if (getRows == MAX_SAMPLES_ONCE_FROM_FILE) { + break; + } } - } - fclose(fp); - tmfree(line); - return 0; + fclose(fp); + tmfree(line); + return 0; } static bool getColumnAndTagTypeFromInsertJsonFile( cJSON* stbInfo, SSuperTable* superTbls) { - bool ret = false; - - // columns - cJSON *columns = cJSON_GetObjectItem(stbInfo, "columns"); - if (columns && columns->type != cJSON_Array) { - printf("ERROR: failed to read json, columns not found\n"); - goto PARSE_OVER; - } else if (NULL == columns) { - superTbls->columnCount = 0; - superTbls->tagCount = 0; - return true; - } + bool ret = false; + + // columns + cJSON *columns = cJSON_GetObjectItem(stbInfo, "columns"); + if (columns && columns->type != cJSON_Array) { + printf("ERROR: failed to read json, columns not found\n"); + goto PARSE_OVER; + } else if (NULL == columns) { + superTbls->columnCount = 0; + superTbls->tagCount = 0; + return true; + } + + int columnSize = cJSON_GetArraySize(columns); + if ((columnSize + 1/* ts */) > TSDB_MAX_COLUMNS) { + errorPrint("%s() LN%d, failed to read json, column size overflow, max column size is %d\n", + __func__, __LINE__, TSDB_MAX_COLUMNS); + goto PARSE_OVER; + } - int columnSize = cJSON_GetArraySize(columns); - if ((columnSize + 1/* ts */) > TSDB_MAX_COLUMNS) { - errorPrint("%s() LN%d, failed to read json, column size overflow, max column size is %d\n", - __func__, __LINE__, TSDB_MAX_COLUMNS); - goto PARSE_OVER; - } + int count = 1; + int index = 0; + StrColumn columnCase; - int count = 1; - int index = 0; - StrColumn columnCase; + //superTbls->columnCount = columnSize; + for (int k = 0; k < columnSize; ++k) { + cJSON* column = cJSON_GetArrayItem(columns, k); + if (column == NULL) continue; - //superTbls->columnCount = columnSize; - for (int k = 0; k < columnSize; ++k) { - cJSON* column = cJSON_GetArrayItem(columns, k); - if (column == NULL) continue; + count = 1; + cJSON* countObj = cJSON_GetObjectItem(column, "count"); + if (countObj && countObj->type == cJSON_Number) { + count = countObj->valueint; + } else if (countObj && countObj->type != cJSON_Number) { + errorPrint("%s() LN%d, failed to read json, column count not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } else { + count = 1; + } - count = 1; - cJSON* countObj = cJSON_GetObjectItem(column, "count"); - if (countObj && countObj->type == cJSON_Number) { - count = countObj->valueint; - } else if (countObj && countObj->type != cJSON_Number) { - errorPrint("%s() LN%d, failed to read json, column count not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } else { - count = 1; - } - - // column info - memset(&columnCase, 0, sizeof(StrColumn)); - cJSON *dataType = cJSON_GetObjectItem(column, "type"); - if (!dataType || dataType->type != cJSON_String - || dataType->valuestring == NULL) { - errorPrint("%s() LN%d: failed to read json, column type not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } - //tstrncpy(superTbls->columns[k].dataType, dataType->valuestring, MAX_TB_NAME_SIZE); - tstrncpy(columnCase.dataType, dataType->valuestring, strlen(dataType->valuestring) + 1); - - cJSON* dataLen = cJSON_GetObjectItem(column, "len"); - if (dataLen && dataLen->type == cJSON_Number) { - columnCase.dataLen = dataLen->valueint; - } else if (dataLen && dataLen->type != cJSON_Number) { - debugPrint("%s() LN%d: failed to read json, column len not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } else { - columnCase.dataLen = 8; - } - - for (int n = 0; n < count; ++n) { - tstrncpy(superTbls->columns[index].dataType, - columnCase.dataType, strlen(columnCase.dataType) + 1); - superTbls->columns[index].dataLen = columnCase.dataLen; - index++; - } - } - - if ((index + 1 /* ts */) > MAX_NUM_COLUMNS) { - errorPrint("%s() LN%d, failed to read json, column size overflow, allowed max column size is %d\n", - __func__, __LINE__, MAX_NUM_COLUMNS); - goto PARSE_OVER; - } - - superTbls->columnCount = index; - - count = 1; - index = 0; - // tags - cJSON *tags = cJSON_GetObjectItem(stbInfo, "tags"); - if (!tags || tags->type != cJSON_Array) { - errorPrint("%s() LN%d, failed to read json, tags not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } - - int tagSize = cJSON_GetArraySize(tags); - if (tagSize > TSDB_MAX_TAGS) { - errorPrint("%s() LN%d, failed to read json, tags size overflow, max tag size is %d\n", - __func__, __LINE__, TSDB_MAX_TAGS); - goto PARSE_OVER; - } - - //superTbls->tagCount = tagSize; - for (int k = 0; k < tagSize; ++k) { - cJSON* tag = cJSON_GetArrayItem(tags, k); - if (tag == NULL) continue; + // column info + memset(&columnCase, 0, sizeof(StrColumn)); + cJSON *dataType = cJSON_GetObjectItem(column, "type"); + if (!dataType || dataType->type != cJSON_String + || dataType->valuestring == NULL) { + errorPrint("%s() LN%d: failed to read json, column type not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } + //tstrncpy(superTbls->columns[k].dataType, dataType->valuestring, DATATYPE_BUFF_LEN); + tstrncpy(columnCase.dataType, dataType->valuestring, + min(DATATYPE_BUFF_LEN, strlen(dataType->valuestring) + 1)); + + cJSON* dataLen = cJSON_GetObjectItem(column, "len"); + if (dataLen && dataLen->type == cJSON_Number) { + columnCase.dataLen = dataLen->valueint; + } else if (dataLen && dataLen->type != cJSON_Number) { + debugPrint("%s() LN%d: failed to read json, column len not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } else { + columnCase.dataLen = SMALL_BUFF_LEN; + } + + for (int n = 0; n < count; ++n) { + tstrncpy(superTbls->columns[index].dataType, + columnCase.dataType, + min(DATATYPE_BUFF_LEN, strlen(columnCase.dataType) + 1)); + superTbls->columns[index].dataLen = columnCase.dataLen; + index++; + } + } + + if ((index + 1 /* ts */) > MAX_NUM_COLUMNS) { + errorPrint("%s() LN%d, failed to read json, column size overflow, allowed max column size is %d\n", + __func__, __LINE__, MAX_NUM_COLUMNS); + goto PARSE_OVER; + } + + superTbls->columnCount = index; count = 1; - cJSON* countObj = cJSON_GetObjectItem(tag, "count"); - if (countObj && countObj->type == cJSON_Number) { - count = countObj->valueint; - } else if (countObj && countObj->type != cJSON_Number) { - printf("ERROR: failed to read json, column count not found\n"); - goto PARSE_OVER; - } else { - count = 1; - } - - // column info - memset(&columnCase, 0, sizeof(StrColumn)); - cJSON *dataType = cJSON_GetObjectItem(tag, "type"); - if (!dataType || dataType->type != cJSON_String - || dataType->valuestring == NULL) { - errorPrint("%s() LN%d, failed to read json, tag type not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } - tstrncpy(columnCase.dataType, dataType->valuestring, strlen(dataType->valuestring) + 1); - - cJSON* dataLen = cJSON_GetObjectItem(tag, "len"); - if (dataLen && dataLen->type == cJSON_Number) { - columnCase.dataLen = dataLen->valueint; - } else if (dataLen && dataLen->type != cJSON_Number) { - errorPrint("%s() LN%d, failed to read json, column len not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } else { - columnCase.dataLen = 0; + index = 0; + // tags + cJSON *tags = cJSON_GetObjectItem(stbInfo, "tags"); + if (!tags || tags->type != cJSON_Array) { + errorPrint("%s() LN%d, failed to read json, tags not found\n", + __func__, __LINE__); + goto PARSE_OVER; } - for (int n = 0; n < count; ++n) { - tstrncpy(superTbls->tags[index].dataType, columnCase.dataType, - strlen(columnCase.dataType) + 1); - superTbls->tags[index].dataLen = columnCase.dataLen; - index++; + int tagSize = cJSON_GetArraySize(tags); + if (tagSize > TSDB_MAX_TAGS) { + errorPrint("%s() LN%d, failed to read json, tags size overflow, max tag size is %d\n", + __func__, __LINE__, TSDB_MAX_TAGS); + goto PARSE_OVER; + } + + //superTbls->tagCount = tagSize; + for (int k = 0; k < tagSize; ++k) { + cJSON* tag = cJSON_GetArrayItem(tags, k); + if (tag == NULL) continue; + + count = 1; + cJSON* countObj = cJSON_GetObjectItem(tag, "count"); + if (countObj && countObj->type == cJSON_Number) { + count = countObj->valueint; + } else if (countObj && countObj->type != cJSON_Number) { + printf("ERROR: failed to read json, column count not found\n"); + goto PARSE_OVER; + } else { + count = 1; + } + + // column info + memset(&columnCase, 0, sizeof(StrColumn)); + cJSON *dataType = cJSON_GetObjectItem(tag, "type"); + if (!dataType || dataType->type != cJSON_String + || dataType->valuestring == NULL) { + errorPrint("%s() LN%d, failed to read json, tag type not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } + tstrncpy(columnCase.dataType, dataType->valuestring, + min(DATATYPE_BUFF_LEN, strlen(dataType->valuestring) + 1)); + + cJSON* dataLen = cJSON_GetObjectItem(tag, "len"); + if (dataLen && dataLen->type == cJSON_Number) { + columnCase.dataLen = dataLen->valueint; + } else if (dataLen && dataLen->type != cJSON_Number) { + errorPrint("%s() LN%d, failed to read json, column len not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } else { + columnCase.dataLen = 0; + } + + for (int n = 0; n < count; ++n) { + tstrncpy(superTbls->tags[index].dataType, columnCase.dataType, + min(DATATYPE_BUFF_LEN, strlen(columnCase.dataType) + 1)); + superTbls->tags[index].dataLen = columnCase.dataLen; + index++; + } } - } - if (index > TSDB_MAX_TAGS) { - errorPrint("%s() LN%d, failed to read json, tags size overflow, allowed max tag count is %d\n", - __func__, __LINE__, TSDB_MAX_TAGS); - goto PARSE_OVER; - } + if (index > TSDB_MAX_TAGS) { + errorPrint("%s() LN%d, failed to read json, tags size overflow, allowed max tag count is %d\n", + __func__, __LINE__, TSDB_MAX_TAGS); + goto PARSE_OVER; + } - superTbls->tagCount = index; + superTbls->tagCount = index; - if ((superTbls->columnCount + superTbls->tagCount + 1 /* ts */) > TSDB_MAX_COLUMNS) { - errorPrint("%s() LN%d, columns + tags is more than allowed max columns count: %d\n", - __func__, __LINE__, TSDB_MAX_COLUMNS); - goto PARSE_OVER; - } - ret = true; + if ((superTbls->columnCount + superTbls->tagCount + 1 /* ts */) > TSDB_MAX_COLUMNS) { + errorPrint("%s() LN%d, columns + tags is more than allowed max columns count: %d\n", + __func__, __LINE__, TSDB_MAX_COLUMNS); + goto PARSE_OVER; + } + ret = true; PARSE_OVER: - return ret; + return ret; } static bool getMetaFromInsertJsonFile(cJSON* root) { @@ -3764,9 +3800,9 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { if (precision && precision->type == cJSON_String && precision->valuestring != NULL) { tstrncpy(g_Dbs.db[i].dbCfg.precision, precision->valuestring, - 8); + SMALL_BUFF_LEN); } else if (!precision) { - memset(g_Dbs.db[i].dbCfg.precision, 0, 8); + memset(g_Dbs.db[i].dbCfg.precision, 0, SMALL_BUFF_LEN); } else { printf("ERROR: failed to read json, precision not found\n"); goto PARSE_OVER; @@ -3951,7 +3987,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { goto PARSE_OVER; } tstrncpy(g_Dbs.db[i].superTbls[j].childTblPrefix, prefix->valuestring, - TSDB_TABLE_NAME_LEN - 20); + TBNAME_PREFIX_LEN); cJSON *autoCreateTbl = cJSON_GetObjectItem(stbInfo, "auto_create_table"); if (autoCreateTbl @@ -4019,9 +4055,11 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { if (dataSource && dataSource->type == cJSON_String && dataSource->valuestring != NULL) { tstrncpy(g_Dbs.db[i].superTbls[j].dataSource, - dataSource->valuestring, TSDB_DB_NAME_LEN); + dataSource->valuestring, + min(SMALL_BUFF_LEN, strlen(dataSource->valuestring) + 1)); } else if (!dataSource) { - tstrncpy(g_Dbs.db[i].superTbls[j].dataSource, "rand", TSDB_DB_NAME_LEN); + tstrncpy(g_Dbs.db[i].superTbls[j].dataSource, "rand", + min(SMALL_BUFF_LEN, strlen("rand") + 1)); } else { errorPrint("%s() LN%d, failed to read json, data_source not found\n", __func__, __LINE__); @@ -4092,7 +4130,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { if (timestampStep && timestampStep->type == cJSON_Number) { g_Dbs.db[i].superTbls[j].timeStampStep = timestampStep->valueint; } else if (!timestampStep) { - g_Dbs.db[i].superTbls[j].timeStampStep = DEFAULT_TIMESTAMP_STEP; + g_Dbs.db[i].superTbls[j].timeStampStep = g_args.timestamp_step; } else { printf("ERROR: failed to read json, timestamp_step not found\n"); goto PARSE_OVER; @@ -4102,9 +4140,12 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { if (sampleFormat && sampleFormat->type == cJSON_String && sampleFormat->valuestring != NULL) { tstrncpy(g_Dbs.db[i].superTbls[j].sampleFormat, - sampleFormat->valuestring, TSDB_DB_NAME_LEN); + sampleFormat->valuestring, + min(SMALL_BUFF_LEN, + strlen(sampleFormat->valuestring) + 1)); } else if (!sampleFormat) { - tstrncpy(g_Dbs.db[i].superTbls[j].sampleFormat, "csv", TSDB_DB_NAME_LEN); + tstrncpy(g_Dbs.db[i].superTbls[j].sampleFormat, "csv", + SMALL_BUFF_LEN); } else { printf("ERROR: failed to read json, sample_format not found\n"); goto PARSE_OVER; @@ -4114,9 +4155,12 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { if (sampleFile && sampleFile->type == cJSON_String && sampleFile->valuestring != NULL) { tstrncpy(g_Dbs.db[i].superTbls[j].sampleFile, - sampleFile->valuestring, MAX_FILE_NAME_LEN); + sampleFile->valuestring, + min(MAX_FILE_NAME_LEN, + strlen(sampleFile->valuestring) + 1)); } else if (!sampleFile) { - memset(g_Dbs.db[i].superTbls[j].sampleFile, 0, MAX_FILE_NAME_LEN); + memset(g_Dbs.db[i].superTbls[j].sampleFile, 0, + MAX_FILE_NAME_LEN); } else { printf("ERROR: failed to read json, sample_file not found\n"); goto PARSE_OVER; @@ -4276,582 +4320,586 @@ PARSE_OVER: } static bool getMetaFromQueryJsonFile(cJSON* root) { - bool ret = false; + bool ret = false; - cJSON* cfgdir = cJSON_GetObjectItem(root, "cfgdir"); - if (cfgdir && cfgdir->type == cJSON_String && cfgdir->valuestring != NULL) { - tstrncpy(g_queryInfo.cfgDir, cfgdir->valuestring, MAX_FILE_NAME_LEN); - } + cJSON* cfgdir = cJSON_GetObjectItem(root, "cfgdir"); + if (cfgdir && cfgdir->type == cJSON_String && cfgdir->valuestring != NULL) { + tstrncpy(g_queryInfo.cfgDir, cfgdir->valuestring, MAX_FILE_NAME_LEN); + } - cJSON* host = cJSON_GetObjectItem(root, "host"); - if (host && host->type == cJSON_String && host->valuestring != NULL) { - tstrncpy(g_queryInfo.host, host->valuestring, MAX_HOSTNAME_SIZE); - } else if (!host) { - tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE); - } else { - printf("ERROR: failed to read json, host not found\n"); - goto PARSE_OVER; - } - - cJSON* port = cJSON_GetObjectItem(root, "port"); - if (port && port->type == cJSON_Number) { - g_queryInfo.port = port->valueint; - } else if (!port) { - g_queryInfo.port = 6030; - } - - cJSON* user = cJSON_GetObjectItem(root, "user"); - if (user && user->type == cJSON_String && user->valuestring != NULL) { - tstrncpy(g_queryInfo.user, user->valuestring, MAX_USERNAME_SIZE); - } else if (!user) { - tstrncpy(g_queryInfo.user, "root", MAX_USERNAME_SIZE); ; - } - - cJSON* password = cJSON_GetObjectItem(root, "password"); - if (password && password->type == cJSON_String && password->valuestring != NULL) { - tstrncpy(g_queryInfo.password, password->valuestring, MAX_PASSWORD_SIZE); - } else if (!password) { - tstrncpy(g_queryInfo.password, "taosdata", MAX_PASSWORD_SIZE);; - } - - cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no, - if (answerPrompt && answerPrompt->type == cJSON_String - && answerPrompt->valuestring != NULL) { - if (0 == strncasecmp(answerPrompt->valuestring, "yes", 3)) { - g_args.answer_yes = false; - } else if (0 == strncasecmp(answerPrompt->valuestring, "no", 2)) { - g_args.answer_yes = true; + cJSON* host = cJSON_GetObjectItem(root, "host"); + if (host && host->type == cJSON_String && host->valuestring != NULL) { + tstrncpy(g_queryInfo.host, host->valuestring, MAX_HOSTNAME_SIZE); + } else if (!host) { + tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE); } else { - g_args.answer_yes = false; - } - } else if (!answerPrompt) { - g_args.answer_yes = false; - } else { - printf("ERROR: failed to read json, confirm_parameter_prompt not found\n"); - goto PARSE_OVER; - } - - cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times"); - if (gQueryTimes && gQueryTimes->type == cJSON_Number) { - if (gQueryTimes->valueint <= 0) { - errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; - } - g_args.query_times = gQueryTimes->valueint; - } else if (!gQueryTimes) { - g_args.query_times = 1; - } else { - errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; - } - - cJSON* dbs = cJSON_GetObjectItem(root, "databases"); - if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) { - tstrncpy(g_queryInfo.dbName, dbs->valuestring, TSDB_DB_NAME_LEN); - } else if (!dbs) { - printf("ERROR: failed to read json, databases not found\n"); - goto PARSE_OVER; - } - - cJSON* queryMode = cJSON_GetObjectItem(root, "query_mode"); - if (queryMode && queryMode->type == cJSON_String && queryMode->valuestring != NULL) { - tstrncpy(g_queryInfo.queryMode, queryMode->valuestring, MAX_TB_NAME_SIZE); - } else if (!queryMode) { - tstrncpy(g_queryInfo.queryMode, "taosc", MAX_TB_NAME_SIZE); - } else { - printf("ERROR: failed to read json, query_mode not found\n"); - goto PARSE_OVER; - } - - // specified_table_query - cJSON *specifiedQuery = cJSON_GetObjectItem(root, "specified_table_query"); - if (!specifiedQuery) { - g_queryInfo.specifiedQueryInfo.concurrent = 1; - g_queryInfo.specifiedQueryInfo.sqlCount = 0; - } else if (specifiedQuery->type != cJSON_Object) { - printf("ERROR: failed to read json, super_table_query not found\n"); - goto PARSE_OVER; - } else { - cJSON* queryInterval = cJSON_GetObjectItem(specifiedQuery, "query_interval"); - if (queryInterval && queryInterval->type == cJSON_Number) { - g_queryInfo.specifiedQueryInfo.queryInterval = queryInterval->valueint; - } else if (!queryInterval) { - g_queryInfo.specifiedQueryInfo.queryInterval = 0; - } - - cJSON* specifiedQueryTimes = cJSON_GetObjectItem(specifiedQuery, - "query_times"); - if (specifiedQueryTimes && specifiedQueryTimes->type == cJSON_Number) { - if (specifiedQueryTimes->valueint <= 0) { - errorPrint( - "%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n", - __func__, __LINE__, specifiedQueryTimes->valueint); + printf("ERROR: failed to read json, host not found\n"); goto PARSE_OVER; + } - } - g_queryInfo.specifiedQueryInfo.queryTimes = specifiedQueryTimes->valueint; - } else if (!specifiedQueryTimes) { - g_queryInfo.specifiedQueryInfo.queryTimes = g_args.query_times; - } else { - errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; + cJSON* port = cJSON_GetObjectItem(root, "port"); + if (port && port->type == cJSON_Number) { + g_queryInfo.port = port->valueint; + } else if (!port) { + g_queryInfo.port = 6030; } - cJSON* concurrent = cJSON_GetObjectItem(specifiedQuery, "concurrent"); - if (concurrent && concurrent->type == cJSON_Number) { - if (concurrent->valueint <= 0) { - errorPrint( - "%s() LN%d, query sqlCount %d or concurrent %d is not correct.\n", - __func__, __LINE__, - g_queryInfo.specifiedQueryInfo.sqlCount, - g_queryInfo.specifiedQueryInfo.concurrent); - goto PARSE_OVER; - } - g_queryInfo.specifiedQueryInfo.concurrent = concurrent->valueint; - } else if (!concurrent) { - g_queryInfo.specifiedQueryInfo.concurrent = 1; - } - - cJSON* specifiedAsyncMode = cJSON_GetObjectItem(specifiedQuery, "mode"); - if (specifiedAsyncMode && specifiedAsyncMode->type == cJSON_String - && specifiedAsyncMode->valuestring != NULL) { - if (0 == strcmp("sync", specifiedAsyncMode->valuestring)) { - g_queryInfo.specifiedQueryInfo.asyncMode = SYNC_MODE; - } else if (0 == strcmp("async", specifiedAsyncMode->valuestring)) { - g_queryInfo.specifiedQueryInfo.asyncMode = ASYNC_MODE; - } else { - errorPrint("%s() LN%d, failed to read json, async mode input error\n", - __func__, __LINE__); - goto PARSE_OVER; - } - } else { - g_queryInfo.specifiedQueryInfo.asyncMode = SYNC_MODE; - } - - cJSON* interval = cJSON_GetObjectItem(specifiedQuery, "interval"); - if (interval && interval->type == cJSON_Number) { - g_queryInfo.specifiedQueryInfo.subscribeInterval = interval->valueint; - } else if (!interval) { - //printf("failed to read json, subscribe interval no found\n"); - //goto PARSE_OVER; - g_queryInfo.specifiedQueryInfo.subscribeInterval = 10000; - } - - cJSON* restart = cJSON_GetObjectItem(specifiedQuery, "restart"); - if (restart && restart->type == cJSON_String && restart->valuestring != NULL) { - if (0 == strcmp("yes", restart->valuestring)) { - g_queryInfo.specifiedQueryInfo.subscribeRestart = true; - } else if (0 == strcmp("no", restart->valuestring)) { - g_queryInfo.specifiedQueryInfo.subscribeRestart = false; - } else { - printf("ERROR: failed to read json, subscribe restart error\n"); - goto PARSE_OVER; - } - } else { - g_queryInfo.specifiedQueryInfo.subscribeRestart = true; - } - - cJSON* keepProgress = cJSON_GetObjectItem(specifiedQuery, "keepProgress"); - if (keepProgress - && keepProgress->type == cJSON_String - && keepProgress->valuestring != NULL) { - if (0 == strcmp("yes", keepProgress->valuestring)) { - g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 1; - } else if (0 == strcmp("no", keepProgress->valuestring)) { - g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 0; - } else { - printf("ERROR: failed to read json, subscribe keepProgress error\n"); - goto PARSE_OVER; - } - } else { - g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 0; + cJSON* user = cJSON_GetObjectItem(root, "user"); + if (user && user->type == cJSON_String && user->valuestring != NULL) { + tstrncpy(g_queryInfo.user, user->valuestring, MAX_USERNAME_SIZE); + } else if (!user) { + tstrncpy(g_queryInfo.user, "root", MAX_USERNAME_SIZE); ; } - // sqls - cJSON* specifiedSqls = cJSON_GetObjectItem(specifiedQuery, "sqls"); - if (!specifiedSqls) { - g_queryInfo.specifiedQueryInfo.sqlCount = 0; - } else if (specifiedSqls->type != cJSON_Array) { - errorPrint("%s() LN%d, failed to read json, super sqls not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } else { - int superSqlSize = cJSON_GetArraySize(specifiedSqls); - if (superSqlSize * g_queryInfo.specifiedQueryInfo.concurrent - > MAX_QUERY_SQL_COUNT) { - errorPrint("%s() LN%d, failed to read json, query sql(%d) * concurrent(%d) overflow, max is %d\n", - __func__, __LINE__, - superSqlSize, - g_queryInfo.specifiedQueryInfo.concurrent, - MAX_QUERY_SQL_COUNT); - goto PARSE_OVER; - } - - g_queryInfo.specifiedQueryInfo.sqlCount = superSqlSize; - for (int j = 0; j < superSqlSize; ++j) { - cJSON* sql = cJSON_GetArrayItem(specifiedSqls, j); - if (sql == NULL) continue; - - cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql"); - if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) { - printf("ERROR: failed to read json, sql not found\n"); - goto PARSE_OVER; - } - tstrncpy(g_queryInfo.specifiedQueryInfo.sql[j], - sqlStr->valuestring, MAX_QUERY_SQL_LENGTH); - - // default value is -1, which mean infinite loop - g_queryInfo.specifiedQueryInfo.endAfterConsume[j] = -1; - cJSON* endAfterConsume = - cJSON_GetObjectItem(specifiedQuery, "endAfterConsume"); - if (endAfterConsume - && endAfterConsume->type == cJSON_Number) { - g_queryInfo.specifiedQueryInfo.endAfterConsume[j] - = endAfterConsume->valueint; - } - if (g_queryInfo.specifiedQueryInfo.endAfterConsume[j] < -1) - g_queryInfo.specifiedQueryInfo.endAfterConsume[j] = -1; - - g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] = -1; - cJSON* resubAfterConsume = - cJSON_GetObjectItem(specifiedQuery, "resubAfterConsume"); - if ((resubAfterConsume) - && (resubAfterConsume->type == cJSON_Number) - && (resubAfterConsume->valueint >= 0)) { - g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] - = resubAfterConsume->valueint; - } - - if (g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] < -1) - g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] = -1; - - cJSON *result = cJSON_GetObjectItem(sql, "result"); - if ((NULL != result) && (result->type == cJSON_String) - && (result->valuestring != NULL)) { - tstrncpy(g_queryInfo.specifiedQueryInfo.result[j], - result->valuestring, MAX_FILE_NAME_LEN); - } else if (NULL == result) { - memset(g_queryInfo.specifiedQueryInfo.result[j], - 0, MAX_FILE_NAME_LEN); + cJSON* password = cJSON_GetObjectItem(root, "password"); + if (password && password->type == cJSON_String && password->valuestring != NULL) { + tstrncpy(g_queryInfo.password, password->valuestring, MAX_PASSWORD_SIZE); + } else if (!password) { + tstrncpy(g_queryInfo.password, "taosdata", MAX_PASSWORD_SIZE);; + } + + cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no, + if (answerPrompt && answerPrompt->type == cJSON_String + && answerPrompt->valuestring != NULL) { + if (0 == strncasecmp(answerPrompt->valuestring, "yes", 3)) { + g_args.answer_yes = false; + } else if (0 == strncasecmp(answerPrompt->valuestring, "no", 2)) { + g_args.answer_yes = true; } else { - printf("ERROR: failed to read json, super query result file not found\n"); - goto PARSE_OVER; + g_args.answer_yes = false; } - } + } else if (!answerPrompt) { + g_args.answer_yes = false; + } else { + printf("ERROR: failed to read json, confirm_parameter_prompt not found\n"); + goto PARSE_OVER; } - } - // super_table_query - cJSON *superQuery = cJSON_GetObjectItem(root, "super_table_query"); - if (!superQuery) { - g_queryInfo.superQueryInfo.threadCnt = 1; - g_queryInfo.superQueryInfo.sqlCount = 0; - } else if (superQuery->type != cJSON_Object) { - printf("ERROR: failed to read json, sub_table_query not found\n"); - ret = true; - goto PARSE_OVER; - } else { - cJSON* subrate = cJSON_GetObjectItem(superQuery, "query_interval"); - if (subrate && subrate->type == cJSON_Number) { - g_queryInfo.superQueryInfo.queryInterval = subrate->valueint; - } else if (!subrate) { - g_queryInfo.superQueryInfo.queryInterval = 0; - } - - cJSON* superQueryTimes = cJSON_GetObjectItem(superQuery, "query_times"); - if (superQueryTimes && superQueryTimes->type == cJSON_Number) { - if (superQueryTimes->valueint <= 0) { - errorPrint("%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n", - __func__, __LINE__, superQueryTimes->valueint); - goto PARSE_OVER; - } - g_queryInfo.superQueryInfo.queryTimes = superQueryTimes->valueint; - } else if (!superQueryTimes) { - g_queryInfo.superQueryInfo.queryTimes = g_args.query_times; + cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times"); + if (gQueryTimes && gQueryTimes->type == cJSON_Number) { + if (gQueryTimes->valueint <= 0) { + errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + } + g_args.query_times = gQueryTimes->valueint; + } else if (!gQueryTimes) { + g_args.query_times = 1; } else { - errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; + errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; } - cJSON* threads = cJSON_GetObjectItem(superQuery, "threads"); - if (threads && threads->type == cJSON_Number) { - if (threads->valueint <= 0) { - errorPrint("%s() LN%d, failed to read json, threads input mistake\n", - __func__, __LINE__); + cJSON* dbs = cJSON_GetObjectItem(root, "databases"); + if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) { + tstrncpy(g_queryInfo.dbName, dbs->valuestring, TSDB_DB_NAME_LEN); + } else if (!dbs) { + printf("ERROR: failed to read json, databases not found\n"); goto PARSE_OVER; - - } - g_queryInfo.superQueryInfo.threadCnt = threads->valueint; - } else if (!threads) { - g_queryInfo.superQueryInfo.threadCnt = 1; } - //cJSON* subTblCnt = cJSON_GetObjectItem(superQuery, "childtable_count"); - //if (subTblCnt && subTblCnt->type == cJSON_Number) { - // g_queryInfo.superQueryInfo.childTblCount = subTblCnt->valueint; - //} else if (!subTblCnt) { - // g_queryInfo.superQueryInfo.childTblCount = 0; - //} - - cJSON* stblname = cJSON_GetObjectItem(superQuery, "stblname"); - if (stblname && stblname->type == cJSON_String - && stblname->valuestring != NULL) { - tstrncpy(g_queryInfo.superQueryInfo.sTblName, stblname->valuestring, - TSDB_TABLE_NAME_LEN); + cJSON* queryMode = cJSON_GetObjectItem(root, "query_mode"); + if (queryMode + && queryMode->type == cJSON_String + && queryMode->valuestring != NULL) { + tstrncpy(g_queryInfo.queryMode, queryMode->valuestring, + min(SMALL_BUFF_LEN, strlen(queryMode->valuestring) + 1)); + } else if (!queryMode) { + tstrncpy(g_queryInfo.queryMode, "taosc", + min(SMALL_BUFF_LEN, strlen("taosc") + 1)); } else { - errorPrint("%s() LN%d, failed to read json, super table name input error\n", - __func__, __LINE__); - goto PARSE_OVER; - } - - cJSON* superAsyncMode = cJSON_GetObjectItem(superQuery, "mode"); - if (superAsyncMode && superAsyncMode->type == cJSON_String - && superAsyncMode->valuestring != NULL) { - if (0 == strcmp("sync", superAsyncMode->valuestring)) { - g_queryInfo.superQueryInfo.asyncMode = SYNC_MODE; - } else if (0 == strcmp("async", superAsyncMode->valuestring)) { - g_queryInfo.superQueryInfo.asyncMode = ASYNC_MODE; - } else { - errorPrint("%s() LN%d, failed to read json, async mode input error\n", - __func__, __LINE__); + printf("ERROR: failed to read json, query_mode not found\n"); goto PARSE_OVER; - } - } else { - g_queryInfo.superQueryInfo.asyncMode = SYNC_MODE; } - cJSON* superInterval = cJSON_GetObjectItem(superQuery, "interval"); - if (superInterval && superInterval->type == cJSON_Number) { - if (superInterval->valueint < 0) { - errorPrint("%s() LN%d, failed to read json, interval input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; - } - g_queryInfo.superQueryInfo.subscribeInterval = superInterval->valueint; - } else if (!superInterval) { - //printf("failed to read json, subscribe interval no found\n"); - //goto PARSE_OVER; - g_queryInfo.superQueryInfo.subscribeInterval = 10000; - } - - cJSON* subrestart = cJSON_GetObjectItem(superQuery, "restart"); - if (subrestart && subrestart->type == cJSON_String - && subrestart->valuestring != NULL) { - if (0 == strcmp("yes", subrestart->valuestring)) { - g_queryInfo.superQueryInfo.subscribeRestart = true; - } else if (0 == strcmp("no", subrestart->valuestring)) { - g_queryInfo.superQueryInfo.subscribeRestart = false; - } else { - printf("ERROR: failed to read json, subscribe restart error\n"); + // specified_table_query + cJSON *specifiedQuery = cJSON_GetObjectItem(root, "specified_table_query"); + if (!specifiedQuery) { + g_queryInfo.specifiedQueryInfo.concurrent = 1; + g_queryInfo.specifiedQueryInfo.sqlCount = 0; + } else if (specifiedQuery->type != cJSON_Object) { + printf("ERROR: failed to read json, super_table_query not found\n"); goto PARSE_OVER; - } } else { - g_queryInfo.superQueryInfo.subscribeRestart = true; - } - - cJSON* superkeepProgress = cJSON_GetObjectItem(superQuery, "keepProgress"); - if (superkeepProgress && - superkeepProgress->type == cJSON_String - && superkeepProgress->valuestring != NULL) { - if (0 == strcmp("yes", superkeepProgress->valuestring)) { - g_queryInfo.superQueryInfo.subscribeKeepProgress = 1; - } else if (0 == strcmp("no", superkeepProgress->valuestring)) { - g_queryInfo.superQueryInfo.subscribeKeepProgress = 0; - } else { - printf("ERROR: failed to read json, subscribe super table keepProgress error\n"); + cJSON* queryInterval = cJSON_GetObjectItem(specifiedQuery, "query_interval"); + if (queryInterval && queryInterval->type == cJSON_Number) { + g_queryInfo.specifiedQueryInfo.queryInterval = queryInterval->valueint; + } else if (!queryInterval) { + g_queryInfo.specifiedQueryInfo.queryInterval = 0; + } + + cJSON* specifiedQueryTimes = cJSON_GetObjectItem(specifiedQuery, + "query_times"); + if (specifiedQueryTimes && specifiedQueryTimes->type == cJSON_Number) { + if (specifiedQueryTimes->valueint <= 0) { + errorPrint( + "%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n", + __func__, __LINE__, specifiedQueryTimes->valueint); + goto PARSE_OVER; + + } + g_queryInfo.specifiedQueryInfo.queryTimes = specifiedQueryTimes->valueint; + } else if (!specifiedQueryTimes) { + g_queryInfo.specifiedQueryInfo.queryTimes = g_args.query_times; + } else { + errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + } + + cJSON* concurrent = cJSON_GetObjectItem(specifiedQuery, "concurrent"); + if (concurrent && concurrent->type == cJSON_Number) { + if (concurrent->valueint <= 0) { + errorPrint( + "%s() LN%d, query sqlCount %d or concurrent %d is not correct.\n", + __func__, __LINE__, + g_queryInfo.specifiedQueryInfo.sqlCount, + g_queryInfo.specifiedQueryInfo.concurrent); + goto PARSE_OVER; + } + g_queryInfo.specifiedQueryInfo.concurrent = concurrent->valueint; + } else if (!concurrent) { + g_queryInfo.specifiedQueryInfo.concurrent = 1; + } + + cJSON* specifiedAsyncMode = cJSON_GetObjectItem(specifiedQuery, "mode"); + if (specifiedAsyncMode && specifiedAsyncMode->type == cJSON_String + && specifiedAsyncMode->valuestring != NULL) { + if (0 == strcmp("sync", specifiedAsyncMode->valuestring)) { + g_queryInfo.specifiedQueryInfo.asyncMode = SYNC_MODE; + } else if (0 == strcmp("async", specifiedAsyncMode->valuestring)) { + g_queryInfo.specifiedQueryInfo.asyncMode = ASYNC_MODE; + } else { + errorPrint("%s() LN%d, failed to read json, async mode input error\n", + __func__, __LINE__); + goto PARSE_OVER; + } + } else { + g_queryInfo.specifiedQueryInfo.asyncMode = SYNC_MODE; + } + + cJSON* interval = cJSON_GetObjectItem(specifiedQuery, "interval"); + if (interval && interval->type == cJSON_Number) { + g_queryInfo.specifiedQueryInfo.subscribeInterval = interval->valueint; + } else if (!interval) { + //printf("failed to read json, subscribe interval no found\n"); + //goto PARSE_OVER; + g_queryInfo.specifiedQueryInfo.subscribeInterval = 10000; + } + + cJSON* restart = cJSON_GetObjectItem(specifiedQuery, "restart"); + if (restart && restart->type == cJSON_String && restart->valuestring != NULL) { + if (0 == strcmp("yes", restart->valuestring)) { + g_queryInfo.specifiedQueryInfo.subscribeRestart = true; + } else if (0 == strcmp("no", restart->valuestring)) { + g_queryInfo.specifiedQueryInfo.subscribeRestart = false; + } else { + printf("ERROR: failed to read json, subscribe restart error\n"); + goto PARSE_OVER; + } + } else { + g_queryInfo.specifiedQueryInfo.subscribeRestart = true; + } + + cJSON* keepProgress = cJSON_GetObjectItem(specifiedQuery, "keepProgress"); + if (keepProgress + && keepProgress->type == cJSON_String + && keepProgress->valuestring != NULL) { + if (0 == strcmp("yes", keepProgress->valuestring)) { + g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 1; + } else if (0 == strcmp("no", keepProgress->valuestring)) { + g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 0; + } else { + printf("ERROR: failed to read json, subscribe keepProgress error\n"); + goto PARSE_OVER; + } + } else { + g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 0; + } + + // sqls + cJSON* specifiedSqls = cJSON_GetObjectItem(specifiedQuery, "sqls"); + if (!specifiedSqls) { + g_queryInfo.specifiedQueryInfo.sqlCount = 0; + } else if (specifiedSqls->type != cJSON_Array) { + errorPrint("%s() LN%d, failed to read json, super sqls not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } else { + int superSqlSize = cJSON_GetArraySize(specifiedSqls); + if (superSqlSize * g_queryInfo.specifiedQueryInfo.concurrent + > MAX_QUERY_SQL_COUNT) { + errorPrint("%s() LN%d, failed to read json, query sql(%d) * concurrent(%d) overflow, max is %d\n", + __func__, __LINE__, + superSqlSize, + g_queryInfo.specifiedQueryInfo.concurrent, + MAX_QUERY_SQL_COUNT); + goto PARSE_OVER; + } + + g_queryInfo.specifiedQueryInfo.sqlCount = superSqlSize; + for (int j = 0; j < superSqlSize; ++j) { + cJSON* sql = cJSON_GetArrayItem(specifiedSqls, j); + if (sql == NULL) continue; + + cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql"); + if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) { + printf("ERROR: failed to read json, sql not found\n"); + goto PARSE_OVER; + } + tstrncpy(g_queryInfo.specifiedQueryInfo.sql[j], + sqlStr->valuestring, MAX_QUERY_SQL_LENGTH); + + // default value is -1, which mean infinite loop + g_queryInfo.specifiedQueryInfo.endAfterConsume[j] = -1; + cJSON* endAfterConsume = + cJSON_GetObjectItem(specifiedQuery, "endAfterConsume"); + if (endAfterConsume + && endAfterConsume->type == cJSON_Number) { + g_queryInfo.specifiedQueryInfo.endAfterConsume[j] + = endAfterConsume->valueint; + } + if (g_queryInfo.specifiedQueryInfo.endAfterConsume[j] < -1) + g_queryInfo.specifiedQueryInfo.endAfterConsume[j] = -1; + + g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] = -1; + cJSON* resubAfterConsume = + cJSON_GetObjectItem(specifiedQuery, "resubAfterConsume"); + if ((resubAfterConsume) + && (resubAfterConsume->type == cJSON_Number) + && (resubAfterConsume->valueint >= 0)) { + g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] + = resubAfterConsume->valueint; + } + + if (g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] < -1) + g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] = -1; + + cJSON *result = cJSON_GetObjectItem(sql, "result"); + if ((NULL != result) && (result->type == cJSON_String) + && (result->valuestring != NULL)) { + tstrncpy(g_queryInfo.specifiedQueryInfo.result[j], + result->valuestring, MAX_FILE_NAME_LEN); + } else if (NULL == result) { + memset(g_queryInfo.specifiedQueryInfo.result[j], + 0, MAX_FILE_NAME_LEN); + } else { + printf("ERROR: failed to read json, super query result file not found\n"); + goto PARSE_OVER; + } + } + } + } + + // super_table_query + cJSON *superQuery = cJSON_GetObjectItem(root, "super_table_query"); + if (!superQuery) { + g_queryInfo.superQueryInfo.threadCnt = 1; + g_queryInfo.superQueryInfo.sqlCount = 0; + } else if (superQuery->type != cJSON_Object) { + printf("ERROR: failed to read json, sub_table_query not found\n"); + ret = true; goto PARSE_OVER; - } } else { - g_queryInfo.superQueryInfo.subscribeKeepProgress = 0; - } + cJSON* subrate = cJSON_GetObjectItem(superQuery, "query_interval"); + if (subrate && subrate->type == cJSON_Number) { + g_queryInfo.superQueryInfo.queryInterval = subrate->valueint; + } else if (!subrate) { + g_queryInfo.superQueryInfo.queryInterval = 0; + } + + cJSON* superQueryTimes = cJSON_GetObjectItem(superQuery, "query_times"); + if (superQueryTimes && superQueryTimes->type == cJSON_Number) { + if (superQueryTimes->valueint <= 0) { + errorPrint("%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n", + __func__, __LINE__, superQueryTimes->valueint); + goto PARSE_OVER; + } + g_queryInfo.superQueryInfo.queryTimes = superQueryTimes->valueint; + } else if (!superQueryTimes) { + g_queryInfo.superQueryInfo.queryTimes = g_args.query_times; + } else { + errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + } - // default value is -1, which mean do not resub - g_queryInfo.superQueryInfo.endAfterConsume = -1; - cJSON* superEndAfterConsume = - cJSON_GetObjectItem(superQuery, "endAfterConsume"); - if (superEndAfterConsume - && superEndAfterConsume->type == cJSON_Number) { - g_queryInfo.superQueryInfo.endAfterConsume = - superEndAfterConsume->valueint; - } - if (g_queryInfo.superQueryInfo.endAfterConsume < -1) + cJSON* threads = cJSON_GetObjectItem(superQuery, "threads"); + if (threads && threads->type == cJSON_Number) { + if (threads->valueint <= 0) { + errorPrint("%s() LN%d, failed to read json, threads input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + + } + g_queryInfo.superQueryInfo.threadCnt = threads->valueint; + } else if (!threads) { + g_queryInfo.superQueryInfo.threadCnt = 1; + } + + //cJSON* subTblCnt = cJSON_GetObjectItem(superQuery, "childtable_count"); + //if (subTblCnt && subTblCnt->type == cJSON_Number) { + // g_queryInfo.superQueryInfo.childTblCount = subTblCnt->valueint; + //} else if (!subTblCnt) { + // g_queryInfo.superQueryInfo.childTblCount = 0; + //} + + cJSON* stblname = cJSON_GetObjectItem(superQuery, "stblname"); + if (stblname && stblname->type == cJSON_String + && stblname->valuestring != NULL) { + tstrncpy(g_queryInfo.superQueryInfo.sTblName, stblname->valuestring, + TSDB_TABLE_NAME_LEN); + } else { + errorPrint("%s() LN%d, failed to read json, super table name input error\n", + __func__, __LINE__); + goto PARSE_OVER; + } + + cJSON* superAsyncMode = cJSON_GetObjectItem(superQuery, "mode"); + if (superAsyncMode && superAsyncMode->type == cJSON_String + && superAsyncMode->valuestring != NULL) { + if (0 == strcmp("sync", superAsyncMode->valuestring)) { + g_queryInfo.superQueryInfo.asyncMode = SYNC_MODE; + } else if (0 == strcmp("async", superAsyncMode->valuestring)) { + g_queryInfo.superQueryInfo.asyncMode = ASYNC_MODE; + } else { + errorPrint("%s() LN%d, failed to read json, async mode input error\n", + __func__, __LINE__); + goto PARSE_OVER; + } + } else { + g_queryInfo.superQueryInfo.asyncMode = SYNC_MODE; + } + + cJSON* superInterval = cJSON_GetObjectItem(superQuery, "interval"); + if (superInterval && superInterval->type == cJSON_Number) { + if (superInterval->valueint < 0) { + errorPrint("%s() LN%d, failed to read json, interval input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + } + g_queryInfo.superQueryInfo.subscribeInterval = superInterval->valueint; + } else if (!superInterval) { + //printf("failed to read json, subscribe interval no found\n"); + //goto PARSE_OVER; + g_queryInfo.superQueryInfo.subscribeInterval = 10000; + } + + cJSON* subrestart = cJSON_GetObjectItem(superQuery, "restart"); + if (subrestart && subrestart->type == cJSON_String + && subrestart->valuestring != NULL) { + if (0 == strcmp("yes", subrestart->valuestring)) { + g_queryInfo.superQueryInfo.subscribeRestart = true; + } else if (0 == strcmp("no", subrestart->valuestring)) { + g_queryInfo.superQueryInfo.subscribeRestart = false; + } else { + printf("ERROR: failed to read json, subscribe restart error\n"); + goto PARSE_OVER; + } + } else { + g_queryInfo.superQueryInfo.subscribeRestart = true; + } + + cJSON* superkeepProgress = cJSON_GetObjectItem(superQuery, "keepProgress"); + if (superkeepProgress && + superkeepProgress->type == cJSON_String + && superkeepProgress->valuestring != NULL) { + if (0 == strcmp("yes", superkeepProgress->valuestring)) { + g_queryInfo.superQueryInfo.subscribeKeepProgress = 1; + } else if (0 == strcmp("no", superkeepProgress->valuestring)) { + g_queryInfo.superQueryInfo.subscribeKeepProgress = 0; + } else { + printf("ERROR: failed to read json, subscribe super table keepProgress error\n"); + goto PARSE_OVER; + } + } else { + g_queryInfo.superQueryInfo.subscribeKeepProgress = 0; + } + + // default value is -1, which mean do not resub g_queryInfo.superQueryInfo.endAfterConsume = -1; + cJSON* superEndAfterConsume = + cJSON_GetObjectItem(superQuery, "endAfterConsume"); + if (superEndAfterConsume + && superEndAfterConsume->type == cJSON_Number) { + g_queryInfo.superQueryInfo.endAfterConsume = + superEndAfterConsume->valueint; + } + if (g_queryInfo.superQueryInfo.endAfterConsume < -1) + g_queryInfo.superQueryInfo.endAfterConsume = -1; - // default value is -1, which mean do not resub - g_queryInfo.superQueryInfo.resubAfterConsume = -1; - cJSON* superResubAfterConsume = - cJSON_GetObjectItem(superQuery, "resubAfterConsume"); - if ((superResubAfterConsume) - && (superResubAfterConsume->type == cJSON_Number) - && (superResubAfterConsume->valueint >= 0)) { - g_queryInfo.superQueryInfo.resubAfterConsume = - superResubAfterConsume->valueint; - } - if (g_queryInfo.superQueryInfo.resubAfterConsume < -1) + // default value is -1, which mean do not resub g_queryInfo.superQueryInfo.resubAfterConsume = -1; + cJSON* superResubAfterConsume = + cJSON_GetObjectItem(superQuery, "resubAfterConsume"); + if ((superResubAfterConsume) + && (superResubAfterConsume->type == cJSON_Number) + && (superResubAfterConsume->valueint >= 0)) { + g_queryInfo.superQueryInfo.resubAfterConsume = + superResubAfterConsume->valueint; + } + if (g_queryInfo.superQueryInfo.resubAfterConsume < -1) + g_queryInfo.superQueryInfo.resubAfterConsume = -1; + + // supert table sqls + cJSON* superSqls = cJSON_GetObjectItem(superQuery, "sqls"); + if (!superSqls) { + g_queryInfo.superQueryInfo.sqlCount = 0; + } else if (superSqls->type != cJSON_Array) { + errorPrint("%s() LN%d: failed to read json, super sqls not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } else { + int superSqlSize = cJSON_GetArraySize(superSqls); + if (superSqlSize > MAX_QUERY_SQL_COUNT) { + errorPrint("%s() LN%d, failed to read json, query sql size overflow, max is %d\n", + __func__, __LINE__, MAX_QUERY_SQL_COUNT); + goto PARSE_OVER; + } - // supert table sqls - cJSON* superSqls = cJSON_GetObjectItem(superQuery, "sqls"); - if (!superSqls) { - g_queryInfo.superQueryInfo.sqlCount = 0; - } else if (superSqls->type != cJSON_Array) { - errorPrint("%s() LN%d: failed to read json, super sqls not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } else { - int superSqlSize = cJSON_GetArraySize(superSqls); - if (superSqlSize > MAX_QUERY_SQL_COUNT) { - errorPrint("%s() LN%d, failed to read json, query sql size overflow, max is %d\n", - __func__, __LINE__, MAX_QUERY_SQL_COUNT); - goto PARSE_OVER; - } - - g_queryInfo.superQueryInfo.sqlCount = superSqlSize; - for (int j = 0; j < superSqlSize; ++j) { - cJSON* sql = cJSON_GetArrayItem(superSqls, j); - if (sql == NULL) continue; - - cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql"); - if (!sqlStr || sqlStr->type != cJSON_String - || sqlStr->valuestring == NULL) { - errorPrint("%s() LN%d, failed to read json, sql not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } - tstrncpy(g_queryInfo.superQueryInfo.sql[j], sqlStr->valuestring, - MAX_QUERY_SQL_LENGTH); - - cJSON *result = cJSON_GetObjectItem(sql, "result"); - if (result != NULL && result->type == cJSON_String - && result->valuestring != NULL){ - tstrncpy(g_queryInfo.superQueryInfo.result[j], - result->valuestring, MAX_FILE_NAME_LEN); - } else if (NULL == result) { - memset(g_queryInfo.superQueryInfo.result[j], 0, MAX_FILE_NAME_LEN); - } else { - errorPrint("%s() LN%d, failed to read json, sub query result file not found\n", - __func__, __LINE__); - goto PARSE_OVER; + g_queryInfo.superQueryInfo.sqlCount = superSqlSize; + for (int j = 0; j < superSqlSize; ++j) { + cJSON* sql = cJSON_GetArrayItem(superSqls, j); + if (sql == NULL) continue; + + cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql"); + if (!sqlStr || sqlStr->type != cJSON_String + || sqlStr->valuestring == NULL) { + errorPrint("%s() LN%d, failed to read json, sql not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } + tstrncpy(g_queryInfo.superQueryInfo.sql[j], sqlStr->valuestring, + MAX_QUERY_SQL_LENGTH); + + cJSON *result = cJSON_GetObjectItem(sql, "result"); + if (result != NULL && result->type == cJSON_String + && result->valuestring != NULL){ + tstrncpy(g_queryInfo.superQueryInfo.result[j], + result->valuestring, MAX_FILE_NAME_LEN); + } else if (NULL == result) { + memset(g_queryInfo.superQueryInfo.result[j], 0, MAX_FILE_NAME_LEN); + } else { + errorPrint("%s() LN%d, failed to read json, sub query result file not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } + } } - } } - } - ret = true; + ret = true; PARSE_OVER: - return ret; + return ret; } static bool getInfoFromJsonFile(char* file) { debugPrint("%s %d %s\n", __func__, __LINE__, file); - FILE *fp = fopen(file, "r"); - if (!fp) { - printf("failed to read %s, reason:%s\n", file, strerror(errno)); - return false; - } - - bool ret = false; - int maxLen = 6400000; - char *content = calloc(1, maxLen + 1); - int len = fread(content, 1, maxLen, fp); - if (len <= 0) { - free(content); - fclose(fp); - printf("failed to read %s, content is null", file); - return false; - } - - content[len] = 0; - cJSON* root = cJSON_Parse(content); - if (root == NULL) { - printf("ERROR: failed to cjson parse %s, invalid json format\n", file); - goto PARSE_OVER; - } - - cJSON* filetype = cJSON_GetObjectItem(root, "filetype"); - if (filetype && filetype->type == cJSON_String && filetype->valuestring != NULL) { - if (0 == strcasecmp("insert", filetype->valuestring)) { - g_args.test_mode = INSERT_TEST; - } else if (0 == strcasecmp("query", filetype->valuestring)) { - g_args.test_mode = QUERY_TEST; - } else if (0 == strcasecmp("subscribe", filetype->valuestring)) { - g_args.test_mode = SUBSCRIBE_TEST; + FILE *fp = fopen(file, "r"); + if (!fp) { + printf("failed to read %s, reason:%s\n", file, strerror(errno)); + return false; + } + + bool ret = false; + int maxLen = 6400000; + char *content = calloc(1, maxLen + 1); + int len = fread(content, 1, maxLen, fp); + if (len <= 0) { + free(content); + fclose(fp); + printf("failed to read %s, content is null", file); + return false; + } + + content[len] = 0; + cJSON* root = cJSON_Parse(content); + if (root == NULL) { + printf("ERROR: failed to cjson parse %s, invalid json format\n", file); + goto PARSE_OVER; + } + + cJSON* filetype = cJSON_GetObjectItem(root, "filetype"); + if (filetype && filetype->type == cJSON_String && filetype->valuestring != NULL) { + if (0 == strcasecmp("insert", filetype->valuestring)) { + g_args.test_mode = INSERT_TEST; + } else if (0 == strcasecmp("query", filetype->valuestring)) { + g_args.test_mode = QUERY_TEST; + } else if (0 == strcasecmp("subscribe", filetype->valuestring)) { + g_args.test_mode = SUBSCRIBE_TEST; + } else { + printf("ERROR: failed to read json, filetype not support\n"); + goto PARSE_OVER; + } + } else if (!filetype) { + g_args.test_mode = INSERT_TEST; } else { - printf("ERROR: failed to read json, filetype not support\n"); - goto PARSE_OVER; + printf("ERROR: failed to read json, filetype not found\n"); + goto PARSE_OVER; + } + + if (INSERT_TEST == g_args.test_mode) { + ret = getMetaFromInsertJsonFile(root); + } else if ((QUERY_TEST == g_args.test_mode) + || (SUBSCRIBE_TEST == g_args.test_mode)) { + ret = getMetaFromQueryJsonFile(root); + } else { + errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n", + __func__, __LINE__); + goto PARSE_OVER; } - } else if (!filetype) { - g_args.test_mode = INSERT_TEST; - } else { - printf("ERROR: failed to read json, filetype not found\n"); - goto PARSE_OVER; - } - - if (INSERT_TEST == g_args.test_mode) { - ret = getMetaFromInsertJsonFile(root); - } else if ((QUERY_TEST == g_args.test_mode) - || (SUBSCRIBE_TEST == g_args.test_mode)) { - ret = getMetaFromQueryJsonFile(root); - } else { - errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n", - __func__, __LINE__); - goto PARSE_OVER; - } PARSE_OVER: - free(content); - cJSON_Delete(root); - fclose(fp); - return ret; + free(content); + cJSON_Delete(root); + fclose(fp); + return ret; } static int prepareSampleData() { - for (int i = 0; i < g_Dbs.dbCount; i++) { - for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { - if (g_Dbs.db[i].superTbls[j].tagsFile[0] != 0) { - if (readTagFromCsvFileToMem(&g_Dbs.db[i].superTbls[j]) != 0) { - return -1; + for (int i = 0; i < g_Dbs.dbCount; i++) { + for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { + if (g_Dbs.db[i].superTbls[j].tagsFile[0] != 0) { + if (readTagFromCsvFileToMem(&g_Dbs.db[i].superTbls[j]) != 0) { + return -1; + } + } } - } } - } - return 0; + return 0; } static void postFreeResource() { - tmfclose(g_fpOfInsertResult); - for (int i = 0; i < g_Dbs.dbCount; i++) { - for (uint64_t j = 0; j < g_Dbs.db[i].superTblCount; j++) { - if (0 != g_Dbs.db[i].superTbls[j].colsOfCreateChildTable) { - free(g_Dbs.db[i].superTbls[j].colsOfCreateChildTable); - g_Dbs.db[i].superTbls[j].colsOfCreateChildTable = NULL; - } - if (0 != g_Dbs.db[i].superTbls[j].sampleDataBuf) { - free(g_Dbs.db[i].superTbls[j].sampleDataBuf); - g_Dbs.db[i].superTbls[j].sampleDataBuf = NULL; - } - if (0 != g_Dbs.db[i].superTbls[j].tagDataBuf) { - free(g_Dbs.db[i].superTbls[j].tagDataBuf); - g_Dbs.db[i].superTbls[j].tagDataBuf = NULL; - } - if (0 != g_Dbs.db[i].superTbls[j].childTblName) { - free(g_Dbs.db[i].superTbls[j].childTblName); - g_Dbs.db[i].superTbls[j].childTblName = NULL; - } - } - } + tmfclose(g_fpOfInsertResult); + for (int i = 0; i < g_Dbs.dbCount; i++) { + for (uint64_t j = 0; j < g_Dbs.db[i].superTblCount; j++) { + if (0 != g_Dbs.db[i].superTbls[j].colsOfCreateChildTable) { + free(g_Dbs.db[i].superTbls[j].colsOfCreateChildTable); + g_Dbs.db[i].superTbls[j].colsOfCreateChildTable = NULL; + } + if (0 != g_Dbs.db[i].superTbls[j].sampleDataBuf) { + free(g_Dbs.db[i].superTbls[j].sampleDataBuf); + g_Dbs.db[i].superTbls[j].sampleDataBuf = NULL; + } + if (0 != g_Dbs.db[i].superTbls[j].tagDataBuf) { + free(g_Dbs.db[i].superTbls[j].tagDataBuf); + g_Dbs.db[i].superTbls[j].tagDataBuf = NULL; + } + if (0 != g_Dbs.db[i].superTbls[j].childTblName) { + free(g_Dbs.db[i].superTbls[j].childTblName); + g_Dbs.db[i].superTbls[j].childTblName = NULL; + } + } + } } static int getRowDataFromSample( char* dataBuf, int64_t maxLen, int64_t timestamp, - SSuperTable* superTblInfo, int64_t* sampleUsePos) + SSuperTable* superTblInfo, int64_t* sampleUsePos) { if ((*sampleUsePos) == MAX_SAMPLES_ONCE_FROM_FILE) { /* int ret = readSampleFromCsvFileToMem(superTblInfo); @@ -5034,30 +5082,30 @@ static int64_t generateData(char *recBuf, char **data_type, } static int prepareSampleDataForSTable(SSuperTable *superTblInfo) { - char* sampleDataBuf = NULL; + char* sampleDataBuf = NULL; - sampleDataBuf = calloc( + sampleDataBuf = calloc( superTblInfo->lenOfOneRow * MAX_SAMPLES_ONCE_FROM_FILE, 1); - if (sampleDataBuf == NULL) { - errorPrint("%s() LN%d, Failed to calloc %"PRIu64" Bytes, reason:%s\n", - __func__, __LINE__, - superTblInfo->lenOfOneRow * MAX_SAMPLES_ONCE_FROM_FILE, - strerror(errno)); - return -1; - } - - superTblInfo->sampleDataBuf = sampleDataBuf; - int ret = readSampleFromCsvFileToMem(superTblInfo); - - if (0 != ret) { - errorPrint("%s() LN%d, read sample from csv file failed.\n", - __func__, __LINE__); - tmfree(sampleDataBuf); - superTblInfo->sampleDataBuf = NULL; - return -1; - } - - return 0; + if (sampleDataBuf == NULL) { + errorPrint("%s() LN%d, Failed to calloc %"PRIu64" Bytes, reason:%s\n", + __func__, __LINE__, + superTblInfo->lenOfOneRow * MAX_SAMPLES_ONCE_FROM_FILE, + strerror(errno)); + return -1; + } + + superTblInfo->sampleDataBuf = sampleDataBuf; + int ret = readSampleFromCsvFileToMem(superTblInfo); + + if (0 != ret) { + errorPrint("%s() LN%d, read sample from csv file failed.\n", + __func__, __LINE__); + tmfree(sampleDataBuf); + superTblInfo->sampleDataBuf = NULL; + return -1; + } + + return 0; } static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k) @@ -5103,7 +5151,8 @@ static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k) #if STMT_IFACE_ENABLED == 1 case STMT_IFACE: - debugPrint("%s() LN%d, stmt=%p", __func__, __LINE__, pThreadInfo->stmt); + debugPrint("%s() LN%d, stmt=%p", + __func__, __LINE__, pThreadInfo->stmt); if (0 != taos_stmt_execute(pThreadInfo->stmt)) { errorPrint("%s() LN%d, failied to execute insert statement\n", __func__, __LINE__); @@ -5156,54 +5205,54 @@ static int32_t generateDataTailWithoutStb( uint64_t recordFrom, int64_t startTime, /* int64_t *pSamplePos, */int64_t *dataLen) { - uint64_t len = 0; - char *pstr = buffer; + uint64_t len = 0; + char *pstr = buffer; - verbosePrint("%s() LN%d batch=%d\n", __func__, __LINE__, batch); + verbosePrint("%s() LN%d batch=%d\n", __func__, __LINE__, batch); - int32_t k = 0; - for (k = 0; k < batch;) { - char data[MAX_DATA_SIZE]; - memset(data, 0, MAX_DATA_SIZE); + int32_t k = 0; + for (k = 0; k < batch;) { + char data[MAX_DATA_SIZE]; + memset(data, 0, MAX_DATA_SIZE); - int64_t retLen = 0; + int64_t retLen = 0; - char **data_type = g_args.datatype; - int lenOfBinary = g_args.len_of_binary; + char **data_type = g_args.datatype; + int lenOfBinary = g_args.len_of_binary; - if (g_args.disorderRatio) { - retLen = generateData(data, data_type, - startTime + getTSRandTail( - (int64_t) DEFAULT_TIMESTAMP_STEP, k, - g_args.disorderRatio, - g_args.disorderRange), - lenOfBinary); - } else { - retLen = generateData(data, data_type, - startTime + (int64_t) (DEFAULT_TIMESTAMP_STEP* k), - lenOfBinary); - } + if (g_args.disorderRatio) { + retLen = generateData(data, data_type, + startTime + getTSRandTail( + g_args.timestamp_step, k, + g_args.disorderRatio, + g_args.disorderRange), + lenOfBinary); + } else { + retLen = generateData(data, data_type, + startTime + g_args.timestamp_step * k, + lenOfBinary); + } - if (len > remainderBufLen) - break; + if (len > remainderBufLen) + break; - pstr += sprintf(pstr, "%s", data); - k++; - len += retLen; - remainderBufLen -= retLen; + pstr += sprintf(pstr, "%s", data); + k++; + len += retLen; + remainderBufLen -= retLen; - verbosePrint("%s() LN%d len=%"PRIu64" k=%d \nbuffer=%s\n", - __func__, __LINE__, len, k, buffer); + verbosePrint("%s() LN%d len=%"PRIu64" k=%d \nbuffer=%s\n", + __func__, __LINE__, len, k, buffer); - recordFrom ++; + recordFrom ++; - if (recordFrom >= insertRows) { - break; + if (recordFrom >= insertRows) { + break; + } } - } - *dataLen = len; - return k; + *dataLen = len; + return k; } static int64_t getTSRandTail(int64_t timeStampStep, int32_t seq, @@ -5298,82 +5347,82 @@ static int generateSQLHeadWithoutStb(char *tableName, char *dbName, char *buffer, int remainderBufLen) { - int len; + int len; - char headBuf[HEAD_BUFF_LEN]; + char headBuf[HEAD_BUFF_LEN]; - len = snprintf( - headBuf, - HEAD_BUFF_LEN, - "%s.%s values", - dbName, - tableName); + len = snprintf( + headBuf, + HEAD_BUFF_LEN, + "%s.%s values", + dbName, + tableName); - if (len > remainderBufLen) - return -1; + if (len > remainderBufLen) + return -1; - tstrncpy(buffer, headBuf, len + 1); + tstrncpy(buffer, headBuf, len + 1); - return len; + return len; } static int generateStbSQLHead( SSuperTable* superTblInfo, - char *tableName, int32_t tableSeq, + char *tableName, int64_t tableSeq, char *dbName, char *buffer, int remainderBufLen) { - int len; + int len; - char headBuf[HEAD_BUFF_LEN]; + char headBuf[HEAD_BUFF_LEN]; - if (AUTO_CREATE_SUBTBL == superTblInfo->autoCreateTable) { - char* tagsValBuf = NULL; - if (0 == superTblInfo->tagSource) { + if (AUTO_CREATE_SUBTBL == superTblInfo->autoCreateTable) { + char* tagsValBuf = NULL; + if (0 == superTblInfo->tagSource) { tagsValBuf = generateTagValuesForStb(superTblInfo, tableSeq); - } else { + } else { tagsValBuf = getTagValueFromTagSample( superTblInfo, tableSeq % superTblInfo->tagSampleCount); - } - if (NULL == tagsValBuf) { - errorPrint("%s() LN%d, tag buf failed to allocate memory\n", - __func__, __LINE__); - return -1; - } - - len = snprintf( - headBuf, - HEAD_BUFF_LEN, - "%s.%s using %s.%s TAGS%s values", - dbName, - tableName, - dbName, - superTblInfo->sTblName, - tagsValBuf); - tmfree(tagsValBuf); + } + if (NULL == tagsValBuf) { + errorPrint("%s() LN%d, tag buf failed to allocate memory\n", + __func__, __LINE__); + return -1; + } + + len = snprintf( + headBuf, + HEAD_BUFF_LEN, + "%s.%s using %s.%s TAGS%s values", + dbName, + tableName, + dbName, + superTblInfo->sTblName, + tagsValBuf); + tmfree(tagsValBuf); } else if (TBL_ALREADY_EXISTS == superTblInfo->childTblExists) { - len = snprintf( - headBuf, - HEAD_BUFF_LEN, - "%s.%s values", - dbName, - tableName); + len = snprintf( + headBuf, + HEAD_BUFF_LEN, + "%s.%s values", + dbName, + tableName); } else { - len = snprintf( - headBuf, - HEAD_BUFF_LEN, - "%s.%s values", - dbName, - tableName); - } - - if (len > remainderBufLen) - return -1; + len = snprintf( + headBuf, + HEAD_BUFF_LEN, + "%s.%s values", + dbName, + tableName); + } + + if (len > remainderBufLen) + return -1; - tstrncpy(buffer, headBuf, len + 1); + tstrncpy(buffer, headBuf, len + 1); - return len; + return len; } static int32_t generateStbInterlaceData( @@ -5443,39 +5492,39 @@ static int64_t generateInterlaceDataWithoutStb( int64_t startTime, uint64_t *pRemainderBufLen) { - assert(buffer); - char *pstr = buffer; + assert(buffer); + char *pstr = buffer; - int headLen = generateSQLHeadWithoutStb( - tableName, dbName, + int headLen = generateSQLHeadWithoutStb( + tableName, dbName, pstr, *pRemainderBufLen); - if (headLen <= 0) { - return 0; - } + if (headLen <= 0) { + return 0; + } - pstr += headLen; - *pRemainderBufLen -= headLen; + pstr += headLen; + *pRemainderBufLen -= headLen; - int64_t dataLen = 0; + int64_t dataLen = 0; - int32_t k = generateDataTailWithoutStb( + int32_t k = generateDataTailWithoutStb( batch, pstr, *pRemainderBufLen, insertRows, 0, startTime, &dataLen); - if (k == batch) { - pstr += dataLen; - *pRemainderBufLen -= dataLen; - } else { - debugPrint("%s() LN%d, generated data tail: %d, not equal batch per table: %u\n", - __func__, __LINE__, k, batch); - pstr -= headLen; - pstr[0] = '\0'; - k = 0; - } - - return k; + if (k == batch) { + pstr += dataLen; + *pRemainderBufLen -= dataLen; + } else { + debugPrint("%s() LN%d, generated data tail: %d, not equal batch per table: %u\n", + __func__, __LINE__, k, batch); + pstr -= headLen; + pstr[0] = '\0'; + k = 0; + } + + return k; } #if STMT_IFACE_ENABLED == 1 @@ -5651,8 +5700,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, *ptr += bind->buffer_length; } else { - errorPrint( "No support data type: %s\n", - dataType); + errorPrint( "No support data type: %s\n", dataType); return -1; } @@ -5699,11 +5747,11 @@ static int32_t prepareStmtWithoutStb( if (g_args.disorderRatio) { *bind_ts = startTime + getTSRandTail( - (int64_t)DEFAULT_TIMESTAMP_STEP, k, + g_args.timestamp_step, k, g_args.disorderRatio, g_args.disorderRange); } else { - *bind_ts = startTime + (int64_t)(DEFAULT_TIMESTAMP_STEP * k); + *bind_ts = startTime + g_args.timestamp_step * k; } bind->buffer_length = sizeof(int64_t); bind->buffer = bind_ts; @@ -5738,28 +5786,122 @@ static int32_t prepareStmtWithoutStb( return k; } +static int32_t prepareStbStmtBind( + char *bindArray, SSuperTable *stbInfo, bool sourceRand, + int64_t startTime, int32_t recSeq, + bool isColumn) +{ + char *bindBuffer = calloc(1, g_args.len_of_binary); + if (bindBuffer == NULL) { + errorPrint("%s() LN%d, Failed to allocate %d bind buffer\n", + __func__, __LINE__, g_args.len_of_binary); + return -1; + } + + char data[MAX_DATA_SIZE]; + memset(data, 0, MAX_DATA_SIZE); + char *ptr = data; + + TAOS_BIND *bind; + + if (isColumn) { + int cursor = 0; + + for (int i = 0; i < stbInfo->columnCount + 1; i ++) { + bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * i)); + + if (i == 0) { + int64_t *bind_ts; + + bind_ts = (int64_t *)ptr; + bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP; + if (stbInfo->disorderRatio) { + *bind_ts = startTime + getTSRandTail( + stbInfo->timeStampStep, recSeq, + stbInfo->disorderRatio, + stbInfo->disorderRange); + } else { + *bind_ts = startTime + stbInfo->timeStampStep * recSeq; + } + bind->buffer_length = sizeof(int64_t); + bind->buffer = bind_ts; + bind->length = &bind->buffer_length; + bind->is_null = NULL; + + ptr += bind->buffer_length; + } else { + + if (sourceRand) { + if ( -1 == prepareStmtBindArrayByType( + bind, + stbInfo->columns[i-1].dataType, + stbInfo->columns[i-1].dataLen, + &ptr, + NULL)) { + free(bindBuffer); + return -1; + } + } else { + char *restStr = stbInfo->sampleDataBuf + cursor; + int lengthOfRest = strlen(restStr); + + int index = 0; + for (index = 0; index < lengthOfRest; index ++) { + if (restStr[index] == ',') { + break; + } + } + + memset(bindBuffer, 0, g_args.len_of_binary); + strncpy(bindBuffer, restStr, index); + cursor += index + 1; // skip ',' too + + if ( -1 == prepareStmtBindArrayByType( + bind, + stbInfo->columns[i-1].dataType, + stbInfo->columns[i-1].dataLen, + &ptr, + bindBuffer)) { + free(bindBuffer); + return -1; + } + } + } + } + } else { + TAOS_BIND *tag; + + for (int t = 0; t < stbInfo->tagCount; t ++) { + tag = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * t)); + if ( -1 == prepareStmtBindArrayByType( + tag, + stbInfo->tags[t].dataType, + stbInfo->tags[t].dataLen, + &ptr, + NULL)) { + free(bindBuffer); + return -1; + } + } + + } + + free(bindBuffer); + return 0; +} + static int32_t prepareStbStmt( SSuperTable *stbInfo, TAOS_STMT *stmt, - char *tableName, uint32_t batch, + char *tableName, + int64_t tableSeq, + uint32_t batch, uint64_t insertRows, uint64_t recordFrom, int64_t startTime, int64_t *pSamplePos) { - int ret = taos_stmt_set_tbname(stmt, tableName); - if (ret != 0) { - errorPrint("failed to execute taos_stmt_set_tbname(%s). return 0x%x. reason: %s\n", - tableName, ret, taos_errstr(NULL)); - return ret; - } - - char *bindArray = malloc(sizeof(TAOS_BIND) * (stbInfo->columnCount + 1)); - if (bindArray == NULL) { - errorPrint("%s() LN%d, Failed to allocate %d bind params\n", - __func__, __LINE__, (stbInfo->columnCount + 1)); - return -1; - } + int ret; bool sourceRand; if (0 == strncasecmp(stbInfo->dataSource, "rand", strlen("rand"))) { @@ -5768,83 +5910,68 @@ static int32_t prepareStbStmt( sourceRand = false; // from sample data file } - char *bindBuffer = malloc(g_args.len_of_binary); - if (bindBuffer == NULL) { - errorPrint("%s() LN%d, Failed to allocate %d bind buffer\n", - __func__, __LINE__, g_args.len_of_binary); - free(bindArray); - return -1; - } + if (AUTO_CREATE_SUBTBL == stbInfo->autoCreateTable) { + char* tagsValBuf = NULL; - uint32_t k; - for (k = 0; k < batch;) { - /* columnCount + 1 (ts) */ - char data[MAX_DATA_SIZE]; - memset(data, 0, MAX_DATA_SIZE); + bool tagRand; + if (0 == stbInfo->tagSource) { + tagRand = true; + tagsValBuf = generateTagValuesForStb(stbInfo, tableSeq); + } else { + tagRand = false; + tagsValBuf = getTagValueFromTagSample( + stbInfo, + tableSeq % stbInfo->tagSampleCount); + } - char *ptr = data; - TAOS_BIND *bind = (TAOS_BIND *)(bindArray + 0); + if (NULL == tagsValBuf) { + errorPrint("%s() LN%d, tag buf failed to allocate memory\n", + __func__, __LINE__); + return -1; + } - int64_t *bind_ts; + char *tagsArray = calloc(1, sizeof(TAOS_BIND) * stbInfo->tagCount); + if (NULL == tagsArray) { + tmfree(tagsValBuf); + errorPrint("%s() LN%d, tag buf failed to allocate memory\n", + __func__, __LINE__); + return -1; + } - bind_ts = (int64_t *)ptr; - bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP; - if (stbInfo->disorderRatio) { - *bind_ts = startTime + getTSRandTail( - stbInfo->timeStampStep, k, - stbInfo->disorderRatio, - stbInfo->disorderRange); - } else { - *bind_ts = startTime + stbInfo->timeStampStep * k; + if (-1 == prepareStbStmtBind( + tagsArray, stbInfo, tagRand, -1, -1, false /* is tag */)) { + free(tagsArray); + return -1; } - bind->buffer_length = sizeof(int64_t); - bind->buffer = bind_ts; - bind->length = &bind->buffer_length; - bind->is_null = NULL; - ptr += bind->buffer_length; + ret = taos_stmt_set_tbname_tags(stmt, tableName, (TAOS_BIND *)tagsArray); - int cursor = 0; - for (int i = 0; i < stbInfo->columnCount; i ++) { - bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * (i + 1))); - - if (sourceRand) { - if ( -1 == prepareStmtBindArrayByType( - bind, - stbInfo->columns[i].dataType, - stbInfo->columns[i].dataLen, - &ptr, - NULL)) { - free(bindArray); - free(bindBuffer); - return -1; - } - } else { - char *restStr = stbInfo->sampleDataBuf + cursor; - int lengthOfRest = strlen(restStr); + tmfree(tagsValBuf); + tmfree((char *)tagsArray); + } else { + ret = taos_stmt_set_tbname(stmt, tableName); + } - int index = 0; - for (index = 0; index < lengthOfRest; index ++) { - if (restStr[index] == ',') { - break; - } - } + if (ret != 0) { + errorPrint("failed to execute taos_stmt_set_tbname(%s). return 0x%x. reason: %s\n", + tableName, ret, taos_errstr(NULL)); + return ret; + } - memset(bindBuffer, 0, g_args.len_of_binary); - strncpy(bindBuffer, restStr, index); - cursor += index + 1; // skip ',' too - - if ( -1 == prepareStmtBindArrayByType( - bind, - stbInfo->columns[i].dataType, - stbInfo->columns[i].dataLen, - &ptr, - bindBuffer)) { - free(bindArray); - free(bindBuffer); - return -1; - } - } + char *bindArray = calloc(1, sizeof(TAOS_BIND) * (stbInfo->columnCount + 1)); + if (bindArray == NULL) { + errorPrint("%s() LN%d, Failed to allocate %d bind params\n", + __func__, __LINE__, (stbInfo->columnCount + 1)); + return -1; + } + + uint32_t k; + for (k = 0; k < batch;) { + /* columnCount + 1 (ts) */ + if (-1 == prepareStbStmtBind(bindArray, stbInfo, sourceRand, + startTime, k, true /* is column */)) { + free(bindArray); + return -1; } taos_stmt_bind_param(stmt, (TAOS_BIND *)bindArray); // if msg > 3MB, break @@ -5862,7 +5989,6 @@ static int32_t prepareStbStmt( } } - free(bindBuffer); free(bindArray); return k; } @@ -5870,7 +5996,9 @@ static int32_t prepareStbStmt( static int32_t prepareStbStmtInterlace( SSuperTable *stbInfo, TAOS_STMT *stmt, - char *tableName, uint32_t batch, + char *tableName, + int64_t tableSeq, + uint32_t batch, uint64_t insertRows, uint64_t recordFrom, int64_t startTime, @@ -5880,6 +6008,7 @@ static int32_t prepareStbStmtInterlace( stbInfo, stmt, tableName, + tableSeq, batch, insertRows, 0, startTime, pSamplePos); @@ -5888,7 +6017,9 @@ static int32_t prepareStbStmtInterlace( static int32_t prepareStbStmtProgressive( SSuperTable *stbInfo, TAOS_STMT *stmt, - char *tableName, uint32_t batch, + char *tableName, + int64_t tableSeq, + uint32_t batch, uint64_t insertRows, uint64_t recordFrom, int64_t startTime, @@ -5898,6 +6029,7 @@ static int32_t prepareStbStmtProgressive( stbInfo, stmt, tableName, + tableSeq, g_args.num_of_RPR, insertRows, recordFrom, startTime, pSamplePos); @@ -5947,27 +6079,27 @@ static int32_t generateProgressiveDataWithoutStb( uint64_t recordFrom, int64_t startTime, /*int64_t *pSamplePos, */ int64_t *pRemainderBufLen) { - assert(buffer != NULL); - char *pstr = buffer; + assert(buffer != NULL); + char *pstr = buffer; - memset(buffer, 0, *pRemainderBufLen); + memset(buffer, 0, *pRemainderBufLen); - int64_t headLen = generateSQLHeadWithoutStb( - tableName, pThreadInfo->db_name, - buffer, *pRemainderBufLen); + int64_t headLen = generateSQLHeadWithoutStb( + tableName, pThreadInfo->db_name, + buffer, *pRemainderBufLen); - if (headLen <= 0) { - return 0; - } - pstr += headLen; - *pRemainderBufLen -= headLen; + if (headLen <= 0) { + return 0; + } + pstr += headLen; + *pRemainderBufLen -= headLen; - int64_t dataLen; + int64_t dataLen; - return generateDataTailWithoutStb( - g_args.num_of_RPR, pstr, *pRemainderBufLen, insertRows, recordFrom, - startTime, - /*pSamplePos, */&dataLen); + return generateDataTailWithoutStb( + g_args.num_of_RPR, pstr, *pRemainderBufLen, insertRows, recordFrom, + startTime, + /*pSamplePos, */&dataLen); } static void printStatPerThread(threadInfo *pThreadInfo) @@ -6010,7 +6142,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { insertRows = g_args.num_of_DPT; interlaceRows = g_args.interlace_rows; maxSqlLen = g_args.max_sql_len; - nTimeStampStep = DEFAULT_TIMESTAMP_STEP; + nTimeStampStep = g_args.timestamp_step; insert_interval = g_args.insert_interval; } @@ -6098,6 +6230,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { superTblInfo, pThreadInfo->stmt, tableName, + tableSeq, batchPerTbl, insertRows, i, startTime, @@ -6264,164 +6397,166 @@ free_of_interlace: // sync insertion progressive data static void* syncWriteProgressive(threadInfo *pThreadInfo) { - debugPrint("%s() LN%d: ### progressive write\n", __func__, __LINE__); + debugPrint("%s() LN%d: ### progressive write\n", __func__, __LINE__); - SSuperTable* superTblInfo = pThreadInfo->superTblInfo; - uint64_t maxSqlLen = superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len; - int64_t timeStampStep = - superTblInfo?superTblInfo->timeStampStep:DEFAULT_TIMESTAMP_STEP; - int64_t insertRows = + SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + uint64_t maxSqlLen = superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len; + int64_t timeStampStep = + superTblInfo?superTblInfo->timeStampStep:g_args.timestamp_step; + int64_t insertRows = (superTblInfo)?superTblInfo->insertRows:g_args.num_of_DPT; - verbosePrint("%s() LN%d insertRows=%"PRId64"\n", + verbosePrint("%s() LN%d insertRows=%"PRId64"\n", __func__, __LINE__, insertRows); - pThreadInfo->buffer = calloc(maxSqlLen, 1); - if (NULL == pThreadInfo->buffer) { - errorPrint( "Failed to alloc %"PRIu64" Bytes, reason:%s\n", - maxSqlLen, - strerror(errno)); - return NULL; - } - - uint64_t lastPrintTime = taosGetTimestampMs(); - uint64_t startTs = taosGetTimestampMs(); - uint64_t endTs; - - pThreadInfo->totalInsertRows = 0; - pThreadInfo->totalAffectedRows = 0; - - pThreadInfo->samplePos = 0; - - for (uint64_t tableSeq = pThreadInfo->start_table_from; - tableSeq <= pThreadInfo->end_table_to; - tableSeq ++) { - int64_t start_time = pThreadInfo->start_time; - - for (uint64_t i = 0; i < insertRows;) { - char tableName[TSDB_TABLE_NAME_LEN]; - getTableName(tableName, pThreadInfo, tableSeq); - verbosePrint("%s() LN%d: tid=%d seq=%"PRId64" tableName=%s\n", - __func__, __LINE__, - pThreadInfo->threadID, tableSeq, tableName); - if (0 == strlen(tableName)) { - errorPrint("[%d] %s() LN%d, getTableName return null\n", - pThreadInfo->threadID, __func__, __LINE__); - free(pThreadInfo->buffer); + pThreadInfo->buffer = calloc(maxSqlLen, 1); + if (NULL == pThreadInfo->buffer) { + errorPrint( "Failed to alloc %"PRIu64" Bytes, reason:%s\n", + maxSqlLen, + strerror(errno)); return NULL; - } + } + + uint64_t lastPrintTime = taosGetTimestampMs(); + uint64_t startTs = taosGetTimestampMs(); + uint64_t endTs; + + pThreadInfo->totalInsertRows = 0; + pThreadInfo->totalAffectedRows = 0; + + pThreadInfo->samplePos = 0; + + for (uint64_t tableSeq = pThreadInfo->start_table_from; + tableSeq <= pThreadInfo->end_table_to; + tableSeq ++) { + int64_t start_time = pThreadInfo->start_time; + + for (uint64_t i = 0; i < insertRows;) { + char tableName[TSDB_TABLE_NAME_LEN]; + getTableName(tableName, pThreadInfo, tableSeq); + verbosePrint("%s() LN%d: tid=%d seq=%"PRId64" tableName=%s\n", + __func__, __LINE__, + pThreadInfo->threadID, tableSeq, tableName); + if (0 == strlen(tableName)) { + errorPrint("[%d] %s() LN%d, getTableName return null\n", + pThreadInfo->threadID, __func__, __LINE__); + free(pThreadInfo->buffer); + return NULL; + } - int64_t remainderBufLen = maxSqlLen; - char *pstr = pThreadInfo->buffer; + int64_t remainderBufLen = maxSqlLen; + char *pstr = pThreadInfo->buffer; - int len = snprintf(pstr, - strlen(STR_INSERT_INTO) + 1, "%s", STR_INSERT_INTO); + int len = snprintf(pstr, + strlen(STR_INSERT_INTO) + 1, "%s", STR_INSERT_INTO); - pstr += len; - remainderBufLen -= len; + pstr += len; + remainderBufLen -= len; - int32_t generated; - if (superTblInfo) { - if (superTblInfo->iface == STMT_IFACE) { + int32_t generated; + if (superTblInfo) { + if (superTblInfo->iface == STMT_IFACE) { #if STMT_IFACE_ENABLED == 1 - generated = prepareStbStmtProgressive( - superTblInfo, - pThreadInfo->stmt, - tableName, - g_args.num_of_RPR, - insertRows, i, start_time, - &(pThreadInfo->samplePos)); + generated = prepareStbStmtProgressive( + superTblInfo, + pThreadInfo->stmt, + tableName, + tableSeq, + g_args.num_of_RPR, + insertRows, i, start_time, + &(pThreadInfo->samplePos)); #else - generated = -1; + generated = -1; #endif - } else { - generated = generateStbProgressiveData( - superTblInfo, - tableName, tableSeq, pThreadInfo->db_name, pstr, - insertRows, i, start_time, - &(pThreadInfo->samplePos), - &remainderBufLen); - } - } else { - if (g_args.iface == STMT_IFACE) { + } else { + generated = generateStbProgressiveData( + superTblInfo, + tableName, tableSeq, pThreadInfo->db_name, pstr, + insertRows, i, start_time, + &(pThreadInfo->samplePos), + &remainderBufLen); + } + } else { + if (g_args.iface == STMT_IFACE) { #if STMT_IFACE_ENABLED == 1 - generated = prepareStmtWithoutStb( - pThreadInfo->stmt, - tableName, - g_args.num_of_RPR, - insertRows, i, - start_time); + generated = prepareStmtWithoutStb( + pThreadInfo->stmt, + tableName, + g_args.num_of_RPR, + insertRows, i, + start_time); #else - generated = -1; + generated = -1; #endif - } else { - generated = generateProgressiveDataWithoutStb( - tableName, - /* tableSeq, */ - pThreadInfo, pstr, insertRows, - i, start_time, - /* &(pThreadInfo->samplePos), */ - &remainderBufLen); - } - } - if (generated > 0) - i += generated; - else - goto free_of_progressive; - - start_time += generated * timeStampStep; - pThreadInfo->totalInsertRows += generated; - - startTs = taosGetTimestampMs(); - - int32_t affectedRows = execInsert(pThreadInfo, generated); - - endTs = taosGetTimestampMs(); - uint64_t delay = endTs - startTs; - performancePrint("%s() LN%d, insert execution time is %"PRId64"ms\n", - __func__, __LINE__, delay); - verbosePrint("[%d] %s() LN%d affectedRows=%d\n", - pThreadInfo->threadID, - __func__, __LINE__, affectedRows); + } else { + generated = generateProgressiveDataWithoutStb( + tableName, + /* tableSeq, */ + pThreadInfo, pstr, insertRows, + i, start_time, + /* &(pThreadInfo->samplePos), */ + &remainderBufLen); + } + } + if (generated > 0) + i += generated; + else + goto free_of_progressive; - if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; - if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; - pThreadInfo->cntDelay++; - pThreadInfo->totalDelay += delay; + start_time += generated * timeStampStep; + pThreadInfo->totalInsertRows += generated; - if (affectedRows < 0) { - errorPrint("%s() LN%d, affected rows: %d\n", - __func__, __LINE__, affectedRows); - goto free_of_progressive; - } + startTs = taosGetTimestampMs(); - pThreadInfo->totalAffectedRows += affectedRows; + int32_t affectedRows = execInsert(pThreadInfo, generated); - int64_t currentPrintTime = taosGetTimestampMs(); - if (currentPrintTime - lastPrintTime > 30*1000) { - printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", + endTs = taosGetTimestampMs(); + uint64_t delay = endTs - startTs; + performancePrint("%s() LN%d, insert execution time is %"PRId64"ms\n", + __func__, __LINE__, delay); + verbosePrint("[%d] %s() LN%d affectedRows=%d\n", pThreadInfo->threadID, - pThreadInfo->totalInsertRows, - pThreadInfo->totalAffectedRows); - lastPrintTime = currentPrintTime; - } + __func__, __LINE__, affectedRows); - if (i >= insertRows) - break; - } // num_of_DPT + if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; + if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; + pThreadInfo->cntDelay++; + pThreadInfo->totalDelay += delay; - if ((g_args.verbose_print) && - (tableSeq == pThreadInfo->ntables - 1) && (superTblInfo) && - (0 == strncasecmp( - superTblInfo->dataSource, "sample", strlen("sample")))) { - verbosePrint("%s() LN%d samplePos=%"PRId64"\n", - __func__, __LINE__, pThreadInfo->samplePos); - } - } // tableSeq + if (affectedRows < 0) { + errorPrint("%s() LN%d, affected rows: %d\n", + __func__, __LINE__, affectedRows); + goto free_of_progressive; + } + + pThreadInfo->totalAffectedRows += affectedRows; + + int64_t currentPrintTime = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 30*1000) { + printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", + pThreadInfo->threadID, + pThreadInfo->totalInsertRows, + pThreadInfo->totalAffectedRows); + lastPrintTime = currentPrintTime; + } + + if (i >= insertRows) + break; + } // num_of_DPT + + if ((g_args.verbose_print) && + (tableSeq == pThreadInfo->ntables - 1) && (superTblInfo) + && (0 == strncasecmp( + superTblInfo->dataSource, + "sample", strlen("sample")))) { + verbosePrint("%s() LN%d samplePos=%"PRId64"\n", + __func__, __LINE__, pThreadInfo->samplePos); + } + } // tableSeq free_of_progressive: - tmfree(pThreadInfo->buffer); - printStatPerThread(pThreadInfo); - return NULL; + tmfree(pThreadInfo->buffer); + printStatPerThread(pThreadInfo); + return NULL; } static void* syncWrite(void *sarg) { @@ -6454,110 +6589,110 @@ static void* syncWrite(void *sarg) { } static void callBack(void *param, TAOS_RES *res, int code) { - threadInfo* pThreadInfo = (threadInfo*)param; - SSuperTable* superTblInfo = pThreadInfo->superTblInfo; - - int insert_interval = - superTblInfo?superTblInfo->insertInterval:g_args.insert_interval; - if (insert_interval) { - pThreadInfo->et = taosGetTimestampMs(); - if ((pThreadInfo->et - pThreadInfo->st) < insert_interval) { - taosMsleep(insert_interval - (pThreadInfo->et - pThreadInfo->st)); // ms - } - } - - char *buffer = calloc(1, pThreadInfo->superTblInfo->maxSqlLen); - char data[MAX_DATA_SIZE]; - char *pstr = buffer; - pstr += sprintf(pstr, "insert into %s.%s%"PRId64" values", - pThreadInfo->db_name, pThreadInfo->tb_prefix, - pThreadInfo->start_table_from); -// if (pThreadInfo->counter >= pThreadInfo->superTblInfo->insertRows) { - if (pThreadInfo->counter >= g_args.num_of_RPR) { - pThreadInfo->start_table_from++; - pThreadInfo->counter = 0; - } - if (pThreadInfo->start_table_from > pThreadInfo->end_table_to) { - tsem_post(&pThreadInfo->lock_sem); - free(buffer); - taos_free_result(res); - return; - } - - for (int i = 0; i < g_args.num_of_RPR; i++) { - int rand_num = taosRandom() % 100; - if (0 != pThreadInfo->superTblInfo->disorderRatio - && rand_num < pThreadInfo->superTblInfo->disorderRatio) { - int64_t d = pThreadInfo->lastTs - - (taosRandom() % pThreadInfo->superTblInfo->disorderRange + 1); - generateStbRowData(pThreadInfo->superTblInfo, data, d); - } else { - generateStbRowData(pThreadInfo->superTblInfo, - data, pThreadInfo->lastTs += 1000); + threadInfo* pThreadInfo = (threadInfo*)param; + SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + + int insert_interval = + superTblInfo?superTblInfo->insertInterval:g_args.insert_interval; + if (insert_interval) { + pThreadInfo->et = taosGetTimestampMs(); + if ((pThreadInfo->et - pThreadInfo->st) < insert_interval) { + taosMsleep(insert_interval - (pThreadInfo->et - pThreadInfo->st)); // ms + } } - pstr += sprintf(pstr, "%s", data); - pThreadInfo->counter++; - if (pThreadInfo->counter >= pThreadInfo->superTblInfo->insertRows) { - break; + char *buffer = calloc(1, pThreadInfo->superTblInfo->maxSqlLen); + char data[MAX_DATA_SIZE]; + char *pstr = buffer; + pstr += sprintf(pstr, "insert into %s.%s%"PRId64" values", + pThreadInfo->db_name, pThreadInfo->tb_prefix, + pThreadInfo->start_table_from); + // if (pThreadInfo->counter >= pThreadInfo->superTblInfo->insertRows) { + if (pThreadInfo->counter >= g_args.num_of_RPR) { + pThreadInfo->start_table_from++; + pThreadInfo->counter = 0; + } + if (pThreadInfo->start_table_from > pThreadInfo->end_table_to) { + tsem_post(&pThreadInfo->lock_sem); + free(buffer); + taos_free_result(res); + return; } - } - if (insert_interval) { - pThreadInfo->st = taosGetTimestampMs(); - } - taos_query_a(pThreadInfo->taos, buffer, callBack, pThreadInfo); - free(buffer); + for (int i = 0; i < g_args.num_of_RPR; i++) { + int rand_num = taosRandom() % 100; + if (0 != pThreadInfo->superTblInfo->disorderRatio + && rand_num < pThreadInfo->superTblInfo->disorderRatio) { + int64_t d = pThreadInfo->lastTs + - (taosRandom() % pThreadInfo->superTblInfo->disorderRange + 1); + generateStbRowData(pThreadInfo->superTblInfo, data, d); + } else { + generateStbRowData(pThreadInfo->superTblInfo, + data, pThreadInfo->lastTs += 1000); + } + pstr += sprintf(pstr, "%s", data); + pThreadInfo->counter++; - taos_free_result(res); -} + if (pThreadInfo->counter >= pThreadInfo->superTblInfo->insertRows) { + break; + } + } -static void *asyncWrite(void *sarg) { - threadInfo *pThreadInfo = (threadInfo *)sarg; - SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + if (insert_interval) { + pThreadInfo->st = taosGetTimestampMs(); + } + taos_query_a(pThreadInfo->taos, buffer, callBack, pThreadInfo); + free(buffer); - setThreadName("asyncWrite"); + taos_free_result(res); +} + +static void *asyncWrite(void *sarg) { + threadInfo *pThreadInfo = (threadInfo *)sarg; + SSuperTable* superTblInfo = pThreadInfo->superTblInfo; - pThreadInfo->st = 0; - pThreadInfo->et = 0; - pThreadInfo->lastTs = pThreadInfo->start_time; + setThreadName("asyncWrite"); - int insert_interval = - superTblInfo?superTblInfo->insertInterval:g_args.insert_interval; - if (insert_interval) { - pThreadInfo->st = taosGetTimestampMs(); - } - taos_query_a(pThreadInfo->taos, "show databases", callBack, pThreadInfo); + pThreadInfo->st = 0; + pThreadInfo->et = 0; + pThreadInfo->lastTs = pThreadInfo->start_time; - tsem_wait(&(pThreadInfo->lock_sem)); + int insert_interval = + superTblInfo?superTblInfo->insertInterval:g_args.insert_interval; + if (insert_interval) { + pThreadInfo->st = taosGetTimestampMs(); + } + taos_query_a(pThreadInfo->taos, "show databases", callBack, pThreadInfo); + + tsem_wait(&(pThreadInfo->lock_sem)); - return NULL; + return NULL; } static int convertHostToServAddr(char *host, uint16_t port, struct sockaddr_in *serv_addr) { - uint16_t rest_port = port + TSDB_PORT_HTTP; - struct hostent *server = gethostbyname(host); - if ((server == NULL) || (server->h_addr == NULL)) { - errorPrint("%s", "ERROR, no such host"); - return -1; - } + uint16_t rest_port = port + TSDB_PORT_HTTP; + struct hostent *server = gethostbyname(host); + if ((server == NULL) || (server->h_addr == NULL)) { + errorPrint("%s", "ERROR, no such host"); + return -1; + } - debugPrint("h_name: %s\nh_addr=%p\nh_addretype: %s\nh_length: %d\n", + debugPrint("h_name: %s\nh_addr=%p\nh_addretype: %s\nh_length: %d\n", server->h_name, server->h_addr, (server->h_addrtype == AF_INET)?"ipv4":"ipv6", server->h_length); - memset(serv_addr, 0, sizeof(struct sockaddr_in)); - serv_addr->sin_family = AF_INET; - serv_addr->sin_port = htons(rest_port); + memset(serv_addr, 0, sizeof(struct sockaddr_in)); + serv_addr->sin_family = AF_INET; + serv_addr->sin_port = htons(rest_port); #ifdef WINDOWS - serv_addr->sin_addr.s_addr = inet_addr(host); + serv_addr->sin_addr.s_addr = inet_addr(host); #else - memcpy(&(serv_addr->sin_addr.s_addr), server->h_addr, server->h_length); + memcpy(&(serv_addr->sin_addr.s_addr), server->h_addr, server->h_length); #endif - return 0; + return 0; } static void startMultiThreadInsertData(int threads, char* db_name, @@ -6626,14 +6761,17 @@ static void startMultiThreadInsertData(int threads, char* db_name, int64_t limit; uint64_t offset; - if ((NULL != g_args.sqlFile) && (superTblInfo->childTblExists == TBL_NO_EXISTS) && - ((superTblInfo->childTblOffset != 0) || (superTblInfo->childTblLimit >= 0))) { + if ((NULL != g_args.sqlFile) + && (superTblInfo->childTblExists == TBL_NO_EXISTS) + && ((superTblInfo->childTblOffset != 0) + || (superTblInfo->childTblLimit >= 0))) { printf("WARNING: offset and limit will not be used since the child tables not exists!\n"); } if (superTblInfo->childTblExists == TBL_ALREADY_EXISTS) { if ((superTblInfo->childTblLimit < 0) - || ((superTblInfo->childTblOffset + superTblInfo->childTblLimit) + || ((superTblInfo->childTblOffset + + superTblInfo->childTblLimit) > (superTblInfo->childTblCount))) { superTblInfo->childTblLimit = superTblInfo->childTblCount - superTblInfo->childTblOffset; @@ -6739,7 +6877,8 @@ static void startMultiThreadInsertData(int threads, char* db_name, #if STMT_IFACE_ENABLED == 1 if ((g_args.iface == STMT_IFACE) - || ((superTblInfo) && (superTblInfo->iface == STMT_IFACE))) { + || ((superTblInfo) + && (superTblInfo->iface == STMT_IFACE))) { int columnCount; if (superTblInfo) { @@ -6759,7 +6898,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, exit(-1); } - char buffer[3000]; + char buffer[BUFFER_SIZE]; char *pstr = buffer; if ((superTblInfo) @@ -6767,7 +6906,8 @@ static void startMultiThreadInsertData(int threads, char* db_name, == superTblInfo->autoCreateTable)) { pstr += sprintf(pstr, "INSERT INTO ? USING %s TAGS(?", superTblInfo->sTblName); - for (int tag = 0; tag < (superTblInfo->tagCount - 1); tag ++ ) { + for (int tag = 0; tag < (superTblInfo->tagCount - 1); + tag ++ ) { pstr += sprintf(pstr, ",?"); } pstr += sprintf(pstr, ") VALUES(?"); @@ -6916,157 +7056,157 @@ static void startMultiThreadInsertData(int threads, char* db_name, static void *readTable(void *sarg) { #if 1 - threadInfo *pThreadInfo = (threadInfo *)sarg; - TAOS *taos = pThreadInfo->taos; - setThreadName("readTable"); - char command[BUFFER_SIZE] = "\0"; - uint64_t sTime = pThreadInfo->start_time; - char *tb_prefix = pThreadInfo->tb_prefix; - FILE *fp = fopen(pThreadInfo->filePath, "a"); - if (NULL == fp) { - errorPrint( "fopen %s fail, reason:%s.\n", pThreadInfo->filePath, strerror(errno)); - return NULL; - } - - int64_t num_of_DPT; -/* if (pThreadInfo->superTblInfo) { - num_of_DPT = pThreadInfo->superTblInfo->insertRows; // nrecords_per_table; - } else { - */ - num_of_DPT = g_args.num_of_DPT; -// } - - int64_t num_of_tables = pThreadInfo->ntables; // rinfo->end_table_to - rinfo->start_table_from + 1; - int64_t totalData = num_of_DPT * num_of_tables; - bool do_aggreFunc = g_Dbs.do_aggreFunc; - - int n = do_aggreFunc ? (sizeof(aggreFunc) / sizeof(aggreFunc[0])) : 2; - if (!do_aggreFunc) { - printf("\nThe first field is either Binary or Bool. Aggregation functions are not supported.\n"); - } - printf("%"PRId64" records:\n", totalData); - fprintf(fp, "| QFunctions | QRecords | QSpeed(R/s) | QLatency(ms) |\n"); - - for (int j = 0; j < n; j++) { - double totalT = 0; - uint64_t count = 0; - for (int64_t i = 0; i < num_of_tables; i++) { - sprintf(command, "select %s from %s%"PRId64" where ts>= %" PRIu64, - aggreFunc[j], tb_prefix, i, sTime); - - double t = taosGetTimestampMs(); - TAOS_RES *pSql = taos_query(taos, command); - int32_t code = taos_errno(pSql); - - if (code != 0) { - errorPrint( "Failed to query:%s\n", taos_errstr(pSql)); - taos_free_result(pSql); - taos_close(taos); - fclose(fp); + threadInfo *pThreadInfo = (threadInfo *)sarg; + TAOS *taos = pThreadInfo->taos; + setThreadName("readTable"); + char command[BUFFER_SIZE] = "\0"; + uint64_t sTime = pThreadInfo->start_time; + char *tb_prefix = pThreadInfo->tb_prefix; + FILE *fp = fopen(pThreadInfo->filePath, "a"); + if (NULL == fp) { + errorPrint( "fopen %s fail, reason:%s.\n", pThreadInfo->filePath, strerror(errno)); return NULL; - } + } - while(taos_fetch_row(pSql) != NULL) { - count++; - } + int64_t num_of_DPT; + /* if (pThreadInfo->superTblInfo) { + num_of_DPT = pThreadInfo->superTblInfo->insertRows; // nrecords_per_table; + } else { + */ + num_of_DPT = g_args.num_of_DPT; + // } + + int64_t num_of_tables = pThreadInfo->ntables; // rinfo->end_table_to - rinfo->start_table_from + 1; + int64_t totalData = num_of_DPT * num_of_tables; + bool do_aggreFunc = g_Dbs.do_aggreFunc; + + int n = do_aggreFunc ? (sizeof(aggreFunc) / sizeof(aggreFunc[0])) : 2; + if (!do_aggreFunc) { + printf("\nThe first field is either Binary or Bool. Aggregation functions are not supported.\n"); + } + printf("%"PRId64" records:\n", totalData); + fprintf(fp, "| QFunctions | QRecords | QSpeed(R/s) | QLatency(ms) |\n"); + + for (int j = 0; j < n; j++) { + double totalT = 0; + uint64_t count = 0; + for (int64_t i = 0; i < num_of_tables; i++) { + sprintf(command, "select %s from %s%"PRId64" where ts>= %" PRIu64, + aggreFunc[j], tb_prefix, i, sTime); + + double t = taosGetTimestampMs(); + TAOS_RES *pSql = taos_query(taos, command); + int32_t code = taos_errno(pSql); + + if (code != 0) { + errorPrint( "Failed to query:%s\n", taos_errstr(pSql)); + taos_free_result(pSql); + taos_close(taos); + fclose(fp); + return NULL; + } + + while(taos_fetch_row(pSql) != NULL) { + count++; + } - t = taosGetTimestampMs() - t; - totalT += t; + t = taosGetTimestampMs() - t; + totalT += t; - taos_free_result(pSql); - } + taos_free_result(pSql); + } - fprintf(fp, "|%10s | %"PRId64" | %12.2f | %10.2f |\n", - aggreFunc[j][0] == '*' ? " * " : aggreFunc[j], totalData, - (double)(num_of_tables * num_of_DPT) / totalT, totalT * 1000); - printf("select %10s took %.6f second(s)\n", aggreFunc[j], totalT * 1000); - } - fprintf(fp, "\n"); - fclose(fp); + fprintf(fp, "|%10s | %"PRId64" | %12.2f | %10.2f |\n", + aggreFunc[j][0] == '*' ? " * " : aggreFunc[j], totalData, + (double)(num_of_tables * num_of_DPT) / totalT, totalT * 1000); + printf("select %10s took %.6f second(s)\n", aggreFunc[j], totalT * 1000); + } + fprintf(fp, "\n"); + fclose(fp); #endif - return NULL; + return NULL; } static void *readMetric(void *sarg) { #if 1 - threadInfo *pThreadInfo = (threadInfo *)sarg; - TAOS *taos = pThreadInfo->taos; - setThreadName("readMetric"); - char command[BUFFER_SIZE] = "\0"; - FILE *fp = fopen(pThreadInfo->filePath, "a"); - if (NULL == fp) { - printf("fopen %s fail, reason:%s.\n", pThreadInfo->filePath, strerror(errno)); - return NULL; - } + threadInfo *pThreadInfo = (threadInfo *)sarg; + TAOS *taos = pThreadInfo->taos; + setThreadName("readMetric"); + char command[BUFFER_SIZE] = "\0"; + FILE *fp = fopen(pThreadInfo->filePath, "a"); + if (NULL == fp) { + printf("fopen %s fail, reason:%s.\n", pThreadInfo->filePath, strerror(errno)); + return NULL; + } - int64_t num_of_DPT = pThreadInfo->superTblInfo->insertRows; - int64_t num_of_tables = pThreadInfo->ntables; // rinfo->end_table_to - rinfo->start_table_from + 1; - int64_t totalData = num_of_DPT * num_of_tables; - bool do_aggreFunc = g_Dbs.do_aggreFunc; + int64_t num_of_DPT = pThreadInfo->superTblInfo->insertRows; + int64_t num_of_tables = pThreadInfo->ntables; // rinfo->end_table_to - rinfo->start_table_from + 1; + int64_t totalData = num_of_DPT * num_of_tables; + bool do_aggreFunc = g_Dbs.do_aggreFunc; - int n = do_aggreFunc ? (sizeof(aggreFunc) / sizeof(aggreFunc[0])) : 2; - if (!do_aggreFunc) { - printf("\nThe first field is either Binary or Bool. Aggregation functions are not supported.\n"); - } - printf("%"PRId64" records:\n", totalData); - fprintf(fp, "Querying On %"PRId64" records:\n", totalData); + int n = do_aggreFunc ? (sizeof(aggreFunc) / sizeof(aggreFunc[0])) : 2; + if (!do_aggreFunc) { + printf("\nThe first field is either Binary or Bool. Aggregation functions are not supported.\n"); + } + printf("%"PRId64" records:\n", totalData); + fprintf(fp, "Querying On %"PRId64" records:\n", totalData); - for (int j = 0; j < n; j++) { - char condition[COND_BUF_LEN] = "\0"; - char tempS[64] = "\0"; + for (int j = 0; j < n; j++) { + char condition[COND_BUF_LEN] = "\0"; + char tempS[64] = "\0"; - int64_t m = 10 < num_of_tables ? 10 : num_of_tables; + int64_t m = 10 < num_of_tables ? 10 : num_of_tables; - for (int64_t i = 1; i <= m; i++) { - if (i == 1) { - sprintf(tempS, "t1 = %"PRId64"", i); - } else { - sprintf(tempS, " or t1 = %"PRId64" ", i); - } - strncat(condition, tempS, COND_BUF_LEN - 1); + for (int64_t i = 1; i <= m; i++) { + if (i == 1) { + sprintf(tempS, "t1 = %"PRId64"", i); + } else { + sprintf(tempS, " or t1 = %"PRId64" ", i); + } + strncat(condition, tempS, COND_BUF_LEN - 1); - sprintf(command, "select %s from meters where %s", aggreFunc[j], condition); + sprintf(command, "select %s from meters where %s", aggreFunc[j], condition); - printf("Where condition: %s\n", condition); - fprintf(fp, "%s\n", command); + printf("Where condition: %s\n", condition); + fprintf(fp, "%s\n", command); - double t = taosGetTimestampMs(); + double t = taosGetTimestampMs(); - TAOS_RES *pSql = taos_query(taos, command); - int32_t code = taos_errno(pSql); + TAOS_RES *pSql = taos_query(taos, command); + int32_t code = taos_errno(pSql); - if (code != 0) { - errorPrint( "Failed to query:%s\n", taos_errstr(pSql)); - taos_free_result(pSql); - taos_close(taos); - fclose(fp); - return NULL; - } - int count = 0; - while(taos_fetch_row(pSql) != NULL) { - count++; - } - t = taosGetTimestampMs() - t; + if (code != 0) { + errorPrint( "Failed to query:%s\n", taos_errstr(pSql)); + taos_free_result(pSql); + taos_close(taos); + fclose(fp); + return NULL; + } + int count = 0; + while(taos_fetch_row(pSql) != NULL) { + count++; + } + t = taosGetTimestampMs() - t; - fprintf(fp, "| Speed: %12.2f(per s) | Latency: %.4f(ms) |\n", - num_of_tables * num_of_DPT / (t * 1000.0), t); - printf("select %10s took %.6f second(s)\n\n", aggreFunc[j], t * 1000.0); + fprintf(fp, "| Speed: %12.2f(per s) | Latency: %.4f(ms) |\n", + num_of_tables * num_of_DPT / (t * 1000.0), t); + printf("select %10s took %.6f second(s)\n\n", aggreFunc[j], t * 1000.0); - taos_free_result(pSql); + taos_free_result(pSql); + } + fprintf(fp, "\n"); } - fprintf(fp, "\n"); - } - fclose(fp); + fclose(fp); #endif - return NULL; + return NULL; } static void prompt() { - if (!g_args.answer_yes) { - printf(" Press enter key to continue or Ctrl-C to stop\n\n"); - (void)getchar(); - } + if (!g_args.answer_yes) { + printf(" Press enter key to continue or Ctrl-C to stop\n\n"); + (void)getchar(); + } } static int insertTestProcess() { @@ -7166,369 +7306,369 @@ static int insertTestProcess() { } static void *specifiedTableQuery(void *sarg) { - threadInfo *pThreadInfo = (threadInfo *)sarg; + threadInfo *pThreadInfo = (threadInfo *)sarg; - setThreadName("specTableQuery"); + setThreadName("specTableQuery"); - if (pThreadInfo->taos == NULL) { - TAOS * taos = NULL; - taos = taos_connect(g_queryInfo.host, - g_queryInfo.user, - g_queryInfo.password, - NULL, - g_queryInfo.port); - if (taos == NULL) { - errorPrint("[%d] Failed to connect to TDengine, reason:%s\n", - pThreadInfo->threadID, taos_errstr(NULL)); - return NULL; - } else { - pThreadInfo->taos = taos; + if (pThreadInfo->taos == NULL) { + TAOS * taos = NULL; + taos = taos_connect(g_queryInfo.host, + g_queryInfo.user, + g_queryInfo.password, + NULL, + g_queryInfo.port); + if (taos == NULL) { + errorPrint("[%d] Failed to connect to TDengine, reason:%s\n", + pThreadInfo->threadID, taos_errstr(NULL)); + return NULL; + } else { + pThreadInfo->taos = taos; + } } - } - char sqlStr[TSDB_DB_NAME_LEN + 5]; - sprintf(sqlStr, "use %s", g_queryInfo.dbName); - if (0 != queryDbExec(pThreadInfo->taos, sqlStr, NO_INSERT_TYPE, false)) { - taos_close(pThreadInfo->taos); - errorPrint( "use database %s failed!\n\n", + char sqlStr[TSDB_DB_NAME_LEN + 5]; + sprintf(sqlStr, "use %s", g_queryInfo.dbName); + if (0 != queryDbExec(pThreadInfo->taos, sqlStr, NO_INSERT_TYPE, false)) { + taos_close(pThreadInfo->taos); + errorPrint( "use database %s failed!\n\n", g_queryInfo.dbName); - return NULL; - } + return NULL; + } - uint64_t st = 0; - uint64_t et = 0; + uint64_t st = 0; + uint64_t et = 0; - uint64_t queryTimes = g_queryInfo.specifiedQueryInfo.queryTimes; + uint64_t queryTimes = g_queryInfo.specifiedQueryInfo.queryTimes; - uint64_t totalQueried = 0; - uint64_t lastPrintTime = taosGetTimestampMs(); - uint64_t startTs = taosGetTimestampMs(); + uint64_t totalQueried = 0; + uint64_t lastPrintTime = taosGetTimestampMs(); + uint64_t startTs = taosGetTimestampMs(); - if (g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq][0] != '\0') { - sprintf(pThreadInfo->filePath, "%s-%d", + if (g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq][0] != '\0') { + sprintf(pThreadInfo->filePath, "%s-%d", g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq], pThreadInfo->threadID); - } - - while(queryTimes --) { - if (g_queryInfo.specifiedQueryInfo.queryInterval && (et - st) < - (int64_t)g_queryInfo.specifiedQueryInfo.queryInterval) { - taosMsleep(g_queryInfo.specifiedQueryInfo.queryInterval - (et - st)); // ms } - st = taosGetTimestampMs(); + while(queryTimes --) { + if (g_queryInfo.specifiedQueryInfo.queryInterval && (et - st) < + (int64_t)g_queryInfo.specifiedQueryInfo.queryInterval) { + taosMsleep(g_queryInfo.specifiedQueryInfo.queryInterval - (et - st)); // ms + } + + st = taosGetTimestampMs(); - selectAndGetResult(pThreadInfo, - g_queryInfo.specifiedQueryInfo.sql[pThreadInfo->querySeq]); + selectAndGetResult(pThreadInfo, + g_queryInfo.specifiedQueryInfo.sql[pThreadInfo->querySeq]); - et = taosGetTimestampMs(); - printf("=thread[%"PRId64"] use %s complete one sql, Spent %10.3f s\n", - taosGetSelfPthreadId(), g_queryInfo.queryMode, (et - st)/1000.0); + et = taosGetTimestampMs(); + printf("=thread[%"PRId64"] use %s complete one sql, Spent %10.3f s\n", + taosGetSelfPthreadId(), g_queryInfo.queryMode, (et - st)/1000.0); - totalQueried ++; - g_queryInfo.specifiedQueryInfo.totalQueried ++; + totalQueried ++; + g_queryInfo.specifiedQueryInfo.totalQueried ++; - uint64_t currentPrintTime = taosGetTimestampMs(); - uint64_t endTs = taosGetTimestampMs(); - if (currentPrintTime - lastPrintTime > 30*1000) { - debugPrint("%s() LN%d, endTs=%"PRIu64"ms, startTs=%"PRIu64"ms\n", - __func__, __LINE__, endTs, startTs); - printf("thread[%d] has currently completed queries: %"PRIu64", QPS: %10.6f\n", + uint64_t currentPrintTime = taosGetTimestampMs(); + uint64_t endTs = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 30*1000) { + debugPrint("%s() LN%d, endTs=%"PRIu64"ms, startTs=%"PRIu64"ms\n", + __func__, __LINE__, endTs, startTs); + printf("thread[%d] has currently completed queries: %"PRIu64", QPS: %10.6f\n", pThreadInfo->threadID, totalQueried, (double)(totalQueried/((endTs-startTs)/1000.0))); - lastPrintTime = currentPrintTime; + lastPrintTime = currentPrintTime; + } } - } - return NULL; + return NULL; } static void replaceChildTblName(char* inSql, char* outSql, int tblIndex) { - char sourceString[32] = "xxxx"; - char subTblName[MAX_TB_NAME_SIZE*3]; - sprintf(subTblName, "%s.%s", - g_queryInfo.dbName, - g_queryInfo.superQueryInfo.childTblName + tblIndex*TSDB_TABLE_NAME_LEN); + char sourceString[32] = "xxxx"; + char subTblName[TSDB_TABLE_NAME_LEN]; + sprintf(subTblName, "%s.%s", + g_queryInfo.dbName, + g_queryInfo.superQueryInfo.childTblName + tblIndex*TSDB_TABLE_NAME_LEN); - //printf("inSql: %s\n", inSql); + //printf("inSql: %s\n", inSql); - char* pos = strstr(inSql, sourceString); - if (0 == pos) { - return; - } - - tstrncpy(outSql, inSql, pos - inSql + 1); - //printf("1: %s\n", outSql); - strncat(outSql, subTblName, MAX_QUERY_SQL_LENGTH - 1); - //printf("2: %s\n", outSql); - strncat(outSql, pos+strlen(sourceString), MAX_QUERY_SQL_LENGTH - 1); - //printf("3: %s\n", outSql); + char* pos = strstr(inSql, sourceString); + if (0 == pos) { + return; + } + + tstrncpy(outSql, inSql, pos - inSql + 1); + //printf("1: %s\n", outSql); + strncat(outSql, subTblName, MAX_QUERY_SQL_LENGTH - 1); + //printf("2: %s\n", outSql); + strncat(outSql, pos+strlen(sourceString), MAX_QUERY_SQL_LENGTH - 1); + //printf("3: %s\n", outSql); } static void *superTableQuery(void *sarg) { - char sqlstr[MAX_QUERY_SQL_LENGTH]; - threadInfo *pThreadInfo = (threadInfo *)sarg; + char sqlstr[MAX_QUERY_SQL_LENGTH]; + threadInfo *pThreadInfo = (threadInfo *)sarg; - setThreadName("superTableQuery"); + setThreadName("superTableQuery"); - if (pThreadInfo->taos == NULL) { - TAOS * taos = NULL; - taos = taos_connect(g_queryInfo.host, - g_queryInfo.user, - g_queryInfo.password, - NULL, - g_queryInfo.port); - if (taos == NULL) { - errorPrint("[%d] Failed to connect to TDengine, reason:%s\n", - pThreadInfo->threadID, taos_errstr(NULL)); - return NULL; - } else { - pThreadInfo->taos = taos; + if (pThreadInfo->taos == NULL) { + TAOS * taos = NULL; + taos = taos_connect(g_queryInfo.host, + g_queryInfo.user, + g_queryInfo.password, + NULL, + g_queryInfo.port); + if (taos == NULL) { + errorPrint("[%d] Failed to connect to TDengine, reason:%s\n", + pThreadInfo->threadID, taos_errstr(NULL)); + return NULL; + } else { + pThreadInfo->taos = taos; + } } - } - uint64_t st = 0; - uint64_t et = (int64_t)g_queryInfo.superQueryInfo.queryInterval; + uint64_t st = 0; + uint64_t et = (int64_t)g_queryInfo.superQueryInfo.queryInterval; - uint64_t queryTimes = g_queryInfo.superQueryInfo.queryTimes; - uint64_t totalQueried = 0; - uint64_t startTs = taosGetTimestampMs(); + uint64_t queryTimes = g_queryInfo.superQueryInfo.queryTimes; + uint64_t totalQueried = 0; + uint64_t startTs = taosGetTimestampMs(); - uint64_t lastPrintTime = taosGetTimestampMs(); - while(queryTimes --) { - if (g_queryInfo.superQueryInfo.queryInterval - && (et - st) < (int64_t)g_queryInfo.superQueryInfo.queryInterval) { - taosMsleep(g_queryInfo.superQueryInfo.queryInterval - (et - st)); // ms - //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, pThreadInfo->start_table_from, pThreadInfo->end_table_to); - } - - st = taosGetTimestampMs(); - for (int i = pThreadInfo->start_table_from; i <= pThreadInfo->end_table_to; i++) { - for (int j = 0; j < g_queryInfo.superQueryInfo.sqlCount; j++) { - memset(sqlstr,0,sizeof(sqlstr)); - replaceChildTblName(g_queryInfo.superQueryInfo.sql[j], sqlstr, i); - if (g_queryInfo.superQueryInfo.result[j][0] != '\0') { - sprintf(pThreadInfo->filePath, "%s-%d", - g_queryInfo.superQueryInfo.result[j], - pThreadInfo->threadID); - } - selectAndGetResult(pThreadInfo, sqlstr); + uint64_t lastPrintTime = taosGetTimestampMs(); + while(queryTimes --) { + if (g_queryInfo.superQueryInfo.queryInterval + && (et - st) < (int64_t)g_queryInfo.superQueryInfo.queryInterval) { + taosMsleep(g_queryInfo.superQueryInfo.queryInterval - (et - st)); // ms + //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, pThreadInfo->start_table_from, pThreadInfo->end_table_to); + } + + st = taosGetTimestampMs(); + for (int i = pThreadInfo->start_table_from; i <= pThreadInfo->end_table_to; i++) { + for (int j = 0; j < g_queryInfo.superQueryInfo.sqlCount; j++) { + memset(sqlstr,0,sizeof(sqlstr)); + replaceChildTblName(g_queryInfo.superQueryInfo.sql[j], sqlstr, i); + if (g_queryInfo.superQueryInfo.result[j][0] != '\0') { + sprintf(pThreadInfo->filePath, "%s-%d", + g_queryInfo.superQueryInfo.result[j], + pThreadInfo->threadID); + } + selectAndGetResult(pThreadInfo, sqlstr); - totalQueried++; - g_queryInfo.superQueryInfo.totalQueried ++; + totalQueried++; + g_queryInfo.superQueryInfo.totalQueried ++; - int64_t currentPrintTime = taosGetTimestampMs(); - int64_t endTs = taosGetTimestampMs(); - if (currentPrintTime - lastPrintTime > 30*1000) { - printf("thread[%d] has currently completed queries: %"PRIu64", QPS: %10.3f\n", - pThreadInfo->threadID, - totalQueried, - (double)(totalQueried/((endTs-startTs)/1000.0))); - lastPrintTime = currentPrintTime; + int64_t currentPrintTime = taosGetTimestampMs(); + int64_t endTs = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 30*1000) { + printf("thread[%d] has currently completed queries: %"PRIu64", QPS: %10.3f\n", + pThreadInfo->threadID, + totalQueried, + (double)(totalQueried/((endTs-startTs)/1000.0))); + lastPrintTime = currentPrintTime; + } + } } - } + et = taosGetTimestampMs(); + printf("####thread[%"PRId64"] complete all sqls to allocate all sub-tables[%"PRIu64" - %"PRIu64"] once queries duration:%.4fs\n\n", + taosGetSelfPthreadId(), + pThreadInfo->start_table_from, + pThreadInfo->end_table_to, + (double)(et - st)/1000.0); } - et = taosGetTimestampMs(); - printf("####thread[%"PRId64"] complete all sqls to allocate all sub-tables[%"PRIu64" - %"PRIu64"] once queries duration:%.4fs\n\n", - taosGetSelfPthreadId(), - pThreadInfo->start_table_from, - pThreadInfo->end_table_to, - (double)(et - st)/1000.0); - } - return NULL; + return NULL; } static int queryTestProcess() { - setupForAnsiEscape(); - printfQueryMeta(); - resetAfterAnsiEscape(); - - TAOS * taos = NULL; - taos = taos_connect(g_queryInfo.host, - g_queryInfo.user, - g_queryInfo.password, - NULL, - g_queryInfo.port); - if (taos == NULL) { - errorPrint( "Failed to connect to TDengine, reason:%s\n", - taos_errstr(NULL)); - exit(-1); - } - - if (0 != g_queryInfo.superQueryInfo.sqlCount) { - getAllChildNameOfSuperTable(taos, - g_queryInfo.dbName, - g_queryInfo.superQueryInfo.sTblName, - &g_queryInfo.superQueryInfo.childTblName, - &g_queryInfo.superQueryInfo.childTblCount); - } + setupForAnsiEscape(); + printfQueryMeta(); + resetAfterAnsiEscape(); - prompt(); + TAOS * taos = NULL; + taos = taos_connect(g_queryInfo.host, + g_queryInfo.user, + g_queryInfo.password, + NULL, + g_queryInfo.port); + if (taos == NULL) { + errorPrint( "Failed to connect to TDengine, reason:%s\n", + taos_errstr(NULL)); + exit(-1); + } + + if (0 != g_queryInfo.superQueryInfo.sqlCount) { + getAllChildNameOfSuperTable(taos, + g_queryInfo.dbName, + g_queryInfo.superQueryInfo.sTblName, + &g_queryInfo.superQueryInfo.childTblName, + &g_queryInfo.superQueryInfo.childTblCount); + } - if (g_args.debug_print || g_args.verbose_print) { - printfQuerySystemInfo(taos); - } + prompt(); - if (0 == strncasecmp(g_queryInfo.queryMode, "rest", strlen("rest"))) { - if (convertHostToServAddr( - g_queryInfo.host, g_queryInfo.port, &g_queryInfo.serv_addr) != 0) - exit(-1); - } + if (g_args.debug_print || g_args.verbose_print) { + printfQuerySystemInfo(taos); + } - pthread_t *pids = NULL; - threadInfo *infos = NULL; - //==== create sub threads for query from specify table - int nConcurrent = g_queryInfo.specifiedQueryInfo.concurrent; - uint64_t nSqlCount = g_queryInfo.specifiedQueryInfo.sqlCount; + if (0 == strncasecmp(g_queryInfo.queryMode, "rest", strlen("rest"))) { + if (convertHostToServAddr( + g_queryInfo.host, g_queryInfo.port, &g_queryInfo.serv_addr) != 0) + exit(-1); + } - uint64_t startTs = taosGetTimestampMs(); + pthread_t *pids = NULL; + threadInfo *infos = NULL; + //==== create sub threads for query from specify table + int nConcurrent = g_queryInfo.specifiedQueryInfo.concurrent; + uint64_t nSqlCount = g_queryInfo.specifiedQueryInfo.sqlCount; - if ((nSqlCount > 0) && (nConcurrent > 0)) { + uint64_t startTs = taosGetTimestampMs(); - pids = calloc(1, nConcurrent * nSqlCount * sizeof(pthread_t)); - infos = calloc(1, nConcurrent * nSqlCount * sizeof(threadInfo)); + if ((nSqlCount > 0) && (nConcurrent > 0)) { - if ((NULL == pids) || (NULL == infos)) { - taos_close(taos); - ERROR_EXIT("memory allocation failed for create threads\n"); - } + pids = calloc(1, nConcurrent * nSqlCount * sizeof(pthread_t)); + infos = calloc(1, nConcurrent * nSqlCount * sizeof(threadInfo)); - for (uint64_t i = 0; i < nSqlCount; i++) { - for (int j = 0; j < nConcurrent; j++) { - uint64_t seq = i * nConcurrent + j; - threadInfo *pThreadInfo = infos + seq; - pThreadInfo->threadID = seq; - pThreadInfo->querySeq = i; + if ((NULL == pids) || (NULL == infos)) { + taos_close(taos); + ERROR_EXIT("memory allocation failed for create threads\n"); + } - if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", 5)) { + for (uint64_t i = 0; i < nSqlCount; i++) { + for (int j = 0; j < nConcurrent; j++) { + uint64_t seq = i * nConcurrent + j; + threadInfo *pThreadInfo = infos + seq; + pThreadInfo->threadID = seq; + pThreadInfo->querySeq = i; - char sqlStr[MAX_TB_NAME_SIZE*2]; - sprintf(sqlStr, "use %s", g_queryInfo.dbName); - if (0 != queryDbExec(taos, sqlStr, NO_INSERT_TYPE, false)) { - taos_close(taos); - free(infos); - free(pids); - errorPrint( "use database %s failed!\n\n", - g_queryInfo.dbName); - return -1; + if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", 5)) { + + char sqlStr[TSDB_DB_NAME_LEN + 5]; + sprintf(sqlStr, "USE %s", g_queryInfo.dbName); + if (0 != queryDbExec(taos, sqlStr, NO_INSERT_TYPE, false)) { + taos_close(taos); + free(infos); + free(pids); + errorPrint( "use database %s failed!\n\n", + g_queryInfo.dbName); + return -1; + } } - } - pThreadInfo->taos = NULL;// TODO: workaround to use separate taos connection; + pThreadInfo->taos = NULL;// TODO: workaround to use separate taos connection; - pthread_create(pids + seq, NULL, specifiedTableQuery, - pThreadInfo); + pthread_create(pids + seq, NULL, specifiedTableQuery, + pThreadInfo); + } } + } else { + g_queryInfo.specifiedQueryInfo.concurrent = 0; } - } else { - g_queryInfo.specifiedQueryInfo.concurrent = 0; - } - taos_close(taos); + taos_close(taos); - pthread_t *pidsOfSub = NULL; - threadInfo *infosOfSub = NULL; - //==== create sub threads for query from all sub table of the super table - if ((g_queryInfo.superQueryInfo.sqlCount > 0) - && (g_queryInfo.superQueryInfo.threadCnt > 0)) { - pidsOfSub = calloc(1, g_queryInfo.superQueryInfo.threadCnt * sizeof(pthread_t)); - infosOfSub = calloc(1, g_queryInfo.superQueryInfo.threadCnt * sizeof(threadInfo)); + pthread_t *pidsOfSub = NULL; + threadInfo *infosOfSub = NULL; + //==== create sub threads for query from all sub table of the super table + if ((g_queryInfo.superQueryInfo.sqlCount > 0) + && (g_queryInfo.superQueryInfo.threadCnt > 0)) { + pidsOfSub = calloc(1, g_queryInfo.superQueryInfo.threadCnt * sizeof(pthread_t)); + infosOfSub = calloc(1, g_queryInfo.superQueryInfo.threadCnt * sizeof(threadInfo)); - if ((NULL == pidsOfSub) || (NULL == infosOfSub)) { - free(infos); - free(pids); + if ((NULL == pidsOfSub) || (NULL == infosOfSub)) { + free(infos); + free(pids); - ERROR_EXIT("memory allocation failed for create threads\n"); - } + ERROR_EXIT("memory allocation failed for create threads\n"); + } - int64_t ntables = g_queryInfo.superQueryInfo.childTblCount; - int threads = g_queryInfo.superQueryInfo.threadCnt; + int64_t ntables = g_queryInfo.superQueryInfo.childTblCount; + int threads = g_queryInfo.superQueryInfo.threadCnt; - int64_t a = ntables / threads; - if (a < 1) { - threads = ntables; - a = 1; - } + int64_t a = ntables / threads; + if (a < 1) { + threads = ntables; + a = 1; + } - int64_t b = 0; - if (threads != 0) { - b = ntables % threads; - } + int64_t b = 0; + if (threads != 0) { + b = ntables % threads; + } - uint64_t tableFrom = 0; - for (int i = 0; i < threads; i++) { - threadInfo *pThreadInfo = infosOfSub + i; - pThreadInfo->threadID = i; + uint64_t tableFrom = 0; + for (int i = 0; i < threads; i++) { + threadInfo *pThreadInfo = infosOfSub + i; + pThreadInfo->threadID = i; - pThreadInfo->start_table_from = tableFrom; - pThreadInfo->ntables = iend_table_to = i < b ? tableFrom + a : tableFrom + a - 1; - tableFrom = pThreadInfo->end_table_to + 1; - pThreadInfo->taos = NULL; // TODO: workaround to use separate taos connection; - pthread_create(pidsOfSub + i, NULL, superTableQuery, pThreadInfo); - } + pThreadInfo->start_table_from = tableFrom; + pThreadInfo->ntables = iend_table_to = i < b ? tableFrom + a : tableFrom + a - 1; + tableFrom = pThreadInfo->end_table_to + 1; + pThreadInfo->taos = NULL; // TODO: workaround to use separate taos connection; + pthread_create(pidsOfSub + i, NULL, superTableQuery, pThreadInfo); + } - g_queryInfo.superQueryInfo.threadCnt = threads; - } else { - g_queryInfo.superQueryInfo.threadCnt = 0; - } + g_queryInfo.superQueryInfo.threadCnt = threads; + } else { + g_queryInfo.superQueryInfo.threadCnt = 0; + } - if ((nSqlCount > 0) && (nConcurrent > 0)) { - for (int i = 0; i < nConcurrent; i++) { - for (int j = 0; j < nSqlCount; j++) { - pthread_join(pids[i * nSqlCount + j], NULL); - } + if ((nSqlCount > 0) && (nConcurrent > 0)) { + for (int i = 0; i < nConcurrent; i++) { + for (int j = 0; j < nSqlCount; j++) { + pthread_join(pids[i * nSqlCount + j], NULL); + } + } } - } - tmfree((char*)pids); - tmfree((char*)infos); + tmfree((char*)pids); + tmfree((char*)infos); - for (int i = 0; i < g_queryInfo.superQueryInfo.threadCnt; i++) { - pthread_join(pidsOfSub[i], NULL); - } + for (int i = 0; i < g_queryInfo.superQueryInfo.threadCnt; i++) { + pthread_join(pidsOfSub[i], NULL); + } - tmfree((char*)pidsOfSub); - tmfree((char*)infosOfSub); + tmfree((char*)pidsOfSub); + tmfree((char*)infosOfSub); -// taos_close(taos);// TODO: workaround to use separate taos connection; - uint64_t endTs = taosGetTimestampMs(); + // taos_close(taos);// TODO: workaround to use separate taos connection; + uint64_t endTs = taosGetTimestampMs(); - uint64_t totalQueried = g_queryInfo.specifiedQueryInfo.totalQueried + - g_queryInfo.superQueryInfo.totalQueried; + uint64_t totalQueried = g_queryInfo.specifiedQueryInfo.totalQueried + + g_queryInfo.superQueryInfo.totalQueried; - fprintf(stderr, "==== completed total queries: %"PRIu64", the QPS of all threads: %10.3f====\n", - totalQueried, - (double)(totalQueried/((endTs-startTs)/1000.0))); - return 0; + fprintf(stderr, "==== completed total queries: %"PRIu64", the QPS of all threads: %10.3f====\n", + totalQueried, + (double)(totalQueried/((endTs-startTs)/1000.0))); + return 0; } static void stable_sub_callback( TAOS_SUB* tsub, TAOS_RES *res, void* param, int code) { - if (res == NULL || taos_errno(res) != 0) { - errorPrint("%s() LN%d, failed to subscribe result, code:%d, reason:%s\n", - __func__, __LINE__, code, taos_errstr(res)); - return; - } + if (res == NULL || taos_errno(res) != 0) { + errorPrint("%s() LN%d, failed to subscribe result, code:%d, reason:%s\n", + __func__, __LINE__, code, taos_errstr(res)); + return; + } - if (param) - fetchResult(res, (threadInfo *)param); - // tao_unscribe() will free result. + if (param) + fetchResult(res, (threadInfo *)param); + // tao_unscribe() will free result. } static void specified_sub_callback( TAOS_SUB* tsub, TAOS_RES *res, void* param, int code) { - if (res == NULL || taos_errno(res) != 0) { - errorPrint("%s() LN%d, failed to subscribe result, code:%d, reason:%s\n", - __func__, __LINE__, code, taos_errstr(res)); - return; - } + if (res == NULL || taos_errno(res) != 0) { + errorPrint("%s() LN%d, failed to subscribe result, code:%d, reason:%s\n", + __func__, __LINE__, code, taos_errstr(res)); + return; + } - if (param) - fetchResult(res, (threadInfo *)param); - // tao_unscribe() will free result. + if (param) + fetchResult(res, (threadInfo *)param); + // tao_unscribe() will free result. } static TAOS_SUB* subscribeImpl( @@ -7536,35 +7676,35 @@ static TAOS_SUB* subscribeImpl( threadInfo *pThreadInfo, char *sql, char* topic, bool restart, uint64_t interval) { - TAOS_SUB* tsub = NULL; - - if ((SPECIFIED_CLASS == class) - && (ASYNC_MODE == g_queryInfo.specifiedQueryInfo.asyncMode)) { - tsub = taos_subscribe( - pThreadInfo->taos, - restart, - topic, sql, specified_sub_callback, (void*)pThreadInfo, - g_queryInfo.specifiedQueryInfo.subscribeInterval); - } else if ((STABLE_CLASS == class) - && (ASYNC_MODE == g_queryInfo.superQueryInfo.asyncMode)) { - tsub = taos_subscribe( - pThreadInfo->taos, - restart, - topic, sql, stable_sub_callback, (void*)pThreadInfo, - g_queryInfo.superQueryInfo.subscribeInterval); - } else { - tsub = taos_subscribe( - pThreadInfo->taos, - restart, - topic, sql, NULL, NULL, interval); - } - - if (tsub == NULL) { - errorPrint("failed to create subscription. topic:%s, sql:%s\n", topic, sql); - return NULL; - } - - return tsub; + TAOS_SUB* tsub = NULL; + + if ((SPECIFIED_CLASS == class) + && (ASYNC_MODE == g_queryInfo.specifiedQueryInfo.asyncMode)) { + tsub = taos_subscribe( + pThreadInfo->taos, + restart, + topic, sql, specified_sub_callback, (void*)pThreadInfo, + g_queryInfo.specifiedQueryInfo.subscribeInterval); + } else if ((STABLE_CLASS == class) + && (ASYNC_MODE == g_queryInfo.superQueryInfo.asyncMode)) { + tsub = taos_subscribe( + pThreadInfo->taos, + restart, + topic, sql, stable_sub_callback, (void*)pThreadInfo, + g_queryInfo.superQueryInfo.subscribeInterval); + } else { + tsub = taos_subscribe( + pThreadInfo->taos, + restart, + topic, sql, NULL, NULL, interval); + } + + if (tsub == NULL) { + errorPrint("failed to create subscription. topic:%s, sql:%s\n", topic, sql); + return NULL; + } + + return tsub; } static void *superSubscribe(void *sarg) { @@ -7594,8 +7734,8 @@ static void *superSubscribe(void *sarg) { } } - char sqlStr[MAX_TB_NAME_SIZE*2]; - sprintf(sqlStr, "use %s", g_queryInfo.dbName); + char sqlStr[TSDB_DB_NAME_LEN + 5]; + sprintf(sqlStr, "USE %s", g_queryInfo.dbName); if (0 != queryDbExec(pThreadInfo->taos, sqlStr, NO_INSERT_TYPE, false)) { taos_close(pThreadInfo->taos); errorPrint( "use database %s failed!\n\n", @@ -7718,291 +7858,291 @@ static void *superSubscribe(void *sarg) { } static void *specifiedSubscribe(void *sarg) { - threadInfo *pThreadInfo = (threadInfo *)sarg; -// TAOS_SUB* tsub = NULL; + threadInfo *pThreadInfo = (threadInfo *)sarg; + // TAOS_SUB* tsub = NULL; - setThreadName("specSub"); + setThreadName("specSub"); - if (pThreadInfo->taos == NULL) { - pThreadInfo->taos = taos_connect(g_queryInfo.host, - g_queryInfo.user, - g_queryInfo.password, - g_queryInfo.dbName, - g_queryInfo.port); if (pThreadInfo->taos == NULL) { - errorPrint("[%d] Failed to connect to TDengine, reason:%s\n", - pThreadInfo->threadID, taos_errstr(NULL)); - return NULL; + pThreadInfo->taos = taos_connect(g_queryInfo.host, + g_queryInfo.user, + g_queryInfo.password, + g_queryInfo.dbName, + g_queryInfo.port); + if (pThreadInfo->taos == NULL) { + errorPrint("[%d] Failed to connect to TDengine, reason:%s\n", + pThreadInfo->threadID, taos_errstr(NULL)); + return NULL; + } } - } - char sqlStr[MAX_TB_NAME_SIZE*2]; - sprintf(sqlStr, "use %s", g_queryInfo.dbName); - if (0 != queryDbExec(pThreadInfo->taos, sqlStr, NO_INSERT_TYPE, false)) { - taos_close(pThreadInfo->taos); - return NULL; - } - - sprintf(g_queryInfo.specifiedQueryInfo.topic[pThreadInfo->threadID], - "taosdemo-subscribe-%"PRIu64"-%d", - pThreadInfo->querySeq, - pThreadInfo->threadID); - if (g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq][0] != '\0') { - sprintf(pThreadInfo->filePath, "%s-%d", + char sqlStr[TSDB_DB_NAME_LEN + 5]; + sprintf(sqlStr, "USE %s", g_queryInfo.dbName); + if (0 != queryDbExec(pThreadInfo->taos, sqlStr, NO_INSERT_TYPE, false)) { + taos_close(pThreadInfo->taos); + return NULL; + } + + sprintf(g_queryInfo.specifiedQueryInfo.topic[pThreadInfo->threadID], + "taosdemo-subscribe-%"PRIu64"-%d", + pThreadInfo->querySeq, + pThreadInfo->threadID); + if (g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq][0] != '\0') { + sprintf(pThreadInfo->filePath, "%s-%d", g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq], pThreadInfo->threadID); - } - g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID] = subscribeImpl( - SPECIFIED_CLASS, pThreadInfo, - g_queryInfo.specifiedQueryInfo.sql[pThreadInfo->querySeq], - g_queryInfo.specifiedQueryInfo.topic[pThreadInfo->threadID], - g_queryInfo.specifiedQueryInfo.subscribeRestart, - g_queryInfo.specifiedQueryInfo.subscribeInterval); - if (NULL == g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID]) { - taos_close(pThreadInfo->taos); - return NULL; - } - - // start loop to consume result - - g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] = 0; - while((g_queryInfo.specifiedQueryInfo.endAfterConsume[pThreadInfo->querySeq] == -1) - || (g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] < - g_queryInfo.specifiedQueryInfo.endAfterConsume[pThreadInfo->querySeq])) { - - printf("consumed[%d]: %d, endAfterConsum[%"PRId64"]: %d\n", - pThreadInfo->threadID, - g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID], - pThreadInfo->querySeq, - g_queryInfo.specifiedQueryInfo.endAfterConsume[pThreadInfo->querySeq]); - if (ASYNC_MODE == g_queryInfo.specifiedQueryInfo.asyncMode) { - continue; - } - - g_queryInfo.specifiedQueryInfo.res[pThreadInfo->threadID] = taos_consume( - g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID]); - if (g_queryInfo.specifiedQueryInfo.res[pThreadInfo->threadID]) { - if (g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq][0] - != 0) { - sprintf(pThreadInfo->filePath, "%s-%d", - g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq], - pThreadInfo->threadID); - } - fetchResult( - g_queryInfo.specifiedQueryInfo.res[pThreadInfo->threadID], - pThreadInfo); - - g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] ++; - if ((g_queryInfo.specifiedQueryInfo.resubAfterConsume[pThreadInfo->querySeq] != -1) - && (g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] >= - g_queryInfo.specifiedQueryInfo.resubAfterConsume[pThreadInfo->querySeq])) { - printf("keepProgress:%d, resub specified query: %"PRIu64"\n", - g_queryInfo.specifiedQueryInfo.subscribeKeepProgress, - pThreadInfo->querySeq); - g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] = 0; - taos_unsubscribe(g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID], - g_queryInfo.specifiedQueryInfo.subscribeKeepProgress); - g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID] = - subscribeImpl( - SPECIFIED_CLASS, - pThreadInfo, - g_queryInfo.specifiedQueryInfo.sql[pThreadInfo->querySeq], - g_queryInfo.specifiedQueryInfo.topic[pThreadInfo->threadID], - g_queryInfo.specifiedQueryInfo.subscribeRestart, - g_queryInfo.specifiedQueryInfo.subscribeInterval); - if (NULL == g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID]) { - taos_close(pThreadInfo->taos); - return NULL; - } - } - } - } - taos_free_result(g_queryInfo.specifiedQueryInfo.res[pThreadInfo->threadID]); - taos_close(pThreadInfo->taos); + } + g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID] = subscribeImpl( + SPECIFIED_CLASS, pThreadInfo, + g_queryInfo.specifiedQueryInfo.sql[pThreadInfo->querySeq], + g_queryInfo.specifiedQueryInfo.topic[pThreadInfo->threadID], + g_queryInfo.specifiedQueryInfo.subscribeRestart, + g_queryInfo.specifiedQueryInfo.subscribeInterval); + if (NULL == g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID]) { + taos_close(pThreadInfo->taos); + return NULL; + } + + // start loop to consume result + + g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] = 0; + while((g_queryInfo.specifiedQueryInfo.endAfterConsume[pThreadInfo->querySeq] == -1) + || (g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] < + g_queryInfo.specifiedQueryInfo.endAfterConsume[pThreadInfo->querySeq])) { + + printf("consumed[%d]: %d, endAfterConsum[%"PRId64"]: %d\n", + pThreadInfo->threadID, + g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID], + pThreadInfo->querySeq, + g_queryInfo.specifiedQueryInfo.endAfterConsume[pThreadInfo->querySeq]); + if (ASYNC_MODE == g_queryInfo.specifiedQueryInfo.asyncMode) { + continue; + } - return NULL; + g_queryInfo.specifiedQueryInfo.res[pThreadInfo->threadID] = taos_consume( + g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID]); + if (g_queryInfo.specifiedQueryInfo.res[pThreadInfo->threadID]) { + if (g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq][0] + != 0) { + sprintf(pThreadInfo->filePath, "%s-%d", + g_queryInfo.specifiedQueryInfo.result[pThreadInfo->querySeq], + pThreadInfo->threadID); + } + fetchResult( + g_queryInfo.specifiedQueryInfo.res[pThreadInfo->threadID], + pThreadInfo); + + g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] ++; + if ((g_queryInfo.specifiedQueryInfo.resubAfterConsume[pThreadInfo->querySeq] != -1) + && (g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] >= + g_queryInfo.specifiedQueryInfo.resubAfterConsume[pThreadInfo->querySeq])) { + printf("keepProgress:%d, resub specified query: %"PRIu64"\n", + g_queryInfo.specifiedQueryInfo.subscribeKeepProgress, + pThreadInfo->querySeq); + g_queryInfo.specifiedQueryInfo.consumed[pThreadInfo->threadID] = 0; + taos_unsubscribe(g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID], + g_queryInfo.specifiedQueryInfo.subscribeKeepProgress); + g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID] = + subscribeImpl( + SPECIFIED_CLASS, + pThreadInfo, + g_queryInfo.specifiedQueryInfo.sql[pThreadInfo->querySeq], + g_queryInfo.specifiedQueryInfo.topic[pThreadInfo->threadID], + g_queryInfo.specifiedQueryInfo.subscribeRestart, + g_queryInfo.specifiedQueryInfo.subscribeInterval); + if (NULL == g_queryInfo.specifiedQueryInfo.tsub[pThreadInfo->threadID]) { + taos_close(pThreadInfo->taos); + return NULL; + } + } + } + } + taos_free_result(g_queryInfo.specifiedQueryInfo.res[pThreadInfo->threadID]); + taos_close(pThreadInfo->taos); + + return NULL; } static int subscribeTestProcess() { - setupForAnsiEscape(); - printfQueryMeta(); - resetAfterAnsiEscape(); - - prompt(); - - TAOS * taos = NULL; - taos = taos_connect(g_queryInfo.host, - g_queryInfo.user, - g_queryInfo.password, - g_queryInfo.dbName, - g_queryInfo.port); - if (taos == NULL) { - errorPrint( "Failed to connect to TDengine, reason:%s\n", - taos_errstr(NULL)); - exit(-1); - } - - if (0 != g_queryInfo.superQueryInfo.sqlCount) { - getAllChildNameOfSuperTable(taos, + setupForAnsiEscape(); + printfQueryMeta(); + resetAfterAnsiEscape(); + + prompt(); + + TAOS * taos = NULL; + taos = taos_connect(g_queryInfo.host, + g_queryInfo.user, + g_queryInfo.password, g_queryInfo.dbName, - g_queryInfo.superQueryInfo.sTblName, - &g_queryInfo.superQueryInfo.childTblName, - &g_queryInfo.superQueryInfo.childTblCount); - } - - taos_close(taos); // TODO: workaround to use separate taos connection; - - pthread_t *pids = NULL; - threadInfo *infos = NULL; - - pthread_t *pidsOfStable = NULL; - threadInfo *infosOfStable = NULL; - - //==== create threads for query for specified table - if (g_queryInfo.specifiedQueryInfo.sqlCount <= 0) { - debugPrint("%s() LN%d, sepcified query sqlCount %d.\n", - __func__, __LINE__, - g_queryInfo.specifiedQueryInfo.sqlCount); - } else { - if (g_queryInfo.specifiedQueryInfo.concurrent <= 0) { - errorPrint("%s() LN%d, sepcified query sqlCount %d.\n", - __func__, __LINE__, - g_queryInfo.specifiedQueryInfo.sqlCount); + g_queryInfo.port); + if (taos == NULL) { + errorPrint( "Failed to connect to TDengine, reason:%s\n", + taos_errstr(NULL)); exit(-1); } - pids = calloc( - 1, - g_queryInfo.specifiedQueryInfo.sqlCount * - g_queryInfo.specifiedQueryInfo.concurrent * - sizeof(pthread_t)); - infos = calloc( - 1, - g_queryInfo.specifiedQueryInfo.sqlCount * - g_queryInfo.specifiedQueryInfo.concurrent * - sizeof(threadInfo)); - if ((NULL == pids) || (NULL == infos)) { - errorPrint("%s() LN%d, malloc failed for create threads\n", __func__, __LINE__); - exit(-1); + if (0 != g_queryInfo.superQueryInfo.sqlCount) { + getAllChildNameOfSuperTable(taos, + g_queryInfo.dbName, + g_queryInfo.superQueryInfo.sTblName, + &g_queryInfo.superQueryInfo.childTblName, + &g_queryInfo.superQueryInfo.childTblCount); } - for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqlCount; i++) { - for (int j = 0; j < g_queryInfo.specifiedQueryInfo.concurrent; j++) { - uint64_t seq = i * g_queryInfo.specifiedQueryInfo.concurrent + j; - threadInfo *pThreadInfo = infos + seq; - pThreadInfo->threadID = seq; - pThreadInfo->querySeq = i; - pThreadInfo->taos = NULL; // TODO: workaround to use separate taos connection; - pthread_create(pids + seq, NULL, specifiedSubscribe, pThreadInfo); + taos_close(taos); // TODO: workaround to use separate taos connection; + + pthread_t *pids = NULL; + threadInfo *infos = NULL; + + pthread_t *pidsOfStable = NULL; + threadInfo *infosOfStable = NULL; + + //==== create threads for query for specified table + if (g_queryInfo.specifiedQueryInfo.sqlCount <= 0) { + debugPrint("%s() LN%d, sepcified query sqlCount %d.\n", + __func__, __LINE__, + g_queryInfo.specifiedQueryInfo.sqlCount); + } else { + if (g_queryInfo.specifiedQueryInfo.concurrent <= 0) { + errorPrint("%s() LN%d, sepcified query sqlCount %d.\n", + __func__, __LINE__, + g_queryInfo.specifiedQueryInfo.sqlCount); + exit(-1); } - } - } - //==== create threads for super table query - if (g_queryInfo.superQueryInfo.sqlCount <= 0) { - debugPrint("%s() LN%d, super table query sqlCount %d.\n", - __func__, __LINE__, - g_queryInfo.superQueryInfo.sqlCount); - } else { - if ((g_queryInfo.superQueryInfo.sqlCount > 0) - && (g_queryInfo.superQueryInfo.threadCnt > 0)) { - pidsOfStable = calloc( + pids = calloc( 1, - g_queryInfo.superQueryInfo.sqlCount * - g_queryInfo.superQueryInfo.threadCnt * - sizeof(pthread_t)); - infosOfStable = calloc( + g_queryInfo.specifiedQueryInfo.sqlCount * + g_queryInfo.specifiedQueryInfo.concurrent * + sizeof(pthread_t)); + infos = calloc( 1, - g_queryInfo.superQueryInfo.sqlCount * - g_queryInfo.superQueryInfo.threadCnt * - sizeof(threadInfo)); - if ((NULL == pidsOfStable) || (NULL == infosOfStable)) { - errorPrint("%s() LN%d, malloc failed for create threads\n", - __func__, __LINE__); - // taos_close(taos); + g_queryInfo.specifiedQueryInfo.sqlCount * + g_queryInfo.specifiedQueryInfo.concurrent * + sizeof(threadInfo)); + if ((NULL == pids) || (NULL == infos)) { + errorPrint("%s() LN%d, malloc failed for create threads\n", __func__, __LINE__); exit(-1); } - int64_t ntables = g_queryInfo.superQueryInfo.childTblCount; - int threads = g_queryInfo.superQueryInfo.threadCnt; - - int64_t a = ntables / threads; - if (a < 1) { - threads = ntables; - a = 1; + for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqlCount; i++) { + for (int j = 0; j < g_queryInfo.specifiedQueryInfo.concurrent; j++) { + uint64_t seq = i * g_queryInfo.specifiedQueryInfo.concurrent + j; + threadInfo *pThreadInfo = infos + seq; + pThreadInfo->threadID = seq; + pThreadInfo->querySeq = i; + pThreadInfo->taos = NULL; // TODO: workaround to use separate taos connection; + pthread_create(pids + seq, NULL, specifiedSubscribe, pThreadInfo); + } } + } - int64_t b = 0; - if (threads != 0) { - b = ntables % threads; - } + //==== create threads for super table query + if (g_queryInfo.superQueryInfo.sqlCount <= 0) { + debugPrint("%s() LN%d, super table query sqlCount %d.\n", + __func__, __LINE__, + g_queryInfo.superQueryInfo.sqlCount); + } else { + if ((g_queryInfo.superQueryInfo.sqlCount > 0) + && (g_queryInfo.superQueryInfo.threadCnt > 0)) { + pidsOfStable = calloc( + 1, + g_queryInfo.superQueryInfo.sqlCount * + g_queryInfo.superQueryInfo.threadCnt * + sizeof(pthread_t)); + infosOfStable = calloc( + 1, + g_queryInfo.superQueryInfo.sqlCount * + g_queryInfo.superQueryInfo.threadCnt * + sizeof(threadInfo)); + if ((NULL == pidsOfStable) || (NULL == infosOfStable)) { + errorPrint("%s() LN%d, malloc failed for create threads\n", + __func__, __LINE__); + // taos_close(taos); + exit(-1); + } - for (uint64_t i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) { - uint64_t tableFrom = 0; - for (int j = 0; j < threads; j++) { - uint64_t seq = i * threads + j; - threadInfo *pThreadInfo = infosOfStable + seq; - pThreadInfo->threadID = seq; - pThreadInfo->querySeq = i; + int64_t ntables = g_queryInfo.superQueryInfo.childTblCount; + int threads = g_queryInfo.superQueryInfo.threadCnt; - pThreadInfo->start_table_from = tableFrom; - pThreadInfo->ntables = jend_table_to = jend_table_to + 1; - pThreadInfo->taos = NULL; // TODO: workaround to use separate taos connection; - pthread_create(pidsOfStable + seq, - NULL, superSubscribe, pThreadInfo); + int64_t a = ntables / threads; + if (a < 1) { + threads = ntables; + a = 1; } - } - g_queryInfo.superQueryInfo.threadCnt = threads; + int64_t b = 0; + if (threads != 0) { + b = ntables % threads; + } + + for (uint64_t i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) { + uint64_t tableFrom = 0; + for (int j = 0; j < threads; j++) { + uint64_t seq = i * threads + j; + threadInfo *pThreadInfo = infosOfStable + seq; + pThreadInfo->threadID = seq; + pThreadInfo->querySeq = i; - for (int i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) { - for (int j = 0; j < threads; j++) { - uint64_t seq = i * threads + j; - pthread_join(pidsOfStable[seq], NULL); + pThreadInfo->start_table_from = tableFrom; + pThreadInfo->ntables = jend_table_to = jend_table_to + 1; + pThreadInfo->taos = NULL; // TODO: workaround to use separate taos connection; + pthread_create(pidsOfStable + seq, + NULL, superSubscribe, pThreadInfo); + } + } + + g_queryInfo.superQueryInfo.threadCnt = threads; + + for (int i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) { + for (int j = 0; j < threads; j++) { + uint64_t seq = i * threads + j; + pthread_join(pidsOfStable[seq], NULL); + } } } } - } - for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqlCount; i++) { - for (int j = 0; j < g_queryInfo.specifiedQueryInfo.concurrent; j++) { - uint64_t seq = i * g_queryInfo.specifiedQueryInfo.concurrent + j; - pthread_join(pids[seq], NULL); + for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqlCount; i++) { + for (int j = 0; j < g_queryInfo.specifiedQueryInfo.concurrent; j++) { + uint64_t seq = i * g_queryInfo.specifiedQueryInfo.concurrent + j; + pthread_join(pids[seq], NULL); + } } - } - tmfree((char*)pids); - tmfree((char*)infos); + tmfree((char*)pids); + tmfree((char*)infos); - tmfree((char*)pidsOfStable); - tmfree((char*)infosOfStable); -// taos_close(taos); - return 0; + tmfree((char*)pidsOfStable); + tmfree((char*)infosOfStable); + // taos_close(taos); + return 0; } static void initOfInsertMeta() { - memset(&g_Dbs, 0, sizeof(SDbs)); + memset(&g_Dbs, 0, sizeof(SDbs)); - // set default values - tstrncpy(g_Dbs.host, "127.0.0.1", MAX_HOSTNAME_SIZE); - g_Dbs.port = 6030; - tstrncpy(g_Dbs.user, TSDB_DEFAULT_USER, MAX_USERNAME_SIZE); - tstrncpy(g_Dbs.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE); - g_Dbs.threadCount = 2; + // set default values + tstrncpy(g_Dbs.host, "127.0.0.1", MAX_HOSTNAME_SIZE); + g_Dbs.port = 6030; + tstrncpy(g_Dbs.user, TSDB_DEFAULT_USER, MAX_USERNAME_SIZE); + tstrncpy(g_Dbs.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE); + g_Dbs.threadCount = 2; - g_Dbs.use_metric = g_args.use_metric; + g_Dbs.use_metric = g_args.use_metric; } static void initOfQueryMeta() { - memset(&g_queryInfo, 0, sizeof(SQueryMetaInfo)); + memset(&g_queryInfo, 0, sizeof(SQueryMetaInfo)); - // set default values - tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE); - g_queryInfo.port = 6030; - tstrncpy(g_queryInfo.user, TSDB_DEFAULT_USER, MAX_USERNAME_SIZE); - tstrncpy(g_queryInfo.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE); + // set default values + tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE); + g_queryInfo.port = 6030; + tstrncpy(g_queryInfo.user, TSDB_DEFAULT_USER, MAX_USERNAME_SIZE); + tstrncpy(g_queryInfo.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE); } static void setParaFromArg() { @@ -8032,7 +8172,7 @@ static void setParaFromArg() { tstrncpy(g_Dbs.db[0].dbName, g_args.database, TSDB_DB_NAME_LEN); g_Dbs.db[0].dbCfg.replica = g_args.replica; - tstrncpy(g_Dbs.db[0].dbCfg.precision, "ms", 8); + tstrncpy(g_Dbs.db[0].dbCfg.precision, "ms", SMALL_BUFF_LEN); tstrncpy(g_Dbs.resultFile, g_args.output_file, MAX_FILE_NAME_LEN); @@ -8065,8 +8205,8 @@ static void setParaFromArg() { g_Dbs.db[0].superTbls[0].disorderRange = g_args.disorderRange; g_Dbs.db[0].superTbls[0].disorderRatio = g_args.disorderRatio; tstrncpy(g_Dbs.db[0].superTbls[0].childTblPrefix, - g_args.tb_prefix, TSDB_TABLE_NAME_LEN - 20); - tstrncpy(g_Dbs.db[0].superTbls[0].dataSource, "rand", MAX_TB_NAME_SIZE); + g_args.tb_prefix, TBNAME_PREFIX_LEN); + tstrncpy(g_Dbs.db[0].superTbls[0].dataSource, "rand", SMALL_BUFF_LEN); if (g_args.iface == INTERFACE_BUT) { g_Dbs.db[0].superTbls[0].iface = TAOSC_IFACE; @@ -8075,7 +8215,7 @@ static void setParaFromArg() { } tstrncpy(g_Dbs.db[0].superTbls[0].startTimestamp, "2017-07-14 10:40:00.000", MAX_TB_NAME_SIZE); - g_Dbs.db[0].superTbls[0].timeStampStep = DEFAULT_TIMESTAMP_STEP; + g_Dbs.db[0].superTbls[0].timeStampStep = g_args.timestamp_step; g_Dbs.db[0].superTbls[0].insertRows = g_args.num_of_DPT; g_Dbs.db[0].superTbls[0].maxSqlLen = g_args.max_sql_len; @@ -8087,7 +8227,7 @@ static void setParaFromArg() { } tstrncpy(g_Dbs.db[0].superTbls[0].columns[i].dataType, - data_type[i], strlen(data_type[i]) + 1); + data_type[i], min(DATATYPE_BUFF_LEN, strlen(data_type[i]) + 1)); g_Dbs.db[0].superTbls[0].columns[i].dataLen = g_args.len_of_binary; g_Dbs.db[0].superTbls[0].columnCount++; } @@ -8098,18 +8238,18 @@ static void setParaFromArg() { for (int i = g_Dbs.db[0].superTbls[0].columnCount; i < g_args.num_of_CPR; i++) { tstrncpy(g_Dbs.db[0].superTbls[0].columns[i].dataType, - "INT", strlen("INT") + 1); + "INT", min(DATATYPE_BUFF_LEN, strlen("INT") + 1)); g_Dbs.db[0].superTbls[0].columns[i].dataLen = 0; g_Dbs.db[0].superTbls[0].columnCount++; } } tstrncpy(g_Dbs.db[0].superTbls[0].tags[0].dataType, - "INT", strlen("INT") + 1); + "INT", min(DATATYPE_BUFF_LEN, strlen("INT") + 1)); g_Dbs.db[0].superTbls[0].tags[0].dataLen = 0; tstrncpy(g_Dbs.db[0].superTbls[0].tags[1].dataType, - "BINARY", strlen("BINARY") + 1); + "BINARY", min(DATATYPE_BUFF_LEN, strlen("BINARY") + 1)); g_Dbs.db[0].superTbls[0].tags[1].dataLen = g_args.len_of_binary; g_Dbs.db[0].superTbls[0].tagCount = 2; } else { @@ -8120,219 +8260,219 @@ static void setParaFromArg() { /* Function to do regular expression check */ static int regexMatch(const char *s, const char *reg, int cflags) { - regex_t regex; - char msgbuf[100] = {0}; - - /* Compile regular expression */ - if (regcomp(®ex, reg, cflags) != 0) { - printf("Fail to compile regex\n"); - exit(-1); - } - - /* Execute regular expression */ - int reti = regexec(®ex, s, 0, NULL, 0); - if (!reti) { - regfree(®ex); - return 1; - } else if (reti == REG_NOMATCH) { - regfree(®ex); + regex_t regex; + char msgbuf[100] = {0}; + + /* Compile regular expression */ + if (regcomp(®ex, reg, cflags) != 0) { + printf("Fail to compile regex\n"); + exit(-1); + } + + /* Execute regular expression */ + int reti = regexec(®ex, s, 0, NULL, 0); + if (!reti) { + regfree(®ex); + return 1; + } else if (reti == REG_NOMATCH) { + regfree(®ex); + return 0; + } else { + regerror(reti, ®ex, msgbuf, sizeof(msgbuf)); + printf("Regex match failed: %s\n", msgbuf); + regfree(®ex); + exit(-1); + } + return 0; - } else { - regerror(reti, ®ex, msgbuf, sizeof(msgbuf)); - printf("Regex match failed: %s\n", msgbuf); - regfree(®ex); - exit(-1); - } - - return 0; } static int isCommentLine(char *line) { - if (line == NULL) return 1; + if (line == NULL) return 1; - return regexMatch(line, "^\\s*#.*", REG_EXTENDED); + return regexMatch(line, "^\\s*#.*", REG_EXTENDED); } static void querySqlFile(TAOS* taos, char* sqlFile) { - FILE *fp = fopen(sqlFile, "r"); - if (fp == NULL) { - printf("failed to open file %s, reason:%s\n", sqlFile, strerror(errno)); - return; - } + FILE *fp = fopen(sqlFile, "r"); + if (fp == NULL) { + printf("failed to open file %s, reason:%s\n", sqlFile, strerror(errno)); + return; + } - int read_len = 0; - char * cmd = calloc(1, TSDB_MAX_BYTES_PER_ROW); - size_t cmd_len = 0; - char * line = NULL; - size_t line_len = 0; + int read_len = 0; + char * cmd = calloc(1, TSDB_MAX_BYTES_PER_ROW); + size_t cmd_len = 0; + char * line = NULL; + size_t line_len = 0; - double t = taosGetTimestampMs(); + double t = taosGetTimestampMs(); - while((read_len = tgetline(&line, &line_len, fp)) != -1) { - if (read_len >= TSDB_MAX_BYTES_PER_ROW) continue; - line[--read_len] = '\0'; + while((read_len = tgetline(&line, &line_len, fp)) != -1) { + if (read_len >= TSDB_MAX_BYTES_PER_ROW) continue; + line[--read_len] = '\0'; - if (read_len == 0 || isCommentLine(line)) { // line starts with # - continue; - } + if (read_len == 0 || isCommentLine(line)) { // line starts with # + continue; + } - if (line[read_len - 1] == '\\') { - line[read_len - 1] = ' '; - memcpy(cmd + cmd_len, line, read_len); - cmd_len += read_len; - continue; - } + if (line[read_len - 1] == '\\') { + line[read_len - 1] = ' '; + memcpy(cmd + cmd_len, line, read_len); + cmd_len += read_len; + continue; + } - memcpy(cmd + cmd_len, line, read_len); - if (0 != queryDbExec(taos, cmd, NO_INSERT_TYPE, false)) { - errorPrint("%s() LN%d, queryDbExec %s failed!\n", - __func__, __LINE__, cmd); - tmfree(cmd); - tmfree(line); - tmfclose(fp); - return; + memcpy(cmd + cmd_len, line, read_len); + if (0 != queryDbExec(taos, cmd, NO_INSERT_TYPE, false)) { + errorPrint("%s() LN%d, queryDbExec %s failed!\n", + __func__, __LINE__, cmd); + tmfree(cmd); + tmfree(line); + tmfclose(fp); + return; + } + memset(cmd, 0, TSDB_MAX_BYTES_PER_ROW); + cmd_len = 0; } - memset(cmd, 0, TSDB_MAX_BYTES_PER_ROW); - cmd_len = 0; - } - t = taosGetTimestampMs() - t; - printf("run %s took %.6f second(s)\n\n", sqlFile, t); + t = taosGetTimestampMs() - t; + printf("run %s took %.6f second(s)\n\n", sqlFile, t); - tmfree(cmd); - tmfree(line); - tmfclose(fp); - return; + tmfree(cmd); + tmfree(line); + tmfclose(fp); + return; } static void testMetaFile() { if (INSERT_TEST == g_args.test_mode) { - if (g_Dbs.cfgDir[0]) - taos_options(TSDB_OPTION_CONFIGDIR, g_Dbs.cfgDir); + if (g_Dbs.cfgDir[0]) + taos_options(TSDB_OPTION_CONFIGDIR, g_Dbs.cfgDir); - insertTestProcess(); + insertTestProcess(); } else if (QUERY_TEST == g_args.test_mode) { - if (g_queryInfo.cfgDir[0]) - taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir); + if (g_queryInfo.cfgDir[0]) + taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir); - queryTestProcess(); + queryTestProcess(); } else if (SUBSCRIBE_TEST == g_args.test_mode) { - if (g_queryInfo.cfgDir[0]) - taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir); + if (g_queryInfo.cfgDir[0]) + taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir); - subscribeTestProcess(); + subscribeTestProcess(); } else { - ; + ; } } static void queryResult() { - // query data - - pthread_t read_id; - threadInfo *pThreadInfo = calloc(1, sizeof(threadInfo)); - assert(pThreadInfo); - pThreadInfo->start_time = 1500000000000; // 2017-07-14 10:40:00.000 - pThreadInfo->start_table_from = 0; - - //pThreadInfo->do_aggreFunc = g_Dbs.do_aggreFunc; - if (g_args.use_metric) { - pThreadInfo->ntables = g_Dbs.db[0].superTbls[0].childTblCount; - pThreadInfo->end_table_to = g_Dbs.db[0].superTbls[0].childTblCount - 1; - pThreadInfo->superTblInfo = &g_Dbs.db[0].superTbls[0]; - tstrncpy(pThreadInfo->tb_prefix, - g_Dbs.db[0].superTbls[0].childTblPrefix, TSDB_TABLE_NAME_LEN - 20); - } else { - pThreadInfo->ntables = g_args.num_of_tables; - pThreadInfo->end_table_to = g_args.num_of_tables -1; - tstrncpy(pThreadInfo->tb_prefix, g_args.tb_prefix, TSDB_TABLE_NAME_LEN); - } - - pThreadInfo->taos = taos_connect( - g_Dbs.host, - g_Dbs.user, - g_Dbs.password, - g_Dbs.db[0].dbName, - g_Dbs.port); - if (pThreadInfo->taos == NULL) { - errorPrint( "Failed to connect to TDengine, reason:%s\n", - taos_errstr(NULL)); + // query data + + pthread_t read_id; + threadInfo *pThreadInfo = calloc(1, sizeof(threadInfo)); + assert(pThreadInfo); + pThreadInfo->start_time = 1500000000000; // 2017-07-14 10:40:00.000 + pThreadInfo->start_table_from = 0; + + //pThreadInfo->do_aggreFunc = g_Dbs.do_aggreFunc; + if (g_args.use_metric) { + pThreadInfo->ntables = g_Dbs.db[0].superTbls[0].childTblCount; + pThreadInfo->end_table_to = g_Dbs.db[0].superTbls[0].childTblCount - 1; + pThreadInfo->superTblInfo = &g_Dbs.db[0].superTbls[0]; + tstrncpy(pThreadInfo->tb_prefix, + g_Dbs.db[0].superTbls[0].childTblPrefix, TBNAME_PREFIX_LEN); + } else { + pThreadInfo->ntables = g_args.num_of_tables; + pThreadInfo->end_table_to = g_args.num_of_tables -1; + tstrncpy(pThreadInfo->tb_prefix, g_args.tb_prefix, TSDB_TABLE_NAME_LEN); + } + + pThreadInfo->taos = taos_connect( + g_Dbs.host, + g_Dbs.user, + g_Dbs.password, + g_Dbs.db[0].dbName, + g_Dbs.port); + if (pThreadInfo->taos == NULL) { + errorPrint( "Failed to connect to TDengine, reason:%s\n", + taos_errstr(NULL)); + free(pThreadInfo); + exit(-1); + } + + tstrncpy(pThreadInfo->filePath, g_Dbs.resultFile, MAX_FILE_NAME_LEN); + + if (!g_Dbs.use_metric) { + pthread_create(&read_id, NULL, readTable, pThreadInfo); + } else { + pthread_create(&read_id, NULL, readMetric, pThreadInfo); + } + pthread_join(read_id, NULL); + taos_close(pThreadInfo->taos); free(pThreadInfo); - exit(-1); - } - - tstrncpy(pThreadInfo->filePath, g_Dbs.resultFile, MAX_FILE_NAME_LEN); - - if (!g_Dbs.use_metric) { - pthread_create(&read_id, NULL, readTable, pThreadInfo); - } else { - pthread_create(&read_id, NULL, readMetric, pThreadInfo); - } - pthread_join(read_id, NULL); - taos_close(pThreadInfo->taos); - free(pThreadInfo); } static void testCmdLine() { - if (strlen(configDir)) { - wordexp_t full_path; - if (wordexp(configDir, &full_path, 0) != 0) { - errorPrint( "Invalid path %s\n", configDir); - return; + if (strlen(configDir)) { + wordexp_t full_path; + if (wordexp(configDir, &full_path, 0) != 0) { + errorPrint( "Invalid path %s\n", configDir); + return; + } + taos_options(TSDB_OPTION_CONFIGDIR, full_path.we_wordv[0]); + wordfree(&full_path); } - taos_options(TSDB_OPTION_CONFIGDIR, full_path.we_wordv[0]); - wordfree(&full_path); - } - g_args.test_mode = INSERT_TEST; - insertTestProcess(); + g_args.test_mode = INSERT_TEST; + insertTestProcess(); - if (false == g_Dbs.insert_only) - queryResult(); + if (false == g_Dbs.insert_only) + queryResult(); } int main(int argc, char *argv[]) { - parse_args(argc, argv, &g_args); - - debugPrint("meta file: %s\n", g_args.metaFile); + parse_args(argc, argv, &g_args); - if (g_args.metaFile) { - initOfInsertMeta(); - initOfQueryMeta(); + debugPrint("meta file: %s\n", g_args.metaFile); - if (false == getInfoFromJsonFile(g_args.metaFile)) { - printf("Failed to read %s\n", g_args.metaFile); - return 1; - } + if (g_args.metaFile) { + initOfInsertMeta(); + initOfQueryMeta(); - testMetaFile(); - } else { - memset(&g_Dbs, 0, sizeof(SDbs)); - setParaFromArg(); - - if (NULL != g_args.sqlFile) { - TAOS* qtaos = taos_connect( - g_Dbs.host, - g_Dbs.user, - g_Dbs.password, - g_Dbs.db[0].dbName, - g_Dbs.port); - querySqlFile(qtaos, g_args.sqlFile); - taos_close(qtaos); + if (false == getInfoFromJsonFile(g_args.metaFile)) { + printf("Failed to read %s\n", g_args.metaFile); + return 1; + } + testMetaFile(); } else { - testCmdLine(); - } + memset(&g_Dbs, 0, sizeof(SDbs)); + setParaFromArg(); + + if (NULL != g_args.sqlFile) { + TAOS* qtaos = taos_connect( + g_Dbs.host, + g_Dbs.user, + g_Dbs.password, + g_Dbs.db[0].dbName, + g_Dbs.port); + querySqlFile(qtaos, g_args.sqlFile); + taos_close(qtaos); - if (g_dupstr) - free(g_dupstr); - } + } else { + testCmdLine(); + } - return 0; + if (g_dupstr) + free(g_dupstr); + } + + return 0; } diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index e5501b4366f24fdee9ace153e59b4a60dc67455f..5139f98cded69614ce3b037cc61d099dedefdf8e 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -600,7 +600,7 @@ static void parse_timestamp( tmpEpoch = atoll(tmp); } - sprintf(argv[i], "%"PRId64"", tmpEpoch); + sprintf(argv[i+1], "%"PRId64"", tmpEpoch); debugPrint("%s() LN%d, tmp is: %s, argv[%d]: %s\n", __func__, __LINE__, tmp, i, argv[i]); free(tmp); diff --git a/src/kit/taospack/CMakeLists.txt b/src/kit/taospack/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c36887329f0deb6839162dd966c96d09edbc0f --- /dev/null +++ b/src/kit/taospack/CMakeLists.txt @@ -0,0 +1,21 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(TDengine) + +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc) +INCLUDE_DIRECTORIES(inc) + +IF (TD_LINUX) + AUX_SOURCE_DIRECTORY(. SRC) + ADD_EXECUTABLE(taospack ${SRC}) + TARGET_LINK_LIBRARIES(taospack os tutil tsdb ${VAR_TSZ}) +ELSEIF (TD_WINDOWS) + AUX_SOURCE_DIRECTORY(. SRC) + ADD_EXECUTABLE(taospack ${SRC}) + TARGET_LINK_LIBRARIES(taospack) +ELSEIF (TD_DARWIN) + # MAC + AUX_SOURCE_DIRECTORY(. SRC) + ADD_EXECUTABLE(taospack ${SRC}) + TARGET_LINK_LIBRARIES(taospack os tutil tsdb) +ENDIF () \ No newline at end of file diff --git a/src/kit/taospack/taospack.c b/src/kit/taospack/taospack.c new file mode 100644 index 0000000000000000000000000000000000000000..33d779dfcf7abd1315107fd45f79eaed57581768 --- /dev/null +++ b/src/kit/taospack/taospack.c @@ -0,0 +1,766 @@ + + +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include + +#if defined(WINDOWS) +int main(int argc, char *argv[]) { + printf("welcome to use taospack tools v1.3 for windows.\n"); +} +#elif !defined(TD_TSZ) +int main(int argc, char *argv[]) { + printf(" welcome taospack. \n You not open TSZ , please define TD_TSZ to open TSZ algo.\n"); +} +#else + +#include "os.h" +#include "tscompression.h" +#include "tdataformat.h" + + + +// ------- define ----------- +#define FT_CNT 8 + +// ------- function declare -------- +void cost_start(); +double cost_end(const char* tag); +int notsame_cnt = 0; + +// ------- global declare ----------- +float g_ft1[ ] = {\ + 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.9010000228881836, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.630000114440918, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7079999446868896, 3.7079999446868896, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7119998931884766, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7100000381469727, 3.7079999446868896, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7070000171661377, 3.7100000381469727, 3.7119998931884766, 3.7119998931884766, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7139999866485596, 3.7109999656677246, 3.7109999656677246, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7130000591278076, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7119998931884766, 3.7130000591278076, 3.7109999656677246, 3.7079999446868896, 3.7090001106262207, 3.7090001106262207, 3.7119998931884766, 3.7109999656677246, 3.7109999656677246, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7090001106262207, 3.7109999656677246, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7079999446868896, 3.7079999446868896, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7090001106262207, 3.7100000381469727, 3.7090001106262207, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7109999656677246, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7149999141693115, 3.7079999446868896, 3.7070000171661377, 3.7049999237060547, 3.7060000896453857, 3.7060000896453857\ + ,3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.634000062942505, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422 + ,3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.9010000228881836, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.630000114440918, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7079999446868896, 3.7079999446868896, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7119998931884766, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7100000381469727, 3.7079999446868896, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7070000171661377, 3.7100000381469727, 3.7119998931884766, 3.7119998931884766, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7139999866485596, 3.7109999656677246, 3.7109999656677246, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7130000591278076, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7119998931884766, 3.7130000591278076, 3.7109999656677246, 3.7079999446868896, 3.7090001106262207, 3.7090001106262207, 3.7119998931884766, 3.7109999656677246, 3.7109999656677246, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7090001106262207, 3.7109999656677246, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7079999446868896, 3.7079999446868896, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7090001106262207, 3.7100000381469727, 3.7090001106262207, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7109999656677246, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7149999141693115, 3.7079999446868896, 3.7070000171661377, 3.7049999237060547, 3.7060000896453857, 3.7060000896453857\ + ,3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.634000062942505, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422 + }; + +double g_de1[ ] = {\ + 3.895999908447265612345, 3.897000074386596701234, 3.89800000190734860123456789, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.9010000228881836, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.630000114440918, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7079999446868896, 3.7079999446868896, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7119998931884766, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7100000381469727, 3.7079999446868896, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7070000171661377, 3.7100000381469727, 3.7119998931884766, 3.7119998931884766, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7139999866485596, 3.7109999656677246, 3.7109999656677246, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7130000591278076, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7119998931884766, 3.7130000591278076, 3.7109999656677246, 3.7079999446868896, 3.7090001106262207, 3.7090001106262207, 3.7119998931884766, 3.7109999656677246, 3.7109999656677246, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7090001106262207, 3.7109999656677246, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7079999446868896, 3.7079999446868896, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7090001106262207, 3.7100000381469727, 3.7090001106262207, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7109999656677246, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7149999141693115, 3.7079999446868896, 3.7070000171661377, 3.7049999237060547, 3.7060000896453857, 3.7060000896453857\ + ,3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.634000062942505, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422 + ,3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.9010000228881836, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.630000114440918, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7079999446868896, 3.7079999446868896, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7119998931884766, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7100000381469727, 3.7079999446868896, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7070000171661377, 3.7100000381469727, 3.7119998931884766, 3.7119998931884766, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7139999866485596, 3.7109999656677246, 3.7109999656677246, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7130000591278076, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7119998931884766, 3.7130000591278076, 3.7109999656677246, 3.7079999446868896, 3.7090001106262207, 3.7090001106262207, 3.7119998931884766, 3.7109999656677246, 3.7109999656677246, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7090001106262207, 3.7109999656677246, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7079999446868896, 3.7079999446868896, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7090001106262207, 3.7100000381469727, 3.7090001106262207, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7109999656677246, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7149999141693115, 3.7079999446868896, 3.7070000171661377, 3.7049999237060547, 3.7060000896453857, 3.7060000896453857\ + ,3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.634000062942505, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422 + }; + +/* +struct timeval startTime; +struct timeval endTime; +struct timeval costStart; +double totalCost = 0; + +void cost_start() +{ + totalCost = 0; + gettimeofday(&costStart, NULL); +} + +double cost_end(const char* tag) +{ + double elapsed; + struct timeval costEnd; + gettimeofday(&costEnd, NULL); + elapsed = ((costEnd.tv_sec*1000000+costEnd.tv_usec)-(costStart.tv_sec*1000000+costStart.tv_usec))/1000000.0; + totalCost += elapsed; + double use_ms = totalCost*1000; + printf(" timecost %s : %.3f ms\n", tag, use_ms); + return use_ms; +} +*/ + +float toFloat(char* buf){ + return (float)atoll(buf); +} + +// +// read float +// +float* read_float(const char* inFile, int* pcount){ + // check valid + if(inFile == NULL || inFile[0] == 0 ){ + printf(" inFile is NULL or EMPTY.\n"); + return NULL; + } + + // read in file + FILE* pfin = fopen(inFile, "r"); + if(pfin == NULL){ + printf(" open IN file %s error. errno=%d\n", inFile, errno); + return false; + } + + // read one line from infile and write to outfile + char buf[256]={0}; + int malloc_cnt = 100000; + float* floats = malloc(malloc_cnt*sizeof(float)); + int fi = 0; + while(fgets(buf, sizeof(buf), pfin) != NULL) { + // get item + if(buf[0] == 0 || strcmp(buf, " ") == 0) + continue; + floats[fi] = atof(buf); + //printf(" buff=%s float=%.50f \n ", buf, floats[fi]); + if ( ++fi == malloc_cnt ) { + malloc_cnt += 100000; + floats = realloc(floats, malloc_cnt*sizeof(float)); + } + memset(buf, 0, sizeof(buf)); + } + + // close + fclose(pfin); + if(pcount) + *pcount = fi; + return floats; +} + +float check_same(float* ft1, float* ft2, int count){ + int same_cnt =0; + for(int i=0; i< count; i++){ + + if(ft1[i] == ft2[i]){ + same_cnt ++; + } + + if(i < 5){ + printf(" i=%d ft1=%.40f diff=%.40f \n", i, ft1[i], ft1[i] - ft2[i]); + printf(" i=%d ft2=%.40f \n", i, ft2[i]); + } + + } + float same_rate = same_cnt*100/count; + printf(" all count=%d same=%d same rate=%.0f%% \n", count, same_cnt, same_rate); + return same_rate; +} + +double check_same_double(double* ft1, double* ft2, int count){ + int same_cnt =0; + for(int i=0; i< count; i++){ + + if(ft1[i] == ft2[i]){ + same_cnt ++; + } + + if(i < 5){ + printf(" i=%d ft1=%.40f diff=%.40f \n", i, ft1[i], ft1[i] - ft2[i]); + printf(" i=%d ft2=%.40f \n", i, ft2[i]); + } + + } + double same_rate = same_cnt*100/count; + printf(" all count=%d same=%d same rate=%.0f%% \n", count, same_cnt, same_rate); + return same_rate; +} + +// +// test compress and decompress +// + +bool DoDouble(double* doubles, int cnt, int algorithm) { + // compress + const char* input = (const char*)doubles; + int input_len = cnt * sizeof(double); + char* output = (char*) malloc(input_len); + int output_len = input_len; + char* buff = (char*) malloc(input_len); + int buff_len = input_len; + + cost_start(); + int ret_len = 0; + if(algorithm == 2) + ret_len = tsCompressDouble(input, input_len, cnt, output, output_len, algorithm, buff, buff_len); + else + ret_len = tsCompressDoubleLossy(input, input_len, cnt, output, output_len, algorithm, buff, buff_len); + + if(ret_len == -1) { + printf(" compress error.\n"); + return 0; + } + double use_ms1 = cost_end("compress"); + + printf(" compress len=%d input len=%d\n", ret_len, input_len); + double rate=100*(double)ret_len/(double)input_len; + printf(" compress rate=%.1f an-rate=%.4f%%\n", (double)input_len/(double)ret_len, rate); + + // + // decompress + // + double* ft2 = (double*)malloc(input_len); + cost_start(); + int code = 0; + + if(algorithm == 2) + code = tsDecompressDouble(output, ret_len, cnt, (char*)ft2, input_len, algorithm, buff, buff_len); + else + code = tsDecompressDoubleLossy(output, ret_len, cnt, (char*)ft2, input_len, algorithm, buff, buff_len); + + + double use_ms2 = cost_end("Decompress"); + printf(" Decompress return length=%d \n", code); + + // compare same + double same_rate = check_same_double(doubles, ft2, cnt); + + printf("\n ------------------ count:%d <%s> ---------------- \n", cnt, algorithm == 2?"TD":"SZ"); + printf(" Compress Rate ......... [%.2f%%] \n", rate); + double speed1 = (cnt*sizeof(double)*1000/1024/1024)/use_ms1; + printf(" Compress Time ......... [%.4fms] speed=%.1f MB/s\n", use_ms1, speed1); + double speed2 = (cnt*sizeof(double)*1000/1024/1024)/use_ms2; + printf(" Decompress Time........ [%.4fms] speed=%.1f MB/s\n", use_ms2, speed2); + printf(" Same Rate ............. [%.0f%%] \n\n", same_rate); + + + // free + free(ft2); + free(buff); + free(output); + + return true; +} + +bool DoFloat(float* floats, int cnt, int algorithm, bool lossy) { + // compress + const char* input = (const char*)floats; + int input_len = cnt * sizeof(float); + char* output = (char*) malloc(input_len); + int output_len = input_len; + char* buff = (char*) malloc(input_len); + int buff_len = input_len; + + cost_start(); + int ret_len = 0; + ret_len = tsCompressFloat(input, input_len, cnt, output, output_len, algorithm, buff, buff_len); + + if(ret_len == -1) { + printf(" compress error.\n"); + return 0; + } + double use_ms1 = cost_end("compress"); + + printf(" compress len=%d input len=%d\n", ret_len, input_len); + float rate=100*(float)ret_len/(float)input_len; + printf(" compress rate=%.1f an-rate=%.4f%%\n", (float)input_len/(float)ret_len, rate); + + // + // decompress + // + float* ft2 = (float*)malloc(input_len); + cost_start(); + int code = 0; + code = tsDecompressFloat(output, ret_len, cnt, (char*)ft2, input_len, algorithm, buff, buff_len); + + double use_ms2 = cost_end("Decompress"); + printf(" Decompress return length=%d \n", code); + + // compare same + float same_rate = check_same(floats, ft2, cnt); + + printf("\n ------------------ count:%d <%s> ---------------- \n", cnt, lossy?"SZ":"TD"); + printf(" Compress Rate ......... [%.2f%%] \n", rate); + double speed1 = (cnt*sizeof(float)*1000/1024/1024)/use_ms1; + printf(" Compress Time ......... [%.4fms] speed=%.1f MB/s\n", use_ms1, speed1); + double speed2 = (cnt*sizeof(float)*1000/1024/1024)/use_ms2; + printf(" Decompress Time........ [%.4fms] speed=%.1f MB/s\n", use_ms2, speed2); + printf(" Same Rate ............. [%.0f%%] \n\n", same_rate); + + + // free + free(ft2); + free(buff); + free(output); + + return true; +} + + +bool testFile(const char* inFile, char algorithm, bool lossy){ + // check valid + if(inFile == NULL || inFile[0] == 0 ){ + printf(" inFile is NULL or EMPTY.\n"); + return false; + } + + int cnt = 0; + float* floats = read_float(inFile, &cnt); + if(floats == NULL) { + return false; + } + + DoFloat(floats, cnt, algorithm, lossy); + + free(floats); + return true; +} +// +// txt to binary file +// +#define BUFF_CNT 256 +bool txt_to_bin(const char* inFile, const char* outFile){ + // check valid + if(inFile == NULL || outFile == NULL || inFile[0] == 0 || outFile[0] == 0){ + printf(" inFile or outFile is NULL or EMPTY.\n"); + return false; + } + + printf(" infile=%s \n", inFile); + printf(" outfile=%s \n", outFile); + + // read in file + FILE* pfin = fopen(inFile, "r"); + if(pfin == NULL){ + printf(" open IN file %s error. errno=%d\n", inFile, errno); + return false; + } + + // create out file + FILE* pfout = fopen(outFile, "w+"); + if(pfout == NULL){ + printf(" open OUT file %s error. errno=%d\n", outFile, errno); + fclose(pfin); + return false; + } + + // read one line from infile and write to outfile + char buf[256]={0}; + float fbuf[BUFF_CNT] = {0}; + int fi = 0; + int count = 0; + while(fgets(buf, sizeof(buf), pfin) != NULL) { + // get item + fbuf[fi] = toFloat(buf); + if ( ++fi == BUFF_CNT ) { + // write + if(fwrite(fbuf, sizeof(float), BUFF_CNT, pfout) == 0) { + printf(" write to file %s error , code=%d . app exit.\n", outFile, errno); + exit(1); + } + fi = 0; + } + count ++; + memset(buf, 0, sizeof(buf)); + } + + // write retain + if( fi > 0){ + if(fwrite(fbuf, sizeof(float), fi, pfout) == 0) { + printf(" write to file %s error , code=%d . app exit.\n", outFile, errno); + exit(1); + } + } + + // close + fclose(pfin); + fclose(pfout); + + // total + printf(" count=%d write bytes=%d \n", count, (int)(count*sizeof(float))); + return true; +} + + +int memTestDouble() { + // douelbe + const char* input = (const char*) g_de1; + double* de1 = g_de1; + int input_len = sizeof(g_de1); + int cnt = input_len/sizeof(double); + printf(" input input_len=%d count=%d \n", input_len, cnt); + + char* output = (char*) malloc(input_len); + int output_len = input_len; + + char buff[1024] ={0}; + int buff_len = sizeof(buff); + + cost_start(); + int ret_len = tsCompressDoubleLossy(input, input_len, cnt, output, output_len, ONE_STAGE_COMP, buff, buff_len); + if(ret_len == -1) { + printf(" compress error.\n"); + return 0; + } + cost_end(" tscompress"); + + printf(" compress return len=%d input len=%d\n", ret_len, input_len); + printf(" compress rate=%.1f an-rate=%.0f%%\n", (float)input_len/(float)ret_len, 100*(float)ret_len/(float)input_len); + + // + // decompress + // + double* de2 = (double*)malloc(input_len); + cost_start(); + int code = tsDecompressDoubleLossy(output, ret_len, cnt, (char*)de2, input_len, ONE_STAGE_COMP, buff, buff_len); + cost_end("tsde-compress double"); + printf(" de-compress return code=%d \n", code); + + + // + // show + // + int same_cnt = 0; + int diffshow_cnt = 0; + for(int i=0; i< cnt; i++){ + + if(i < 10) + printf(" i=%d de1=%.20f de2=%.20f same=%d\n", i, de1[i], de2[i], de1[i] == de2[i]); + + if(de1[i] == de2[i]) + same_cnt ++; + else { + notsame_cnt++; + if(i >= 10 && ++diffshow_cnt < 50){ + printf(" i=%d de1=%.20f de2=%.20f diff\n", i, de1[i], de2[i]); + } + } + } + + printf(" ---- result doulbe : same =%d cnt=%d rate:%d%% global not same=%d---- \n", same_cnt, cnt, same_cnt*100/cnt, notsame_cnt); + + free(output); + free(de2); + return 1; +} + + + + +int memTest() { + + // + //float ft1[] = {1.2, 2.4, 3.33, 4.444, 5.555, 6.6666, 7.7777, 8.88888,1.2, 2.4, 3.33, 4.444, 5.555, 6.6666, 7.7777, 8.88888,1.2, 2.4, 3.33, 4.444, 5.555, 6.6666, 7.7777, 8.88888}; + // + + float* ft1 = g_ft1; + const char* input = (const char*) ft1; + int input_len = sizeof(g_ft1); + int cnt = input_len/sizeof(float); + printf(" input input_len=%d count=%d \n", input_len, cnt); + + + char* output = (char*) malloc(input_len); + int output_len = input_len; + + char buff[1024] ={0}; + int buff_len = sizeof(buff); + + cost_start(); + int ret_len = tsCompressFloatLossy(input, input_len, cnt, output, output_len, ONE_STAGE_COMP, buff, buff_len); + if(ret_len == -1) { + printf(" compress error.\n"); + return 0; + } + cost_end(" tscompress"); + + printf(" compress return len=%d input len=%d\n", ret_len, input_len); + printf(" compress sz rate=%.1f an-rate=%.2f%%\n", (float)input_len/(float)ret_len, 100*(float)ret_len/(float)input_len); + + // + // decompress + // + float* ft2 = (float*)malloc(input_len); + cost_start(); + int code = tsDecompressFloatLossy(output, ret_len, cnt, (char*)ft2, input_len, ONE_STAGE_COMP, buff, buff_len); + cost_end("tsde-compress"); + printf(" de-compress return code=%d \n", code); + + + // + // show + // + int same_cnt = 0; + int diffshow_cnt = 0; + for(int i=0; i< cnt; i++){ + + if(i < 10) + printf(" i=%d ft1=%.20f ft2=%.20f same=%d\n", i, ft1[i], ft2[i], ft1[i] == ft2[i]); + + if(ft1[i] == ft2[i]) + same_cnt ++; + else { + notsame_cnt++; + if(i >= 10 && ++diffshow_cnt < 50){ + printf(" i=%d ft1=%.20f ft2=%.20f diff\n", i, ft1[i], ft2[i]); + } + } + } + + printf(" ---- result : same =%d cnt=%d rate:%d%% global not same=%d---- \n", same_cnt, cnt, same_cnt*100/cnt, notsame_cnt); + + free(output); + free(ft2); + return 1; +} + +void* memTestThread(void* lparam) { + //memTest(); + printf(" enter thread ....\n"); + for(int i=0; i<1; i++) + { + memTest(); + printf(" start i=%d .... \n", i); + } + return NULL; +} + +void test_threadsafe(int thread_count){ + printf(" test thread safe . thread count=%d \n", thread_count); + pthread_t handle[1000000]; + int i=0; + for(i=0; i< thread_count; i++){ + printf(" create thread %d... \n", i); + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_create(&handle[i], &attr, memTestThread, NULL); + pthread_attr_destroy(&attr); + } + + for(i=0; i< thread_count; i++) + { + pthread_join(handle[i], NULL); + } + + printf(" test thread safe end. not same count=%d\n", notsame_cnt); + +} + + +void* memTestThreadDouble(void* lparam) { + //memTest(); + printf(" enter thread ....\n"); + for(int i=0; i< 1; i++) + { + memTest(); + printf(" double start i=%d .... \n", i); + } + return NULL; +} + +void test_threadsafe_double(int thread_count){ + printf(" test thread safe . thread count=%d \n", thread_count); + pthread_t handle[1000000]; + int i=0; + for(i=0; i< thread_count; i++){ + printf(" create thread %d... \n", i); + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_create(&handle[i], &attr, memTestThreadDouble, NULL); + pthread_attr_destroy(&attr); + } + + for(i=0; i< thread_count; i++) + { + pthread_join(handle[i], NULL); + } + + printf("\n ---- double test thread safe end. not same count=%d-----\n", notsame_cnt); + +} + + +void unitTestFloat() { + + float ft1 [] = {1.11, 2.22, 3.333}; + int cnt = sizeof(ft1)/sizeof(float); + float* floats = ft1; + int algorithm = 2; + + // compress + const char* input = (const char*)floats; + int input_len = cnt * sizeof(float); + int output_len = input_len + 1024; + char* output = (char*) malloc(output_len); + char* buff = (char*) malloc(input_len); + int buff_len = input_len; + + printf(" ft1 have count=%d \n", cnt); + strcpy(output, "abcde"); + + cost_start(); + int ret_len = 0; + ret_len = tsCompressFloatLossy(input, input_len, cnt, output, output_len, algorithm, buff, buff_len); + + if(ret_len == 0) { + printf(" compress error.\n"); + return ; + } + double use_ms1 = cost_end("compress"); + + printf(" compress len=%d input len=%d\n", ret_len, input_len); + float rate=100*(float)ret_len/(float)input_len; + printf(" compress rate=%.1f an-rate=%.4f%%\n", (float)input_len/(float)ret_len, rate); + + // + // decompress + // + float* ft2 = (float*)malloc(input_len); + cost_start(); + int code = 0; + code = tsDecompressFloatLossy(output, ret_len, cnt, (char*)ft2, input_len, algorithm, buff, buff_len); + + + double use_ms2 = cost_end("Decompress"); + printf(" Decompress return length=%d \n", code); + + // compare same + float same_rate = check_same(floats, ft2, cnt); + + printf("\n ------------------ count:%d TD ---------------- \n", cnt); + printf(" Compress Rate ......... [%.0f%%] \n", rate); + double speed1 = (cnt*sizeof(float)*1000/1024/1024)/use_ms1; + printf(" Compress Time ......... [%.4fms] speed=%.1f MB/s\n", use_ms1, speed1); + double speed2 = (cnt*sizeof(float)*1000/1024/1024)/use_ms2; + printf(" Decompress Time........ [%.4fms] speed=%.1f MB/s\n", use_ms2, speed2); + printf(" Same Rate ............. [%.0f%%] \n\n", same_rate); + + + // free + free(ft2); + free(buff); + free(output); + +} + +#define DB_CNT 500 +void test_same_double(int algo){ + double ori = 3.1415926; + + double doubles [DB_CNT]; + for(int i=0; i< DB_CNT; i++){ + doubles[i] = ori; + } + + DoDouble(doubles, DB_CNT, algo); + +} + +#ifdef TD_TSZ +extern char lossyColumns []; +extern bool lossyDouble; +extern bool lossyFloat; +extern double fPrecision; +extern char Compressor []; +#endif +// +// ----------------- main ---------------------- +// +int main(int argc, char *argv[]) { + printf("welcome to use taospack tools v1.3\n"); + + //printf(" sizeof(int)=%d\n", (int)sizeof(int)); + //printf(" sizeof(long)=%d\n", (int)sizeof(long)); + //printf(" sizeof(short)=%d\n",(int)sizeof(short)); + + + strcpy(lossyColumns, "float|double"); + bool lossy = true; + //fPrecision = 1E-5; + //strcpy(Compressor, "GZIP_COMPRESSOR"); + + tsCompressInit(); + lossyFloat = lossyDouble = true; + + printf(" fPrecision=%.15f\n",fPrecision); + + + // + //tsCompressExit(); + //return 1; + //printf(" SZ_SIZE_TYPE=%d", ) + + if(argc == 3){ + char algo = 0; + // t + if(strcmp(argv[1], "-tone") == 0 || strcmp(argv[1], "-t") == 0 ) { + algo = ONE_STAGE_COMP; + lossyFloat = lossyDouble = true; + } + if(strcmp(argv[1], "-tw") == 0) { + algo = TWO_STAGE_COMP; + lossy = false; + lossyFloat = lossyDouble = false; + } + + if(strcmp(argv[1], "-sf") == 0) { + test_threadsafe(atoi(argv[2])); + return 0; + } + + if(strcmp(argv[1], "-sd") == 0) { + test_threadsafe_double(atoi(argv[2])); + return 0; + } + + if(strcmp(argv[1], "-samed") == 0) { + test_same_double(atoi(argv[2])); + return 0; + } + + if(algo == 0){ + printf(" no param -tone -tw \n"); + return 0; + } + + bool ret = testFile(argv[2], algo, lossy); + printf(" test file %s. \n", ret ? "ok" : "err"); + return 1; + + } else if( argc == 2) { + if(strcmp(argv[1], "-mem") == 0) { + memTest(); + } + } + else{ + unitTestFloat(); + } + + tsCompressExit(); + return 0; +} + +#endif + diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 5a0743dd1b2ad97350c8b8f2ce57d91254d60eaf..02cf1c782c54f61e9bf113d7319e1009e4e7d946 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -1146,6 +1146,7 @@ static int32_t mnodeRetrieveConfigs(SShowObj *pShow, char *data, int32_t rows, v numOfRows++; break; case TAOS_CFG_VTYPE_FLOAT: + case TAOS_CFG_VTYPE_DOUBLE: t = snprintf(varDataVal(pWrite), TSDB_CFG_VALUE_LEN, "%f", *((float *)cfg->ptr)); varDataSetLen(pWrite, t); numOfRows++; diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h index f2ab2182a1c00e2d91cdf2199ff8cc8c42bfce2f..531ff06565dba837c696c6069d409ccf536cbe8c 100644 --- a/src/query/inc/qSqlparser.h +++ b/src/query/inc/qSqlparser.h @@ -254,7 +254,7 @@ typedef struct tSqlExpr { struct SArray *paramList; // function parameters list } Expr; - uint32_t functionId; // function id, todo remove it + int32_t functionId; // function id, todo remove it SStrToken columnName; // table column info tVariant value; // the use input value SStrToken exprToken; // original sql expr string diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 288a2064915df70990350523a694fadcf878f7e0..982c45c44194e94b1fd12c691b5efdaf8382ad94 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -2427,7 +2427,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool if (pQueryAttr->pointInterpQuery && pQueryAttr->interval.interval == 0) { if (!QUERY_IS_ASC_QUERY(pQueryAttr)) { - qDebug(msg, pQInfo, "interp", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); + qDebug(msg, pQInfo->qId, "interp", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); } @@ -2438,7 +2438,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool if (pQueryAttr->interval.interval == 0) { if (onlyFirstQuery(pQueryAttr)) { if (!QUERY_IS_ASC_QUERY(pQueryAttr)) { - qDebug(msg, pQInfo, "only-first", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, + qDebug(msg, pQInfo->qId, "only-first", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); @@ -2449,7 +2449,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool pQueryAttr->needReverseScan = false; } else if (onlyLastQuery(pQueryAttr) && notContainSessionOrStateWindow(pQueryAttr)) { if (QUERY_IS_ASC_QUERY(pQueryAttr)) { - qDebug(msg, pQInfo, "only-last", pQueryAttr->order.order, TSDB_ORDER_DESC, pQueryAttr->window.skey, + qDebug(msg, pQInfo->qId, "only-last", pQueryAttr->order.order, TSDB_ORDER_DESC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); @@ -2464,7 +2464,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool if (stableQuery) { if (onlyFirstQuery(pQueryAttr)) { if (!QUERY_IS_ASC_QUERY(pQueryAttr)) { - qDebug(msg, pQInfo, "only-first stable", pQueryAttr->order.order, TSDB_ORDER_ASC, + qDebug(msg, pQInfo->qId, "only-first stable", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); @@ -2475,7 +2475,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool pQueryAttr->needReverseScan = false; } else if (onlyLastQuery(pQueryAttr)) { if (QUERY_IS_ASC_QUERY(pQueryAttr)) { - qDebug(msg, pQInfo, "only-last stable", pQueryAttr->order.order, TSDB_ORDER_DESC, + qDebug(msg, pQInfo->qId, "only-last stable", pQueryAttr->order.order, TSDB_ORDER_DESC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); @@ -6594,10 +6594,19 @@ static SSDataBlock* hashDistinct(void* param, bool* newgroup) { if (isNull(val, type)) { continue; } - int dummy; - void* res = taosHashGet(pInfo->pSet, val, bytes); + + size_t keyLen = 0; + if (IS_VAR_DATA_TYPE(pOperator->pExpr->base.colType)) { + tstr* var = (tstr*)(val); + keyLen = varDataLen(var); + } else { + keyLen = bytes; + } + + int dummy; + void* res = taosHashGet(pInfo->pSet, val, keyLen); if (res == NULL) { - taosHashPut(pInfo->pSet, val, bytes, &dummy, sizeof(dummy)); + taosHashPut(pInfo->pSet, val, keyLen, &dummy, sizeof(dummy)); char* start = pResultColInfoData->pData + bytes * pInfo->pRes->info.rows; memcpy(start, val, bytes); pRes->info.rows += 1; @@ -6624,6 +6633,7 @@ SOperatorInfo* createDistinctOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperat pOperator->blockingOptr = false; pOperator->status = OP_IN_EXECUTING; pOperator->operatorType = OP_Distinct; + pOperator->pExpr = pExpr; pOperator->numOfOutput = numOfOutput; pOperator->info = pInfo; pOperator->pRuntimeEnv = pRuntimeEnv; diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 44808b102581f5e4298adea36e9eb74de72042e8..ef304d2fcbcb3a823e2c8253ca578de551499151 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -4,10 +4,14 @@ PROJECT(TDengine) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/rpc/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/sync/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/rmonotonic/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/TSZ/sz/include) AUX_SOURCE_DIRECTORY(src SRC) ADD_LIBRARY(tutil ${SRC}) -TARGET_LINK_LIBRARIES(tutil pthread os lz4 z rmonotonic) + +TARGET_LINK_LIBRARIES(tutil pthread os lz4 z rmonotonic ${VAR_TSZ} ) + + IF (TD_LINUX) TARGET_LINK_LIBRARIES(tutil m rt) @@ -37,4 +41,4 @@ ENDIF() IF (TD_STORAGE) TARGET_LINK_LIBRARIES(tutil storage) -ENDIF () \ No newline at end of file +ENDIF () diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index fdb2595fd8d3b1659800ca3a5b88c32b6fe95e93..d03ce6e0f1f34478951a84b2ab18020f5cbec92b 100644 --- a/src/util/inc/tconfig.h +++ b/src/util/inc/tconfig.h @@ -20,7 +20,7 @@ extern "C" { #endif -#define TSDB_CFG_MAX_NUM 110 +#define TSDB_CFG_MAX_NUM 116 // 110 + 6 with lossy option #define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_VALUE_LEN 41 @@ -32,6 +32,9 @@ extern "C" { #define TSDB_CFG_CTYPE_B_OPTION 16U // can be configured by taos_options function #define TSDB_CFG_CTYPE_B_NOT_PRINT 32U // such as password +#define MAX_FLOAT 100000 +#define MIN_FLOAT 0 + enum { TAOS_CFG_CSTATUS_NONE, // not configured TAOS_CFG_CSTATUS_DEFAULT, // use system default value @@ -50,6 +53,7 @@ enum { TAOS_CFG_VTYPE_IPSTR, TAOS_CFG_VTYPE_DIRECTORY, TAOS_CFG_VTYPE_DATA_DIRCTORY, + TAOS_CFG_VTYPE_DOUBLE, }; enum { diff --git a/src/util/inc/tscompression.h b/src/util/inc/tscompression.h index cca6d6e25054e7736ea28590fa4cb5ab788d6b07..3f2160bbf26da0ff6eb839ddb4c303d221bce7c2 100644 --- a/src/util/inc/tscompression.h +++ b/src/util/inc/tscompression.h @@ -34,6 +34,22 @@ extern "C" { #define ONE_STAGE_COMP 1 #define TWO_STAGE_COMP 2 +// +// compressed data first byte foramt +// ------ 7 bit ---- | ---- 1 bit ---- +// algorithm mode +// + +// compression data mode save first byte lower 1 bit +#define MODE_NOCOMPRESS 0 // original data +#define MODE_COMPRESS 1 // compatible old compress + +// compression algorithm save first byte higher 7 bit +#define ALGO_SZ_LOSSY 1 // SZ compress + +#define HEAD_MODE(x) x%2 +#define HEAD_ALGO(x) x/2 + extern int tsCompressINTImp(const char *const input, const int nelements, char *const output, const char type); extern int tsDecompressINTImp(const char *const input, const int nelements, char *const output, const char type); extern int tsCompressBoolImp(const char *const input, const int nelements, char *const output); @@ -46,6 +62,20 @@ extern int tsCompressDoubleImp(const char *const input, const int nelements, cha extern int tsDecompressDoubleImp(const char *const input, const int nelements, char *const output); extern int tsCompressFloatImp(const char *const input, const int nelements, char *const output); extern int tsDecompressFloatImp(const char *const input, const int nelements, char *const output); +// lossy +extern int tsCompressFloatLossyImp(const char * input, const int nelements, char *const output); +extern int tsDecompressFloatLossyImp(const char * input, int compressedSize, const int nelements, char *const output); +extern int tsCompressDoubleLossyImp(const char * input, const int nelements, char *const output); +extern int tsDecompressDoubleLossyImp(const char * input, int compressedSize, const int nelements, char *const output); + +#ifdef TD_TSZ +extern bool lossyFloat; +extern bool lossyDouble; +// init call +int tsCompressInit(); +// exit call +void tsCompressExit(); +#endif static FORCE_INLINE int tsCompressTinyint(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { @@ -189,56 +219,123 @@ static FORCE_INLINE int tsDecompressString(const char *const input, int compress static FORCE_INLINE int tsCompressFloat(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { - if (algorithm == ONE_STAGE_COMP) { - return tsCompressFloatImp(input, nelements, output); - } else if (algorithm == TWO_STAGE_COMP) { - int len = tsCompressFloatImp(input, nelements, buffer); - return tsCompressStringImp(buffer, len, output, outputSize); +#ifdef TD_TSZ + // lossy mode + if(lossyFloat) { + return tsCompressFloatLossyImp(input, nelements, output); + // lossless mode } else { - assert(0); - return -1; +#endif + if (algorithm == ONE_STAGE_COMP) { + return tsCompressFloatImp(input, nelements, output); + } else if (algorithm == TWO_STAGE_COMP) { + int len = tsCompressFloatImp(input, nelements, buffer); + return tsCompressStringImp(buffer, len, output, outputSize); + } else { + assert(0); + return -1; + } +#ifdef TD_TSZ } +#endif } static FORCE_INLINE int tsDecompressFloat(const char *const input, int compressedSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { - if (algorithm == ONE_STAGE_COMP) { - return tsDecompressFloatImp(input, nelements, output); - } else if (algorithm == TWO_STAGE_COMP) { - if (tsDecompressStringImp(input, compressedSize, buffer, bufferSize) < 0) return -1; - return tsDecompressFloatImp(buffer, nelements, output); +#ifdef TD_TSZ + if(HEAD_ALGO(input[0]) == ALGO_SZ_LOSSY){ + // decompress lossy + return tsDecompressFloatLossyImp(input, compressedSize, nelements, output); } else { - assert(0); - return -1; +#endif + // decompress lossless + if (algorithm == ONE_STAGE_COMP) { + return tsDecompressFloatImp(input, nelements, output); + } else if (algorithm == TWO_STAGE_COMP) { + if (tsDecompressStringImp(input, compressedSize, buffer, bufferSize) < 0) return -1; + return tsDecompressFloatImp(buffer, nelements, output); + } else { + assert(0); + return -1; + } +#ifdef TD_TSZ } +#endif } + static FORCE_INLINE int tsCompressDouble(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { - if (algorithm == ONE_STAGE_COMP) { - return tsCompressDoubleImp(input, nelements, output); - } else if (algorithm == TWO_STAGE_COMP) { - int len = tsCompressDoubleImp(input, nelements, buffer); - return tsCompressStringImp(buffer, len, output, outputSize); +#ifdef TD_TSZ + if(lossyDouble){ + // lossy mode + return tsCompressDoubleLossyImp(input, nelements, output); } else { - assert(0); - return -1; +#endif + // lossless mode + if (algorithm == ONE_STAGE_COMP) { + return tsCompressDoubleImp(input, nelements, output); + } else if (algorithm == TWO_STAGE_COMP) { + int len = tsCompressDoubleImp(input, nelements, buffer); + return tsCompressStringImp(buffer, len, output, outputSize); + } else { + assert(0); + return -1; + } +#ifdef TD_TSZ } +#endif } static FORCE_INLINE int tsDecompressDouble(const char *const input, int compressedSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { - if (algorithm == ONE_STAGE_COMP) { - return tsDecompressDoubleImp(input, nelements, output); - } else if (algorithm == TWO_STAGE_COMP) { - if (tsDecompressStringImp(input, compressedSize, buffer, bufferSize) < 0) return -1; - return tsDecompressDoubleImp(buffer, nelements, output); + #ifdef TD_TSZ + if(HEAD_ALGO(input[0]) == ALGO_SZ_LOSSY){ + // decompress lossy + return tsDecompressDoubleLossyImp(input, compressedSize, nelements, output); } else { - assert(0); - return -1; + #endif + // decompress lossless + if (algorithm == ONE_STAGE_COMP) { + return tsDecompressDoubleImp(input, nelements, output); + } else if (algorithm == TWO_STAGE_COMP) { + if (tsDecompressStringImp(input, compressedSize, buffer, bufferSize) < 0) return -1; + return tsDecompressDoubleImp(buffer, nelements, output); + } else { + assert(0); + return -1; + } +#ifdef TD_TSZ } +#endif +} + +#ifdef TD_TSZ +// +// lossy float double +// +static FORCE_INLINE int tsCompressFloatLossy(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, + char algorithm, char *const buffer, int bufferSize) { + return tsCompressFloatLossyImp(input, nelements, output); +} + +static FORCE_INLINE int tsDecompressFloatLossy(const char *const input, int compressedSize, const int nelements, char *const output, + int outputSize, char algorithm, char *const buffer, int bufferSize){ + return tsDecompressFloatLossyImp(input, compressedSize, nelements, output); +} + +static FORCE_INLINE int tsCompressDoubleLossy(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, + char algorithm, char *const buffer, int bufferSize){ + return tsCompressDoubleLossyImp(input, nelements, output); +} + +static FORCE_INLINE int tsDecompressDoubleLossy(const char *const input, int compressedSize, const int nelements, char *const output, + int outputSize, char algorithm, char *const buffer, int bufferSize){ + return tsDecompressDoubleLossyImp(input, compressedSize, nelements, output); } +#endif + static FORCE_INLINE int tsCompressTimestamp(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { if (algorithm == ONE_STAGE_COMP) { diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index 1de6e76f7150b85dd804fbe6cbfa7cb3b1487895..4472633304a9bcf78d25f55bf1efc5225244e7c2 100644 --- a/src/util/src/tcompression.c +++ b/src/util/src/tcompression.c @@ -49,9 +49,14 @@ #include "os.h" #include "lz4.h" +#ifdef TD_TSZ + #include "td_sz.h" +#endif #include "taosdef.h" #include "tscompression.h" #include "tulog.h" +#include "tglobal.h" + static const int TEST_NUMBER = 1; #define is_bigendian() ((*(char *)&TEST_NUMBER) == 0) @@ -61,6 +66,39 @@ static const int TEST_NUMBER = 1; #define ZIGZAG_ENCODE(T, v) ((u##T)((v) >> (sizeof(T) * 8 - 1))) ^ (((u##T)(v)) << 1) // zigzag encode #define ZIGZAG_DECODE(T, v) ((v) >> 1) ^ -((T)((v)&1)) // zigzag decode +#ifdef TD_TSZ +bool lossyFloat = false; +bool lossyDouble = false; + +// init call +int tsCompressInit(){ + // config + if(lossyColumns[0] == 0){ + lossyFloat = false; + lossyDouble = false; + return 0; + } + + lossyFloat = strstr(lossyColumns, "float") != NULL; + lossyDouble = strstr(lossyColumns, "double") != NULL; + + if(lossyFloat == false && lossyDouble == false) + return 0; + + tdszInit(fPrecision, dPrecision, maxRange, curRange, Compressor); + if(lossyFloat) + uInfo("lossy compression float is opened. "); + if(lossyDouble) + uInfo("lossy compression double is opened. "); + return 1; +} +// exit call +void tsCompressExit(){ + tdszExit(); +} + +#endif + /* * Compress Integer (Simple8B). */ @@ -410,6 +448,7 @@ int tsCompressStringImp(const char *const input, int inputSize, char *const outp int tsDecompressStringImp(const char *const input, int compressedSize, char *const output, int outputSize) { // compressedSize is the size of data after compression. + if (input[0] == 1) { /* It is compressed by LZ4 algorithm */ const int decompressed_size = LZ4_decompress_safe(input + 1, output, compressedSize - 1, outputSize); @@ -886,3 +925,72 @@ int tsDecompressFloatImp(const char *const input, const int nelements, char *con return nelements * FLOAT_BYTES; } + +#ifdef TD_TSZ +// +// ---------- float double lossy ----------- +// +int tsCompressFloatLossyImp(const char * input, const int nelements, char *const output){ + // compress with sz + int compressedSize = tdszCompress(SZ_FLOAT, input, nelements, output + 1); + unsigned char algo = ALGO_SZ_LOSSY << 1; + if (compressedSize == 0 || compressedSize >= nelements*sizeof(float)){ + // compressed error or large than original + output[0] = MODE_NOCOMPRESS | algo; + memcpy(output + 1, input, nelements * sizeof(float)); + compressedSize = 1 + nelements * sizeof(float); + } else { + // compressed successfully + output[0] = MODE_COMPRESS | algo; + compressedSize += 1; + } + + return compressedSize; +} + +int tsDecompressFloatLossyImp(const char * input, int compressedSize, const int nelements, char *const output){ + int decompressedSize = 0; + if( HEAD_MODE(input[0]) == MODE_NOCOMPRESS){ + // orginal so memcpy directly + decompressedSize = nelements * sizeof(float); + memcpy(output, input + 1, decompressedSize); + + return decompressedSize; + } + + // decompressed with sz + return tdszDecompress(SZ_FLOAT, input + 1, compressedSize - 1, nelements, output); +} + +int tsCompressDoubleLossyImp(const char * input, const int nelements, char *const output){ + // compress with sz + int compressedSize = tdszCompress(SZ_DOUBLE, input, nelements, output + 1); + unsigned char algo = ALGO_SZ_LOSSY << 1; + if (compressedSize == 0 || compressedSize >= nelements*sizeof(double)) { + // compressed error or large than original + output[0] = MODE_NOCOMPRESS | algo; + memcpy(output + 1, input, nelements * sizeof(double)); + compressedSize = 1 + nelements * sizeof(double); + } else { + // compressed successfully + output[0] = MODE_COMPRESS | algo; + compressedSize += 1; + } + + return compressedSize; +} + +int tsDecompressDoubleLossyImp(const char * input, int compressedSize, const int nelements, char *const output){ + int decompressedSize = 0; + if( HEAD_MODE(input[0]) == MODE_NOCOMPRESS){ + // orginal so memcpy directly + decompressedSize = nelements * sizeof(double); + memcpy(output, input + 1, decompressedSize); + + return decompressedSize; + } + + // decompressed with sz + return tdszDecompress(SZ_DOUBLE, input + 1, compressedSize - 1, nelements, output); +} +#endif \ No newline at end of file diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index 80071986d6d2396ef2aec8f7841b0897cb3d7b26..5a3dc3f9bcdee41f974e48f22b27beb2a1eb5a35 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -61,6 +61,24 @@ static void taosReadFloatConfig(SGlobalCfg *cfg, char *input_value) { } } +static void taosReadDoubleConfig(SGlobalCfg *cfg, char *input_value) { + double value = atof(input_value); + double *option = (double *)cfg->ptr; + if (value < cfg->minValue || value > cfg->maxValue) { + uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%f", + cfg->option, input_value, cfg->minValue, cfg->maxValue, *option); + } else { + if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) { + *option = value; + cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE; + } else { + uWarn("config option:%s, input value:%s, is configured by %s, use %f", cfg->option, input_value, + tsCfgStatusStr[cfg->cfgStatus], *option); + } + } +} + + static void taosReadInt32Config(SGlobalCfg *cfg, char *input_value) { int32_t value = atoi(input_value); int32_t *option = (int32_t *)cfg->ptr; @@ -262,6 +280,9 @@ static void taosReadConfigOption(const char *option, char *value, char *value2, case TAOS_CFG_VTYPE_FLOAT: taosReadFloatConfig(cfg, value); break; + case TAOS_CFG_VTYPE_DOUBLE: + taosReadDoubleConfig(cfg, value); + break; case TAOS_CFG_VTYPE_STRING: taosReadStringConfig(cfg, value); break; @@ -463,6 +484,9 @@ void taosPrintGlobalCfg() { case TAOS_CFG_VTYPE_FLOAT: uInfo(" %s:%s%f%s", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]); break; + case TAOS_CFG_VTYPE_DOUBLE: + uInfo(" %s:%s%f%s", cfg->option, blank, *((double *)cfg->ptr), tsGlobalUnit[cfg->unitType]); + break; case TAOS_CFG_VTYPE_STRING: case TAOS_CFG_VTYPE_IPSTR: case TAOS_CFG_VTYPE_DIRECTORY: diff --git a/tests/examples/c/CMakeLists.txt b/tests/examples/c/CMakeLists.txt index 906ca2dd41c3fb222c816f49dd23af41cc81cffe..e94de3cbca574de71c8bcefc4b52173922c05a98 100644 --- a/tests/examples/c/CMakeLists.txt +++ b/tests/examples/c/CMakeLists.txt @@ -5,6 +5,8 @@ IF (TD_LINUX) AUX_SOURCE_DIRECTORY(. SRC) ADD_EXECUTABLE(demo apitest.c) TARGET_LINK_LIBRARIES(demo taos_static trpc tutil pthread ) + ADD_EXECUTABLE(sml schemaless.c) + TARGET_LINK_LIBRARIES(sml taos_static trpc tutil pthread ) ADD_EXECUTABLE(subscribe subscribe.c) TARGET_LINK_LIBRARIES(subscribe taos_static trpc tutil pthread ) ADD_EXECUTABLE(epoll epoll.c) diff --git a/tests/examples/c/apitest.c b/tests/examples/c/apitest.c index a377bbc7b47e1a58d4b3294b88386a9c4fb74e47..ac522d6151b005e51dee0dd6d352f1eeb5cb62a9 100644 --- a/tests/examples/c/apitest.c +++ b/tests/examples/c/apitest.c @@ -964,21 +964,31 @@ int32_t verify_schema_less(TAOS* taos) { usleep(100000); char* lines[] = { - "st,t1=3i,t2=4,t3=\"t3\" c1=3i,c3=L\"passit\",c2=false,c4=4 1626006833639000000", - "st,t1=4i,t3=\"t4\",t2=5,t4=5 c1=3i,c3=L\"passitagin\",c2=true,c4=5,c5=5 1626006833640000000", - "ste,t2=5,t3=L\"ste\" c1=true,c2=4,c3=\"iam\" 1626056811823316532", - "st,t1=4i,t2=5,t3=\"t4\" c1=3i,c3=L\"passitagain\",c2=true,c4=5 1626006833642000000", - "ste,t2=5,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532", - "ste,t2=5,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32b,c6=64s,c7=32w,c8=88.88f 1626056812843316532", - "st,t1=4i,t3=\"t4\",t2=5,t4=5 c1=3i,c3=L\"passitagin\",c2=true,c4=5,c5=5,c6=7u 1626006933640000000", - "stf,t1=4i,t3=\"t4\",t2=5,t4=5 c1=3i,c3=L\"passitagin\",c2=true,c4=5,c5=5,c6=7u 1626006933640000000", - "stf,t1=4i,t3=\"t4\",t2=5,t4=5 c1=3i,c3=L\"passitagin_stf\",c2=false,c5=5,c6=7u 1626006933641a" + "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", + "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns", + "ste,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532ns", + "st,t1=4i64,t2=5f64,t3=\"t4\" c1=3i64,c3=L\"passitagain\",c2=true,c4=5f64 1626006833642000000ns", + "ste,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532ns", + "ste,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532ns", + "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", + "stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", + "stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns" }; -// int code = taos_insert_lines(taos, lines , sizeof(lines)/sizeof(char*)); - int code = taos_insert_lines(taos, &lines[0], 1); - code = taos_insert_lines(taos, &lines[1], 1); + int code = 0; + code = taos_insert_lines(taos, lines , sizeof(lines)/sizeof(char*)); + char* lines2[] = { + "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", + "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns" + }; + code = taos_insert_lines(taos, &lines2[0], 1); + code = taos_insert_lines(taos, &lines2[1], 1); + char* lines3[] = { + "sth,t1=4i64,t2=5f64,t4=5f64,ID=\"childtable\" c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641ms", + "sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654ms" + }; + code = taos_insert_lines(taos, lines3, 2); return code; } @@ -1000,10 +1010,8 @@ int main(int argc, char *argv[]) { printf("client info: %s\n", info); printf("************ verify shemaless *************\n"); - int code = verify_schema_less(taos); - if (code == 0) { - return code; - } + verify_schema_less(taos); + printf("************ verify query *************\n"); verify_query(taos); diff --git a/tests/examples/c/schemaless.c b/tests/examples/c/schemaless.c new file mode 100644 index 0000000000000000000000000000000000000000..d6450914dfc7d406febca1792a35bd677c7b185a --- /dev/null +++ b/tests/examples/c/schemaless.c @@ -0,0 +1,161 @@ +#include "taos.h" +#include "taoserror.h" +#include "os.h" + +#include +#include +#include +#include +#include + +int numSuperTables = 8; +int numChildTables = 1024; +int numRowsPerChildTable = 128; + +void shuffle(char**lines, size_t n) +{ + if (n > 1) + { + size_t i; + for (i = 0; i < n - 1; i++) + { + size_t j = i + rand() / (RAND_MAX / (n - i) + 1); + char* t = lines[j]; + lines[j] = lines[i]; + lines[i] = t; + } + } +} + +static int64_t getTimeInUs() { + struct timeval systemTime; + gettimeofday(&systemTime, NULL); + return (int64_t)systemTime.tv_sec * 1000000L + (int64_t)systemTime.tv_usec; +} + +int main(int argc, char* argv[]) { + TAOS_RES *result; + const char* host = "127.0.0.1"; + const char* user = "root"; + const char* passwd = "taosdata"; + + taos_options(TSDB_OPTION_TIMEZONE, "GMT-8"); + TAOS* taos = taos_connect(host, user, passwd, "", 0); + if (taos == NULL) { + printf("\033[31mfailed to connect to db, reason:%s\033[0m\n", taos_errstr(taos)); + exit(1); + } + + char* info = taos_get_server_info(taos); + printf("server info: %s\n", info); + info = taos_get_client_info(taos); + printf("client info: %s\n", info); + result = taos_query(taos, "drop database if exists db;"); + taos_free_result(result); + usleep(100000); + result = taos_query(taos, "create database db precision 'ms';"); + taos_free_result(result); + usleep(100000); + + (void)taos_select_db(taos, "db"); + + time_t ct = time(0); + int64_t ts = ct * 1000; + char* lineFormat = "sta%d,t0=true,t1=127i8,t2=32767i16,t3=%di32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=255u8,c6=32770u16,c7=2147483699u32,c8=9223372036854775899u64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" %lldms"; + + char** lines = calloc(numSuperTables * numChildTables * numRowsPerChildTable, sizeof(char*)); + int l = 0; + for (int i = 0; i < numSuperTables; ++i) { + for (int j = 0; j < numChildTables; ++j) { + for (int k = 0; k < numRowsPerChildTable; ++k) { + char* line = calloc(512, 1); + snprintf(line, 512, lineFormat, i, j, ts + 10 * l); + lines[l] = line; + ++l; + } + } + } + shuffle(lines, numSuperTables * numChildTables * numRowsPerChildTable); + + printf("%s\n", "begin taos_insert_lines"); + int64_t begin = getTimeInUs(); + int32_t code = taos_insert_lines(taos, lines, numSuperTables * numChildTables * numRowsPerChildTable); + int64_t end = getTimeInUs(); + printf("code: %d, %s. time used: %"PRId64"\n", code, tstrerror(code), end-begin); + + char* lines_000_0[] = { + "sta1,id=sta1_1,t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=255u8,t6=32770u16,t7=2147483699u32,t8=9223372036854775899u64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=255u8,c6=32770u16,c7=2147483699u32,c8=9223372036854775899u64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" 1626006833639000us" + }; + + code = taos_insert_lines(taos, lines_000_0 , sizeof(lines_000_0)/sizeof(char*)); + if (0 == code) { + printf("taos_insert_lines() lines_000_0 should return error\n"); + return -1; + } + + char* lines_000_1[] = { + "sta2,id=\"sta2_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=255u8,t6=32770u16,t7=2147483699u32,t8=9223372036854775899u64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=255u8,c6=32770u16,c7=2147483699u32,c8=9223372036854775899u64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" 1626006833639001" + }; + + code = taos_insert_lines(taos, lines_000_1 , sizeof(lines_000_1)/sizeof(char*)); + if (0 == code) { + printf("taos_insert_lines() lines_000_1 should return error\n"); + return -1; + } + + char* lines_000_2[] = { + "sta3,id=\"sta3_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=255u8,c6=32770u16,c7=2147483699u32,c8=9223372036854775899u64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" 0" + }; + + code = taos_insert_lines(taos, lines_000_2 , sizeof(lines_000_2)/sizeof(char*)); + if (0 != code) { + printf("taos_insert_lines() lines_000_2 return code:%d (%s)\n", code, (char*)tstrerror(code)); + return -1; + } + + char* lines_001_0[] = { + "sta4,t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" 1626006833639000us", + + }; + + code = taos_insert_lines(taos, lines_001_0 , sizeof(lines_001_0)/sizeof(char*)); + if (0 != code) { + printf("taos_insert_lines() lines_001_0 return code:%d (%s)\n", code, (char*)tstrerror(code)); + return -1; + } + + char* lines_001_1[] = { + "sta5,id=\"sta5_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" 1626006833639001" + }; + + code = taos_insert_lines(taos, lines_001_1 , sizeof(lines_001_1)/sizeof(char*)); + if (0 != code) { + printf("taos_insert_lines() lines_001_1 return code:%d (%s)\n", code, (char*)tstrerror(code)); + return -1; + } + + char* lines_001_2[] = { + "sta6,id=\"sta6_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" 0" + }; + + code = taos_insert_lines(taos, lines_001_2 , sizeof(lines_001_2)/sizeof(char*)); + if (0 != code) { + printf("taos_insert_lines() lines_001_2 return code:%d (%s)\n", code, (char*)tstrerror(code)); + return -1; + } + + char* lines_002[] = { + "stb,id=\"stb_1\",t20=t,t21=T,t22=true,t23=True,t24=TRUE,t25=f,t26=F,t27=false,t28=False,t29=FALSE,t10=33.12345,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c20=t,c21=T,c22=true,c23=True,c24=TRUE,c25=f,c26=F,c27=false,c28=False,c29=FALSE,c10=33.12345,c11=\"binaryValue\",c12=L\"ncharValue\" 1626006833639000000ns", + "stc,id=\"stc_1\",t20=t,t21=T,t22=true,t23=True,t24=TRUE,t25=f,t26=F,t27=false,t28=False,t29=FALSE,t10=33.12345,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c20=t,c21=T,c22=true,c23=True,c24=TRUE,c25=f,c26=F,c27=false,c28=False,c29=FALSE,c10=33.12345,c11=\"binaryValue\",c12=L\"ncharValue\" 1626006833639019us", + "stc,id=\"stc_1\",t20=t,t21=T,t22=true,t23=True,t24=TRUE,t25=f,t26=F,t27=false,t28=False,t29=FALSE,t10=33.12345,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c20=t,c21=T,c22=true,c23=True,c24=TRUE,c25=f,c26=F,c27=false,c28=False,c29=FALSE,c10=33.12345,c11=\"binaryValue\",c12=L\"ncharValue\" 1626006833640ms", + "stc,id=\"stc_1\",t20=t,t21=T,t22=true,t23=True,t24=TRUE,t25=f,t26=F,t27=false,t28=False,t29=FALSE,t10=33.12345,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c20=t,c21=T,c22=true,c23=True,c24=TRUE,c25=f,c26=F,c27=false,c28=False,c29=FALSE,c10=33.12345,c11=\"binaryValue\",c12=L\"ncharValue\" 1626006834s" + }; + + code = taos_insert_lines(taos, lines_002 , sizeof(lines_002)/sizeof(char*)); + if (0 != code) { + printf("taos_insert_lines() lines_002 return code:%d (%s)\n", code, (char*)tstrerror(code)); + return -1; + } + + return 0; +} diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 63a5431d75ce7536c15fb7886feb76d391dd71c6..bdebb5ef351f8da37dc73969e555590fe6eee541 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -27,6 +27,7 @@ python3 ./test.py -f insert/bug3654.py python3 ./test.py -f insert/insertDynamicColBeforeVal.py python3 ./test.py -f insert/in_function.py python3 ./test.py -f insert/modify_column.py +python3 ./test.py -f insert/line_insert.py #table python3 ./test.py -f table/alter_wal0.py @@ -352,7 +353,8 @@ python3 ./test.py -f alter/alter_debugFlag.py python3 ./test.py -f query/queryBetweenAnd.py python3 ./test.py -f tag_lite/alter_tag.py -# python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +#python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +#python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py python3 test.py -f tools/taosdemoAllTest/TD-4985/query-limit-offset.py python3 ./test.py -f tag_lite/drop_auto_create.py @@ -361,4 +363,6 @@ python3 test.py -f alter/alter_keep.py python3 test.py -f alter/alter_cacheLastRow.py python3 ./test.py -f query/querySession.py python3 test.py -f alter/alter_create_exception.py + +python3 ./test.py -f insert/flushwhiledrop.py #======================p4-end=============== diff --git a/tests/pytest/insert/flushwhiledrop.py b/tests/pytest/insert/flushwhiledrop.py new file mode 100644 index 0000000000000000000000000000000000000000..3784657117ad9e5a24851a2e6ac11e11594f0c72 --- /dev/null +++ b/tests/pytest/insert/flushwhiledrop.py @@ -0,0 +1,67 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import threading +from util.log import * +from util.cases import * +from util.sql import * +from time import sleep + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.numberOfRecords = 15000 + self.ts = 1601481600000 + + def run(self): + tdSql.execute('create database test cache 1 blocks 3') + tdSql.execute('use test') + tdSql.execute('create table tb(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8))') + threads = [] + t1 = threading.Thread(target=self.insertAndFlush, args=()) + threads.append(t1) + t2 = threading.Thread(target=self.drop, args=()) + threads.append(t2) + for t in threads: + t.setDaemon(True) + t.start() + for t in threads: + t.join() + + def insertAndFlush(self): + finish = 0 + currts = self.ts + + while(finish < self.numberOfRecords): + sql = "insert into tb values" + for i in range(finish, self.numberOfRecords): + sql += "(%d, 1019774612, 29931, 1442173978, 165092.468750, 1128.643179, 'MOCq1pTu', 18405, 82, 0, 'g0A6S0Fu')" % (currts + i) + finish = i + 1 + if (1048576 - len(sql)) < 16384: + break + tdSql.execute(sql) + + def drop(self): + sleep(30) + tdSql.execute('drop database test') + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/insert/line_insert.py b/tests/pytest/insert/line_insert.py new file mode 100644 index 0000000000000000000000000000000000000000..ff3a32b0f79028ce4f612c12b41171a2bd45a765 --- /dev/null +++ b/tests/pytest/insert/line_insert.py @@ -0,0 +1,91 @@ +################################################################### +# Copyright (c) 2021 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self._conn = conn + + def run(self): + print("running {}".format(__file__)) + tdSql.execute("drop database if exists test") + tdSql.execute("create database if not exists test precision 'us'") + tdSql.execute('use test') + + tdSql.execute('create stable ste(ts timestamp, f int) tags(t1 bigint)') + + lines = [ "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", + "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns", + "ste,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532ns", + "stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", + "st,t1=4i64,t2=5f64,t3=\"t4\" c1=3i64,c3=L\"passitagain\",c2=true,c4=5f64 1626006833642000000ns", + "ste,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532ns", + "ste,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532ns", + "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", + "stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns" + ] + + code = self._conn.insertLines(lines) + print("insertLines result {}".format(code)) + + lines2 = [ "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", + "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns" + ] + + code = self._conn.insertLines([ lines2[0] ]) + print("insertLines result {}".format(code)) + + self._conn.insertLines([ lines2[1] ]) + print("insertLines result {}".format(code)) + + tdSql.query("select * from st") + tdSql.checkRows(4) + + tdSql.query("select * from ste") + tdSql.checkRows(3) + + tdSql.query("select * from stf") + tdSql.checkRows(2) + + tdSql.query("select * from stg") + tdSql.checkRows(2) + + tdSql.query("show tables") + tdSql.checkRows(8) + + tdSql.query("describe stf") + tdSql.checkData(2, 2, 14) + + self._conn.insertLines([ + "sth,t1=4i64,t2=5f64,t4=5f64,ID=\"childtable\" c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641ms", + "sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654ms" + ]) + tdSql.query('select tbname, * from sth') + tdSql.checkRows(2) + + tdSql.query('select tbname, * from childtable') + tdSql.checkRows(1) + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json similarity index 80% rename from tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json rename to tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json index cd69badad154c6417d0e8d57f4d252354d40ad6b..4f31351516e927b4ec7638540c0aca70ed54c022 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json +++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json @@ -84,11 +84,37 @@ "columns": [{"type": "BINARY", "len": 16370, "count":1},{"type": "INT"}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, { "name": "stb2", "child_table_exists":"no", "childtable_count": 1, - "childtable_prefix": "stb01_", + "childtable_prefix": "stb02_", "auto_create_table": "no", "batch_create_tbl_num": 12, "data_source": "rand", @@ -111,10 +137,10 @@ "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }, { - "name": "stb3", + "name": "stb4", "child_table_exists":"no", "childtable_count": 1, - "childtable_prefix": "stb01_", + "childtable_prefix": "stb04_", "auto_create_table": "no", "batch_create_tbl_num": 12, "data_source": "rand", @@ -133,7 +159,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "BINARY", "len": 16371, "count":1},{"type": "INT"}], + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json new file mode 100644 index 0000000000000000000000000000000000000000..d9ac2072f1fb5f29f7b5e6540d20d04837e461c2 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 1000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 5, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge1024.json b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json similarity index 95% rename from tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge1024.json rename to tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json index 42461b2f6fba85093a6a45883608b49277669568..e5e31f75ef2e7ede4a8d1eb202c298c6952559e4 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge1024.json +++ b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json @@ -55,7 +55,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1005}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1005}, {"type": "BINARY", "len": 5, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] }] }] diff --git a/tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum1024.json b/tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum4096.json similarity index 96% rename from tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum1024.json rename to tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum4096.json index 7c12a62764ecd129342d916092cf732fe202151f..f1aa981508f063adccd4cf2f5c6166a16deb9a23 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum1024.json +++ b/tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum4096.json @@ -55,7 +55,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "DOUBLE", "count":1024}], + "columns": [{"type": "DOUBLE", "count":4096}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] }] }] diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..b3e1024647ff14d0a4a47759e0c9aceab0ac5240 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1000, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 100, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 1000, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 200, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..26d483f57da2c30c7ab5d466f6b0b2cb3e5450b0 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-disorder-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-disorder-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..b1cd882bbf38545d1a3e7d4999fc4f6e0d5c4025 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-disorder-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 10, + "disorder_range": 100, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":1, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 100, + "disorder_range": 1, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..e541d663fc9f884a7206592271d5124da7746793 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..f32d44240d7f5b717013878358e5d4db378ba354 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..c9d93c2423612b3fb4c6ab1f2b5d577f3c64e8cd --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 150, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 151, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..7f94fa2e75b930489dc0106d1796df06af43967f --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 100, + "interlace_rows": 0, + "num_of_records_per_req": 2000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1000, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1000, + "insert_interval": 200, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-newdb-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-newdb-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..339a2555c87f01b8ec6ce84f018dd4787f39d7fd --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-newdb-stmt.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"yes", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 6, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 7, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 4, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 2, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-newtable-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-newtable-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..7e39ddbc0d6233c23d3eb9d5f34e9f0cc6a64360 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-newtable-stmt.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"yes", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 6, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 7, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 4, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 2, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 30, + "childtable_limit": 0, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-12-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..e83a04003324149803f040e61fa6750a20b2afbb --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "dbno", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-offset-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-offset-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..9502358de0e1eb92730dd6782d21bcaba4f67af5 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-offset-stmt.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"yes", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"yes", + "childtable_count": 6, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"yes", + "childtable_count": 7, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 4, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"yes", + "childtable_count": 8, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 2, + "childtable_offset":7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"yes", + "childtable_count": 8, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..5a500a12580e2fbe9aca206f962304f3310adb3f --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"yes", + "childtable_count": 5, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 6, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 7, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 4, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 2, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset": 7, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-sample-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-sample-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..c3f11bf03dad7b7bbc25e2af16488bbd0719bf02 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-sample-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "dbtest123", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./tools/taosdemoAllTest/sample.csv", + "tags_file": "", + "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "./tools/taosdemoAllTest/tags.csv", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":2}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-timestep-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-timestep-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..d2143366d7c3928495d5a4ef6f83edb5014670f4 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-timestep-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":20, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..c6909c6278cdbc6fd85eea04fb7e4e859f6df5cd --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json @@ -0,0 +1,166 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10240000000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16374, "count":1}], + "tags": [{"type": "TINYINT", "count":12}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16370, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb03_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 100, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..a5cc009ffb4a5f769d63b8fc4ad1d74f04a76c4b --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 0, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 2, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..d9678a58692af75e06c77451028151658f812a77 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": -1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 2, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..a448750f74b5ad7219c5f29d744729777f497053 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 1000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 5, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..4ec18c49d6c4614f55947d5ab3b9d9a9a84579af --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 100, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":0}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum1024.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json similarity index 96% rename from tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum1024.json rename to tests/pytest/tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json index 42f6ef2f2fe90f7eac23778542475f152794a509..c9dad3dc7f95a7b95682621103c945dff395d3b5 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum1024.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json @@ -40,12 +40,12 @@ "auto_create_table": "no", "batch_create_tbl_num": 10, "data_source": "rand", - "insert_mode": "taosc", + "insert_mode": "stmt", "insert_rows": 1000, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", - "interlace_rows": 0, + "interlace_rows": 1000, "insert_interval":0, "max_sql_len": 1024000, "disorder_ratio": 0, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..00c346678f884a06a0611116ad13e47117bad59f --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 50000, + "num_of_records_per_req": 50000, + "max_sql_len": 1025000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows":50000, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows":50000, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..4e47b3b404847a267f47413f6ab297e35cc84b0b --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 0, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 2, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..28e7bbb39bb5d2477842129936ed6584e617e25a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": -1, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":2}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 2, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..39e38afefd7060b6c6a0241521029e84816b999b --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 100, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "DOUBLE", "count":4096}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..f219d3c7a57146a075599eff495ffe93533373ef --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000000, + "max_sql_len": 1024000000, + "databases": [{ + "dbinfo": { + "name": "db1", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 10000, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BIGINT", "count":1}, {"type": "float", "count":1}, {"type": "double", "count":1}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":127}, {"type": "BINARY", "len": 16, "count":2}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertTimestepMulRowsLargeint16-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertTimestepMulRowsLargeint16-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..ed3eb280f6869bed76de72bdf50b646bca4a245a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertTimestepMulRowsLargeint16-stmt.json @@ -0,0 +1,65 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "databases": [ + { + "dbinfo": { + "name": "blf", + "drop": "yes" + }, + "super_tables": [ + { + "name": "p_0_topics", + "child_table_exists": "no", + "childtable_count": 10, + "childtable_prefix": "p_0_topics_", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 525600, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1000, + "max_sql_len": 1048576, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 60000, + "start_timestamp": "2019-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "FLOAT", + "count": 1 + }, + { + "type": "BINARY", + "len": 12, + "count": 1 + } + ], + "tags": [ + { + "type": "BINARY", + "len": 12, + "count": 10 + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/nsertColumnsAndTagNumLarge4096-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/nsertColumnsAndTagNumLarge4096-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..2105398d55b80f14f2fcfcd08f752333e27c031c --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/nsertColumnsAndTagNumLarge4096-stmt.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10000, + "num_of_records_per_req": 10000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1005}, {"type": "BINARY", "len": 16, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index d9d6cc1082e9eac9ef3a900152bcbb8b77942c61..4d80328c289921959303e6610888b4b1a20411dc 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -170,56 +170,58 @@ class TDTestCase: # insert: let parament in json file is illegal, it'll expect error. - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge1024.json -y " % binPath) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json -y " % binPath) tdSql.error("use db") - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertSigcolumnsNum1024.json -y " % binPath) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertSigcolumnsNum4096.json -y " % binPath) tdSql.error("select * from db.stb0") - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNum1024.json -y " % binPath) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNum4096.json -y " % binPath) tdSql.query("select count(*) from db.stb0") - tdSql.checkData(0, 0, 10000) + tdSql.checkData(0, 0, 10000) tdSql.execute("drop database if exists db") os.system("%staosdemo -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y " % binPath) tdSql.query("select count(*) from db.stb0") tdSql.checkRows(0) - tdSql.execute("drop database if exists db") + tdSql.execute("drop database if exists db") os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsNum0.json -y " % binPath) - tdSql.execute("use db") + tdSql.execute("use db") tdSql.query("show stables like 'stb0%' ") tdSql.checkData(0, 2, 11) - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y " % binPath) - tdSql.error("use db1") - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json -y " % binPath) - tdSql.query("select count(*) from db.stb0") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y " % binPath) + tdSql.error("use db1") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json -y " % binPath) + tdSql.query("select count(*) from db.stb0") tdSql.checkRows(1) - tdSql.query("select count(*) from db.stb1") + tdSql.query("select count(*) from db.stb1") tdSql.checkRows(1) - tdSql.error("select * from db.stb3") + tdSql.error("select * from db.stb4") tdSql.error("select * from db.stb2") - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath) - tdSql.error("select count(*) from db.stb0") - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y " % binPath) - tdSql.error("use db") - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertChildTab0.json -y " % binPath) - tdSql.error("use db") - tdSql.execute("drop database if exists db") - os.system("%staosdemo -f tools/taosdemoAllTest/insertChildTabLess0.json -y " % binPath) - tdSql.error("use db") - tdSql.execute("drop database if exists blf") - os.system("%staosdemo -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y " % binPath) - tdSql.execute("use blf") - tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1") + tdSql.query("select count(*) from db.stb3") + tdSql.checkRows(1) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath) + tdSql.error("select count(*) from db.stb0") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertChildTab0.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertChildTabLess0.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists blf") + os.system("%staosdemo -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y " % binPath) + tdSql.execute("use blf") + tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1") tdSql.checkData(0, 0, "2020-03-31 12:00:00.000") tdSql.query("select first(ts) from blf.p_0_topics_2") tdSql.checkData(0, 0, "2019-10-01 00:00:00") - tdSql.query("select last(ts) from blf.p_0_topics_6 ") + tdSql.query("select last(ts) from blf.p_0_topics_6 ") tdSql.checkData(0, 0, "2020-09-29 23:59:00") os.system("%staosdemo -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y " % binPath) tdSql.execute("use db") @@ -316,11 +318,12 @@ class TDTestCase: tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes tdSql.checkRows(20) + testcaseFilename = os.path.split(__file__)[-1] os.system("rm -rf ./insert_res.txt") - os.system("rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql") - - - + os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename ) + + + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py new file mode 100644 index 0000000000000000000000000000000000000000..2e6ad658a678841fd8c9b1cf57fa443937df722c --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py @@ -0,0 +1,316 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + # insert: create one or mutiple tables per sql and insert multiple rows per sql + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(*) from stb00_0") + tdSql.checkData(0, 0, 100) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 100000) + tdSql.query("select count(*) from stb01_1") + tdSql.checkData(0, 0, 200) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 200000) + + + # insert: create mutiple tables per sql and insert one rows per sql . + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 20) + tdSql.query("select count(*) from stb00_0") + tdSql.checkData(0, 0, 10000) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 100000) + tdSql.query("select count(*) from stb01_0") + tdSql.checkData(0, 0, 20000) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 400000) + + # insert: using parament "insert_interval to controls spped of insert. + # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json -y" % binPath) + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkData(0, 4, 100) + tdSql.query("select count(*) from stb00_0") + tdSql.checkData(0, 0, 20000) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 2000000) + tdSql.query("show stables") + tdSql.checkData(1, 4, 100) + tdSql.query("select count(*) from stb01_0") + tdSql.checkData(0, 0, 20000) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 2000000) + + # spend 2min30s for 3 testcases. + # insert: drop and child_table_exists combination test + # insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json -y" % binPath) + tdSql.error("show dbno.stables") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-newdb-stmt.json -y" % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 5) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 6) + tdSql.query("select count (tbname) from stb2") + tdSql.checkData(0, 0, 7) + tdSql.query("select count (tbname) from stb3") + tdSql.checkData(0, 0, 8) + tdSql.query("select count (tbname) from stb4") + tdSql.checkData(0, 0, 8) + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-offset-stmt.json -y" % binPath) + tdSql.execute("use db") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 50) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 240) + tdSql.query("select count(*) from stb2") + tdSql.checkData(0, 0, 220) + tdSql.query("select count(*) from stb3") + tdSql.checkData(0, 0, 180) + tdSql.query("select count(*) from stb4") + tdSql.checkData(0, 0, 160) + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-newtable-stmt.json -y" % binPath) + tdSql.execute("use db") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 150) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 360) + tdSql.query("select count(*) from stb2") + tdSql.checkData(0, 0, 360) + tdSql.query("select count(*) from stb3") + tdSql.checkData(0, 0, 340) + tdSql.query("select count(*) from stb4") + tdSql.checkData(0, 0, 400) + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json -y" % binPath) + tdSql.execute("use db") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 50) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 120) + tdSql.query("select count(*) from stb2") + tdSql.checkData(0, 0, 140) + tdSql.query("select count(*) from stb3") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from stb4") + tdSql.checkData(0, 0, 160) + + + # insert: let parament in json file is illegal, it'll expect error. + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertColumnsAndTagNumLarge4096-stmt.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json -y " % binPath) + tdSql.error("select * from db.stb0") + tdSql.execute("drop database if exists db") + # os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json -y " % binPath) + # tdSql.query("select count(*) from db.stb0") + # tdSql.checkData(0, 0, 10000) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json -y " % binPath) + tdSql.query("select count(*) from db.stb0") + tdSql.checkRows(0) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("show stables like 'stb0%' ") + tdSql.checkData(0, 2, 11) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json -y " % binPath) + tdSql.error("use db1") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json -y " % binPath) + tdSql.query("select count(*) from db.stb0") + tdSql.checkRows(1) + tdSql.query("select count(*) from db.stb1") + tdSql.checkRows(1) + tdSql.error("select * from db.stb4") + tdSql.error("select * from db.stb2") + tdSql.query("select count(*) from db.stb3") + tdSql.checkRows(1) + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json -y " % binPath) + tdSql.error("select count(*) from db.stb0") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json -y " % binPath) + tdSql.error("use db") + tdSql.execute("drop database if exists blf") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertTimestepMulRowsLargeint16-stmt.json -y " % binPath) + tdSql.execute("use blf") + tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1") + tdSql.checkData(0, 0, "2020-03-31 12:00:00.000") + tdSql.query("select first(ts) from blf.p_0_topics_2") + tdSql.checkData(0, 0, "2019-10-01 00:00:00") + tdSql.query("select last(ts) from blf.p_0_topics_6 ") + tdSql.checkData(0, 0, "2020-09-29 23:59:00") + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 5000000) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 5000000) + + + # insert: timestamp and step + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-timestep-stmt.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 20) + tdSql.query("select last(ts) from db.stb00_0") + tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 200) + tdSql.query("select last(ts) from db.stb01_0") + tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 400) + + # # insert: disorder_ratio + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-disorder-stmt.json 2>&1 -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 1) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 1) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 10) + + # # insert: sample json + # os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-sample-stmt.json -y " % binPath) + # tdSql.execute("use dbtest123") + # tdSql.query("select col2 from stb0") + # tdSql.checkData(0, 0, 2147483647) + # tdSql.query("select * from stb1 where t1=-127") + # tdSql.checkRows(20) + # tdSql.query("select * from stb1 where t2=127") + # tdSql.checkRows(10) + # tdSql.query("select * from stb1 where t2=126") + # tdSql.checkRows(10) + + # insert: test interlace parament + os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 100) + tdSql.query("select count (*) from stb0") + tdSql.checkData(0, 0, 15000) + + + # insert: auto_create + + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -y -f tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json " % binPath) # drop = no, child_table_exists, auto_create_table varies + tdSql.execute('use db') + tdSql.query('show tables like \'NN123%\'') #child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'NNN%\'') #child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'NNY%\'') #child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query('show tables like \'NYN%\'') #child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(0) + tdSql.query('show tables like \'NY123%\'') #child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(0) + tdSql.query('show tables like \'NYY%\'') #child_table_exists = yes, auto_create_table varies = yes + tdSql.checkRows(0) + + tdSql.execute('drop database if exists db') + os.system("%staosdemo -y -f tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json " % binPath) # drop = yes, child_table_exists, auto_create_table varies + tdSql.execute('use db') + tdSql.query('show tables like \'YN123%\'') #child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'YNN%\'') #child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'YNY%\'') #child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query('show tables like \'YYN%\'') #child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'YY123%\'') #child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes + tdSql.checkRows(20) + + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename ) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/wal/sdbCompClusterReplica2.py b/tests/pytest/wal/sdbCompClusterReplica2.py index e364145e190143f2807612350757b64519019daa..dd5a37515142e4c5505ed442bc44240d5120aa4e 100644 --- a/tests/pytest/wal/sdbCompClusterReplica2.py +++ b/tests/pytest/wal/sdbCompClusterReplica2.py @@ -86,7 +86,7 @@ class TwoClients: tdSql.execute("alter table stb2_0 add column col2 binary(4)") tdSql.execute("alter table stb2_0 drop column col1") tdSql.execute("insert into stb2_0 values(1614218422000,8638,'R')") - tdSql.execute("drop dnode 10") + tdSql.execute("drop dnode 2") sleep(10) os.system("rm -rf /var/lib/taos/*") print("clear dnode chenhaoran02'data files") @@ -97,9 +97,6 @@ class TwoClients: tdSql.execute("create dnode chenhaoran02 ;") - - - # stop taosd and compact wal file os.system("ps -ef |grep taosd |grep -v 'grep' |awk '{print $2}'|xargs kill -2") sleep(10) diff --git a/tests/robust/cluster.sh b/tests/robust/cluster.sh old mode 100644 new mode 100755 index 166014fefb2a8d67acb9d69ecd897b902195caf0..b291fb4d9ea229c4620004a0305b06a08994a99e --- a/tests/robust/cluster.sh +++ b/tests/robust/cluster.sh @@ -23,7 +23,9 @@ menu(){ echo "==============================" echo "3 arbitrator" echo "==============================" - echo "4 exit" + echo "4 alter replica" + echo "==============================" + echo "5 exit" echo "==============================" } @@ -310,6 +312,7 @@ do 2) var=`ps -ef | grep tarbitrator | awk '{print $2}' | head -n 1` kill -9 $var + echo -e "\033[32mSuccessfully stop arbitrator $3 \033[0m" break ;; 3) @@ -318,6 +321,13 @@ do esac ;; 4) + read -p "Enter replica number: " rep + read -p "Enter database name: " db + taos -s "alter database $db replica $rep" + echo -e "\033[32mSuccessfully change $db's replica to $rep \033[0m" + break + ;; + 5) break ;; esac diff --git a/tests/robust/makefile b/tests/robust/makefile new file mode 100644 index 0000000000000000000000000000000000000000..c98469498f9de31f423e5d8cf19462f92d3e0b8f --- /dev/null +++ b/tests/robust/makefile @@ -0,0 +1,8 @@ +NAME=robust +CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion -Wno-char-subscripts -D_REENTRANT -Wno-format -DLINUX -msse4.2 -Wno-unused-function -D_M_X64 -std=gnu99 + +all: + gcc $(CFLAGS) ./$(NAME).c -o $(NAME) -ltaos -lpthread + +clean: + rm $(NAME) \ No newline at end of file diff --git a/tests/robust/monitor.sh b/tests/robust/monitor.sh new file mode 100755 index 0000000000000000000000000000000000000000..4fc1fed75275f87eb184ed34234fdb04a7a5e312 --- /dev/null +++ b/tests/robust/monitor.sh @@ -0,0 +1,8 @@ +while : +do + dlog=`taos -s "show dnodes"` + mlog=`taos -s "show mnodes"` + echo "$dlog" | tee -a dnode.log + echo "$mlog" | tee -a mnode.log + sleep 1s +done \ No newline at end of file diff --git a/tests/robust/robust.c b/tests/robust/robust.c new file mode 100644 index 0000000000000000000000000000000000000000..3488ca1b9be8b6cca4d04fe5ba5841f00527b25d --- /dev/null +++ b/tests/robust/robust.c @@ -0,0 +1,260 @@ +#include +#include +#include +#include +#include +#include +#include + +typedef struct { + char querySQL[256]; + int client; + int stable; + int table; + unsigned interval; + int insert; + int create; + int query; +} ProArgs; + +typedef struct { + pthread_t pid; + int threadId; + void* taos; +} ThreadObj; + +static ProArgs arguments; +void parseArg(int argc, char *argv[]); +void create(); +void createImp(void *param); +void start(); +void insertImp(void *param); +void queryImp(void *param); + +int64_t getTimeStampMs() { + struct timeval systemTime; + gettimeofday(&systemTime, NULL); + return (int64_t)systemTime.tv_sec * 1000L + (int64_t)systemTime.tv_usec / 1000; +} + +void parseArg(int argc, char *argv[]) { + arguments.stable = 100000; + arguments.table = 50; + arguments.client = 16; + arguments.interval = 1; + sprintf(arguments.querySQL, "select count(*) from"); + for (int i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-stable") == 0) { + if (i < argc - 1) { + arguments.stable = atoi(argv[++i]); + } else { + fprintf(stderr, "'-stable' requires a parameter, default:%d\n", arguments.stable); + } + } else if (strcmp(argv[i], "-table") == 0) { + if (i < argc - 1) { + arguments.table = atoi(argv[++i]); + } else { + fprintf(stderr, "'-table' requires a parameter, default:%d\n", arguments.table); + } + } else if (strcmp(argv[i], "-client") == 0) { + if (i < argc - 1) { + arguments.client = atoi(argv[++i]); + } else { + fprintf(stderr, "'-client' requires a parameter, default:%d\n", arguments.client); + } + } else if (strcmp(argv[i], "-sql") == 0) { + if (i < argc - 1) { + strcpy(arguments.querySQL,argv[++i]); + } else { + fprintf(stderr, "'-sql' requires a parameter, default:%d\n", arguments.querySQL); + } + } else if (strcmp(argv[i], "-insert") == 0) { + arguments.insert = 1; + } else if (strcmp(argv[i], "-create") == 0) { + arguments.create = 1; + } else if (strcmp(argv[i], "-query") == 0) { + arguments.query = 1; + } + } +} + +void create() { + int64_t st = getTimeStampMs(); + void *taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); + if (taos == NULL) { + printf("TDengine error: failed to connect\n"); + exit(EXIT_FAILURE); + } + TAOS_RES *result = taos_query(taos, "drop database if exists db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + exit(EXIT_FAILURE); + } + taos_free_result(result); + int64_t elapsed = getTimeStampMs() - st; + printf("--- spend %ld ms to drop database db\n", elapsed); + st = getTimeStampMs(); + result = taos_query(taos, "create database if not exists db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + exit(EXIT_FAILURE); + } + taos_free_result(result); + elapsed = getTimeStampMs() - st; + printf("--- spend %ld ms to create database db\n", elapsed); + st = getTimeStampMs(); + start(); + printf("--- Spend %ld ms to create %d super tables and each %d tables\n", elapsed, arguments.stable, arguments.table); +} + +void createImp(void *param) { + char command[256] = "\0"; + int sqlLen = 0; + int count = 0; + char *sql = calloc(1, 1024*1024); + ThreadObj *pThread = (ThreadObj *)param; + printf("Thread %d start create super table s%d to s%d\n", pThread->threadId, (pThread->threadId - 1) * arguments.stable / arguments.client, pThread->threadId * arguments.stable / arguments.client - 1); + for (int i = (pThread->threadId - 1) * arguments.stable / arguments.client; i < pThread->threadId * arguments.stable / arguments.client; i++) { + sprintf(command, "create table if not exists db.s%d(ts timestamp, c1 int, c2 int, c3 int) TAGS (id int)", i); + TAOS_RES *result = taos_query(pThread->taos, command); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql:%s, reason:%s\n", __LINE__, command, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + result = taos_query(pThread->taos, "use db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + sqlLen = sprintf(sql, "create table if not exists "); + count = 0; + for (int j = 0; j < arguments.table; j++) { + sqlLen += sprintf(sql + sqlLen, " s%d_%d USING s%d TAGS (%d)", i, j, i, j); + if ((j + 1) % arguments.table == 0) { + result = taos_query(pThread->taos, sql); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + printf("Thread %d created table s%d_%d to s%d_%d\n", pThread->threadId, i, count, i, j); + count = j; + sqlLen = sprintf(sql, "create table if not exists "); + } + } + } +} + +void start() { + ThreadObj *threads = calloc((size_t)arguments.client, sizeof(ThreadObj)); + for (int i = 0; i < arguments.client; i++) { + ThreadObj *pthread = threads + i; + pthread_attr_t thattr; + pthread->threadId = i + 1; + pthread->taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); + pthread_attr_init(&thattr); + pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_JOINABLE); + if (arguments.create) { + pthread_create(&pthread->pid, &thattr, (void *(*)(void *))createImp, pthread); + } else if (arguments.insert) { + pthread_create(&pthread->pid, &thattr, (void *(*)(void *))insertImp, pthread); + } else if (arguments.query) { + pthread_create(&pthread->pid, &thattr, (void *(*)(void *))queryImp, pthread); + } + } + for (int i = 0; i < arguments.client; i++) { + pthread_join(threads[i].pid, NULL); + } + free(threads); +} + +void insertImp(void *param) { + int count = 0; + ThreadObj *pThread = (ThreadObj *)param; + printf("Thread %d start insert data\n", pThread->threadId); + int sqlLen = 0; + char *sql = calloc(1, 1024*1024); + TAOS_RES *result = taos_query(pThread->taos, "use db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + int64_t time = getTimeStampMs(); + while (true) { + sqlLen = sprintf(sql, "insert into"); + for (int i = (pThread->threadId - 1) * arguments.stable / arguments.client; i < pThread->threadId * arguments.stable / arguments.client; i++) { + for (int j = 0; j < arguments.table; j++) { + sqlLen += sprintf(sql + sqlLen, " s%d_%d values (%ld, %d, %d, %d)", i, j, time, rand(), rand(), rand()); + count++; + if ( (1048576 - sqlLen) < 49151 || i == (pThread->threadId * arguments.stable / arguments.client - 1)) { + result = taos_query(pThread->taos, sql); + printf("Thread %d already insert %d rows\n", pThread->threadId, count); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + sqlLen = sprintf(sql, "insert into"); + } + } + } + time += 1000*arguments.interval; + } +} + +void queryImp(void *param) { + ThreadObj *pThread = (ThreadObj *)param; + printf("Thread %d start query\n", pThread->threadId); + int sqlLen = 0; + char *sql = calloc(1, 1024*1024); + TAOS_RES *result = taos_query(pThread->taos, "use db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + while (true) { + for (int i = (pThread->threadId - 1) * arguments.stable / arguments.client; i < pThread->threadId * arguments.stable / arguments.client; i++) { + sqlLen = sprintf(sql, arguments.querySQL); + sqlLen += sprintf(sql + sqlLen, " s%d", i); + result = taos_query(pThread->taos, sql); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql: %s, reason:%s\n", __LINE__, sql, taos_errstr(result)); + taos_free_result(result); + return; + } + int num_fields = taos_field_count(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + TAOS_ROW row = NULL; + while ((row = taos_fetch_row(result))) { + char temp[16000] = {0}; + int len = taos_print_row(temp, row, fields, num_fields); + len += sprintf(temp + len, "\n"); + printf("Thread %d query result: %s\n", pThread->threadId, temp); + } + taos_free_result(result); + sleep(arguments.interval); + } + } + +} + +int main(int argc, char *argv[]) { + parseArg(argc, argv); + if (arguments.insert || arguments.query || arguments.create) { + start(); + } else { + printf("choose one argument: \n1) -create\n2) -insert\n3) -query\n"); + } +} \ No newline at end of file diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim index c820dd3bf56fb5268092dbdec2d37d7cfa0ca0c5..5b5a911558b5eb1d27f34fb10590a3b9ff52658c 100644 --- a/tests/script/fullGeneralSuite.sim +++ b/tests/script/fullGeneralSuite.sim @@ -105,6 +105,7 @@ run general/parser/import_commit2.sim run general/parser/import_commit3.sim run general/parser/insert_tb.sim run general/parser/first_last.sim +run general/parser/line_insert.sim #unsupport run general/parser/import_file.sim run general/parser/lastrow.sim run general/parser/nchar.sim diff --git a/tests/script/general/parser/line_insert.sim b/tests/script/general/parser/line_insert.sim index f3067a3bbec8c7d566570704d6b84caaaa1f8e67..85f2714ad3100766557797d2158d9d3e181b0f0b 100644 --- a/tests/script/general/parser/line_insert.sim +++ b/tests/script/general/parser/line_insert.sim @@ -16,11 +16,10 @@ sql create database $db precision 'us' sql use $db sql create stable $mte (ts timestamp, f int) TAGS(t1 bigint) -line_insert st,t1=3i,t2=4,t3="t3" c1=3i,c3=L"passit",c2=false,c4=4 1626006833639000000 -line_insert st,t1=4i,t3="t41",t2=5 c1=3i,c3=L"passiT",c2=true,c4=5 1626006833640000000 -line_insert stf,t1=4i,t2=5,t3="t4" c1=3i,c3=L"passitagain",c2=true,c4=5 1626006833642000000 -line_insert ste,t2=5,t3=L"ste" c1=true,c2=4,c3="iam" 1626056811823316532 - +line_insert st,t1=3i64,t2=4f64,t3="t3" c1=3i64,c3=L"passit",c2=false,c4=4f64 1626006833639000000ns +line_insert st,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin",c2=true,c4=5f64,c5=5f64 1626006833640000000ns +line_insert ste,t2=5f64,t3=L"ste" c1=true,c2=4i64,c3="iam" 1626056811823316532ns +line_insert stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns sql select * from st if $rows != 2 then return -1 @@ -30,7 +29,7 @@ if $data00 != @21-07-11 20:33:53.639000@ then return -1 endi -if $data03 != @passit@ then +if $data02 != @passit@ then return -1 endi