diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 32cfb5dbaac4fa3524950cb2c00fd2f2f814347b..1f7dbb8b6291e9599065086a41615384d43a3877 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -127,6 +127,7 @@ extern bool tsStartUdfd; // schemaless extern char tsSmlChildTableName[]; +extern bool tsSmlDataFormat; // internal extern int32_t tsTransPullupInterval; diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index cdae558653c993da846c8fca8c57105977d88a31..fe574b8ef693aead9b676d05855834ef2219017c 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -166,7 +166,7 @@ typedef struct { SMLProtocolType protocol; int8_t precision; - bool dataFormat; // true means that the name, number and order of keys in each line are the same(only for influx protocol) + bool dataFormat; // true means that the name and order of keys in each line are the same(only for influx protocol) SHashObj *childTables; SHashObj *superTables; @@ -1422,7 +1422,7 @@ static void smlDestroyInfo(SSmlHandle* info){ taosMemoryFreeClear(info); } -static SSmlHandle* smlBuildSmlInfo(TAOS* taos, SRequestObj* request, SMLProtocolType protocol, int8_t precision, bool dataFormat){ +static SSmlHandle* smlBuildSmlInfo(TAOS* taos, SRequestObj* request, SMLProtocolType protocol, int8_t precision){ int32_t code = TSDB_CODE_SUCCESS; SSmlHandle* info = (SSmlHandle*)taosMemoryCalloc(1, sizeof(SSmlHandle)); if (NULL == info) { @@ -1454,7 +1454,11 @@ static SSmlHandle* smlBuildSmlInfo(TAOS* taos, SRequestObj* request, SMLProtocol info->precision = precision; info->protocol = protocol; - info->dataFormat = dataFormat; + if(protocol == TSDB_SML_LINE_PROTOCOL){ + info->dataFormat = tsSmlDataFormat; + }else{ + info->dataFormat = true; + } info->pRequest = request; info->msgBuf.buf = info->pRequest->msgBuf; info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE; @@ -2335,7 +2339,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr return NULL; } - SSmlHandle* info = smlBuildSmlInfo(taos, request, (SMLProtocolType)protocol, precision, true); + SSmlHandle* info = smlBuildSmlInfo(taos, request, (SMLProtocolType)protocol, precision); if(!info){ return (TAOS_RES*)request; } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 5beb5454de40d16f1eb4e45b552e3bfd84b14036..33ba9473d0ba77d47a97920dd59820f07b85e931 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -79,6 +79,7 @@ uint16_t tsTelemPort = 80; // schemaless char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; //user defined child table name can be specified in tag value. //If set to empty system will generate table name using MD5 hash. +bool tsSmlDataFormat = true; // true means that the name and order of cols in each line are the same(only for influx protocol) // query int32_t tsQueryPolicy = 1; @@ -324,6 +325,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "keepColumnName", tsKeepOriginalColumnName, 1) != 0) return -1; if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 3, 1) != 0) return -1; if (cfgAddString(pCfg, "smlChildTableName", "", 1) != 0) return -1; + if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1; tsNumOfTaskQueueThreads = tsNumOfCores / 4; tsNumOfTaskQueueThreads = TRANGE(tsNumOfTaskQueueThreads, 1, 2); @@ -518,6 +520,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { } tstrncpy(tsSmlChildTableName, cfgGetItem(pCfg, "smlChildTableName")->str, TSDB_TABLE_NAME_LEN); + tsSmlDataFormat = cfgGetItem(pCfg, "smlDataFormat")->bval; tsShellActivityTimer = cfgGetItem(pCfg, "shellActivityTimer")->i32; tsCompressMsgSize = cfgGetItem(pCfg, "compressMsgSize")->i32;