feat:add paras for schemaless interface
This commit is contained in:
parent
b4f33eacf2
commit
c63a7e3979
|
@ -222,7 +222,7 @@ bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg);
|
||||||
int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, uint8_t toPrecision);
|
int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, uint8_t toPrecision);
|
||||||
SSmlTableInfo* smlBuildTableInfo(int numRows, const char* measure, int32_t measureLen);
|
SSmlTableInfo* smlBuildTableInfo(int numRows, const char* measure, int32_t measureLen);
|
||||||
SSmlSTableMeta* smlBuildSTableMeta(bool isDataFormat);
|
SSmlSTableMeta* smlBuildSTableMeta(bool isDataFormat);
|
||||||
int32_t smlSetCTableName(SSmlTableInfo *oneTable);
|
int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey);
|
||||||
void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tinfo);
|
void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tinfo);
|
||||||
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);
|
int32_t is_same_child_table_telnet(const void *a, const void *b);
|
||||||
|
|
|
@ -349,7 +349,7 @@ int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements){
|
||||||
if (kv->valueEscaped) kv->value = NULL;
|
if (kv->valueEscaped) kv->value = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
smlSetCTableName(tinfo);
|
smlSetCTableName(tinfo, info->tbnameKey);
|
||||||
getTableUid(info, elements, tinfo);
|
getTableUid(info, elements, tinfo);
|
||||||
if (info->dataFormat) {
|
if (info->dataFormat) {
|
||||||
info->currSTableMeta->uid = tinfo->uid;
|
info->currSTableMeta->uid = tinfo->uid;
|
||||||
|
@ -418,10 +418,10 @@ int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs){
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t smlParseTableName(SArray *tags, char *childTableName) {
|
static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnameKey) {
|
||||||
bool autoChildName = false;
|
bool autoChildName = false;
|
||||||
size_t delimiter = strlen(tsSmlAutoChildTableNameDelimiter);
|
size_t delimiter = strlen(tsSmlAutoChildTableNameDelimiter);
|
||||||
if(delimiter > 0){
|
if(delimiter > 0 && tbnameKey == NULL){
|
||||||
size_t totalNameLen = delimiter * (taosArrayGetSize(tags) - 1);
|
size_t totalNameLen = delimiter * (taosArrayGetSize(tags) - 1);
|
||||||
for (int i = 0; i < taosArrayGetSize(tags); i++) {
|
for (int i = 0; i < taosArrayGetSize(tags); i++) {
|
||||||
SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i);
|
SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i);
|
||||||
|
@ -444,13 +444,16 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName) {
|
||||||
smlStrReplace(childTableName, strlen(childTableName));
|
smlStrReplace(childTableName, strlen(childTableName));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
size_t childTableNameLen = strlen(tsSmlChildTableName);
|
if (tbnameKey == NULL){
|
||||||
|
tbnameKey = tsSmlChildTableName;
|
||||||
|
}
|
||||||
|
size_t childTableNameLen = strlen(tbnameKey);
|
||||||
if (childTableNameLen <= 0) return TSDB_CODE_SUCCESS;
|
if (childTableNameLen <= 0) return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
for (int i = 0; i < taosArrayGetSize(tags); i++) {
|
for (int i = 0; i < taosArrayGetSize(tags); i++) {
|
||||||
SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i);
|
SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i);
|
||||||
// handle child table name
|
// handle child table name
|
||||||
if (childTableNameLen == tag->keyLen && strncmp(tag->key, tsSmlChildTableName, tag->keyLen) == 0) {
|
if (childTableNameLen == tag->keyLen && strncmp(tag->key, tbnameKey, tag->keyLen) == 0) {
|
||||||
memset(childTableName, 0, TSDB_TABLE_NAME_LEN);
|
memset(childTableName, 0, TSDB_TABLE_NAME_LEN);
|
||||||
strncpy(childTableName, tag->value, (tag->length < TSDB_TABLE_NAME_LEN ? tag->length : TSDB_TABLE_NAME_LEN));
|
strncpy(childTableName, tag->value, (tag->length < TSDB_TABLE_NAME_LEN ? tag->length : TSDB_TABLE_NAME_LEN));
|
||||||
if(tsSmlDot2Underline){
|
if(tsSmlDot2Underline){
|
||||||
|
@ -465,8 +468,8 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smlSetCTableName(SSmlTableInfo *oneTable) {
|
int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey) {
|
||||||
smlParseTableName(oneTable->tags, oneTable->childTableName);
|
smlParseTableName(oneTable->tags, oneTable->childTableName, tbnameKey);
|
||||||
|
|
||||||
if (strlen(oneTable->childTableName) == 0) {
|
if (strlen(oneTable->childTableName) == 0) {
|
||||||
SArray *dst = taosArrayDup(oneTable->tags, NULL);
|
SArray *dst = taosArrayDup(oneTable->tags, NULL);
|
||||||
|
|
Loading…
Reference in New Issue