fix:rm compare function for json and telnet in schemaless

This commit is contained in:
wangmm0220 2023-02-07 15:19:13 +08:00
parent bec6cdf784
commit fba3421029
4 changed files with 5 additions and 7 deletions

View File

@ -229,7 +229,7 @@ SSmlTableInfo* smlBuildTableInfo(int numRows, const char* measure, int32_t me
SSmlSTableMeta* smlBuildSTableMeta(bool isDataFormat); SSmlSTableMeta* smlBuildSTableMeta(bool isDataFormat);
int32_t smlSetCTableName(SSmlTableInfo *oneTable); int32_t smlSetCTableName(SSmlTableInfo *oneTable);
STableMeta* smlGetMeta(SSmlHandle *info, const void* measure, int32_t measureLen); STableMeta* smlGetMeta(SSmlHandle *info, const void* measure, int32_t measureLen);
int32_t is_same_child_table_telnet(const void *a, const void *b, size_t len); int32_t is_same_child_table_telnet(const void *a, const void *b);
int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32_t len); int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32_t len);
int32_t smlClearForRerun(SSmlHandle *info); int32_t smlClearForRerun(SSmlHandle *info);
int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg); int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg);

View File

@ -1323,7 +1323,6 @@ int32_t smlClearForRerun(SSmlHandle *info) {
static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char *rawLineEnd, int numLines) { static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char *rawLineEnd, int numLines) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
if (info->protocol == TSDB_SML_JSON_PROTOCOL) { if (info->protocol == TSDB_SML_JSON_PROTOCOL) {
taosHashSetEqualFp(info->childTables, is_same_child_table_telnet);
if (lines) { if (lines) {
code = smlParseJSON(info, *lines); code = smlParseJSON(info, *lines);
} else if (rawLine) { } else if (rawLine) {
@ -1368,7 +1367,6 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
code = smlParseInfluxString(info, tmp, tmp + len, info->lines + i); code = smlParseInfluxString(info, tmp, tmp + len, info->lines + i);
} }
} else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) {
taosHashSetEqualFp(info->childTables, is_same_child_table_telnet);
if (info->dataFormat) { if (info->dataFormat) {
SSmlLineInfo element = {0}; SSmlLineInfo element = {0};
code = smlParseTelnetString(info, (char *)tmp, (char *)tmp + len, &element); code = smlParseTelnetString(info, (char *)tmp, (char *)tmp + len, &element);

View File

@ -1010,7 +1010,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
bool needFree = info->dataFormat; bool needFree = info->dataFormat;
elements->tags = cJSON_PrintUnformatted(tagsJson); elements->tags = cJSON_PrintUnformatted(tagsJson);
elements->tagsLen = strlen(elements->tags); elements->tagsLen = strlen(elements->tags);
if(is_same_child_table_telnet(elements, &info->preLine, 0) != 0) { if(is_same_child_table_telnet(elements, &info->preLine) != 0) {
ret = smlParseTagsFromJSON(info, tagsJson, elements); ret = smlParseTagsFromJSON(info, tagsJson, elements);
if (unlikely(ret)) { if (unlikely(ret)) {
uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id); uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id);
@ -1180,7 +1180,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
} }
// Parse tags // Parse tags
if(is_same_child_table_telnet(elements, &info->preLine, 0) != 0){ if(is_same_child_table_telnet(elements, &info->preLine) != 0){
char tmp = *(elements->tags + elements->tagsLen); char tmp = *(elements->tags + elements->tagsLen);
*(elements->tags + elements->tagsLen) = 0; *(elements->tags + elements->tagsLen) = 0;
cJSON* tagsJson = cJSON_Parse(elements->tags); cJSON* tagsJson = cJSON_Parse(elements->tags);

View File

@ -20,7 +20,7 @@
#include "clientSml.h" #include "clientSml.h"
int32_t is_same_child_table_telnet(const void *a, const void *b, size_t len){ int32_t is_same_child_table_telnet(const void *a, const void *b){
SSmlLineInfo *t1 = (SSmlLineInfo *)a; SSmlLineInfo *t1 = (SSmlLineInfo *)a;
SSmlLineInfo *t2 = (SSmlLineInfo *)b; SSmlLineInfo *t2 = (SSmlLineInfo *)b;
// uError("is_same_child_table_telnet len:%d,%d %s,%s @@@ len:%d,%d %s,%s", t1->measureLen, t2->measureLen, // uError("is_same_child_table_telnet len:%d,%d %s,%s @@@ len:%d,%d %s,%s", t1->measureLen, t2->measureLen,
@ -70,7 +70,7 @@ static void smlParseTelnetElement(char **sql, char *sqlEnd, char **data, int32_t
} }
static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SSmlLineInfo *elements, SSmlMsgBuf *msg) { static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SSmlLineInfo *elements, SSmlMsgBuf *msg) {
if(is_same_child_table_telnet(elements, &info->preLine, 0) == 0){ if(is_same_child_table_telnet(elements, &info->preLine) == 0){
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }