未验证 提交 9ee2b047 编写于 作者: H Haojun Liao 提交者: GitHub

Merge pull request #10523 from taosdata/fix/TS-1285-d

[TS-1285]<fix>: fix alter timestamp tag precision issue
...@@ -7061,6 +7061,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -7061,6 +7061,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char* msg24 = "invalid binary/nchar column length"; const char* msg24 = "invalid binary/nchar column length";
const char* msg25 = "json type error, should be string"; const char* msg25 = "json type error, should be string";
const char* msg26 = "illegal value or data overflow";
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
...@@ -7225,7 +7226,19 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -7225,7 +7226,19 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
if (IS_VAR_DATA_TYPE(pTagsSchema->type) && (pItem->pVar.nLen > pTagsSchema->bytes)) { if (IS_VAR_DATA_TYPE(pTagsSchema->type) && (pItem->pVar.nLen > pTagsSchema->bytes)) {
return invalidOperationMsg(pMsg, msg14); return invalidOperationMsg(pMsg, msg14);
} else if (pTagsSchema->type == TSDB_DATA_TYPE_TIMESTAMP) {
STableComInfo tinfo = tscGetTableInfo(pTableMeta);
if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) {
code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
if (code != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg26);
} }
} else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) {
pItem->pVar.i64 = convertTimePrecision(pItem->pVar.i64, TSDB_TIME_PRECISION_NANO, tinfo.precision);
}
}
SKVRowBuilder kvRowBuilder = {0}; SKVRowBuilder kvRowBuilder = {0};
if (pTagsSchema->type == TSDB_DATA_TYPE_JSON) { if (pTagsSchema->type == TSDB_DATA_TYPE_JSON) {
if (pItem->pVar.nType != TSDB_DATA_TYPE_BINARY && pItem->pVar.nType != TSDB_DATA_TYPE_NULL) { if (pItem->pVar.nType != TSDB_DATA_TYPE_BINARY && pItem->pVar.nType != TSDB_DATA_TYPE_NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册