提交 32f8dca8 编写于 作者: L lihui

[TBASE-1490]

上级 78587430
......@@ -212,7 +212,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
tscTrace("%p load data from disk into memory, orderOfVnode:%d, total:%d", pSqlObjAddr, i + 1, idx + 1);
tExtMemBufferLoadData(pMemBuffer[i], &(pDS->filePage), j, 0);
#ifdef _DEBUG_VIEW
printf("load data page into mem for build loser tree: %ld rows\n", pDS->filePage.numOfElems);
printf("load data page into mem for build loser tree: %" PRIu64 " rows\n", pDS->filePage.numOfElems);
SSrcColumnInfo colInfo[256] = {0};
tscGetSrcColumnInfo(colInfo, pCmd);
......@@ -342,7 +342,7 @@ static int32_t tscFlushTmpBufferImpl(tExtMemBuffer *pMemoryBuf, tOrderDescriptor
}
#ifdef _DEBUG_VIEW
printf("%ld rows data flushed to disk after been sorted:\n", pPage->numOfElems);
printf("%" PRIu64 " rows data flushed to disk after been sorted:\n", pPage->numOfElems);
tColModelDisplay(pDesc->pSchema, pPage->data, pPage->numOfElems, pPage->numOfElems);
#endif
......
......@@ -1165,7 +1165,7 @@ void tscRetrieveFromVnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) {
tColModelCompact(pDesc->pSchema, trsupport->localBuffer, pDesc->pSchema->maxCapacity);
#ifdef _DEBUG_VIEW
printf("%ld rows data flushed to disk:\n", trsupport->localBuffer->numOfElems);
printf("%" PRIu64 " rows data flushed to disk:\n", trsupport->localBuffer->numOfElems);
SSrcColumnInfo colInfo[256] = {0};
tscGetSrcColumnInfo(colInfo, &pPObj->cmd);
tColModelDisplayEx(pDesc->pSchema, trsupport->localBuffer->data, trsupport->localBuffer->numOfElems,
......
......@@ -17,6 +17,7 @@
#include <argp.h>
#include <assert.h>
#include <inttypes.h>
#ifndef _ALPINE
#include <error.h>
......@@ -575,7 +576,7 @@ void *readTable(void *sarg) {
double totalT = 0;
int count = 0;
for (int i = 0; i < num_of_tables; i++) {
sprintf(command, "select %s from %s%d where ts>= %ld", aggreFunc[j], tb_prefix, i, sTime);
sprintf(command, "select %s from %s%d where ts>= %" PRId64, aggreFunc[j], tb_prefix, i, sTime);
double t = getCurrentTime();
if (taos_query(taos, command) != 0) {
......@@ -818,7 +819,7 @@ double getCurrentTime() {
void generateData(char *res, char **data_type, int num_of_cols, int64_t timestamp, int len_of_binary) {
memset(res, 0, MAX_DATA_SIZE);
char *pstr = res;
pstr += sprintf(pstr, "(%ld", timestamp);
pstr += sprintf(pstr, "(%" PRId64, timestamp);
int c = 0;
for (; c < MAX_NUM_DATATYPE; c++) {
......@@ -835,7 +836,7 @@ void generateData(char *res, char **data_type, int num_of_cols, int64_t timestam
} else if (strcasecmp(data_type[i % c], "int") == 0) {
pstr += sprintf(pstr, ", %d", (int)(rand() % 10));
} else if (strcasecmp(data_type[i % c], "bigint") == 0) {
pstr += sprintf(pstr, ", %ld", rand() % 2147483648);
pstr += sprintf(pstr, ", %" PRId64, rand() % 2147483648);
} else if (strcasecmp(data_type[i % c], "float") == 0) {
pstr += sprintf(pstr, ", %10.4f", (float)(rand() / 1000));
} else if (strcasecmp(data_type[i % c], "double") == 0) {
......
......@@ -879,7 +879,7 @@ int taosDumpTableData(FILE *fp, char *tbname, struct arguments *arguments) {
if (arguments->schemaonly) return 0;
sprintf(command, "select * from %s where _c0 >= %ld and _c0 <= %ld order by _c0 asc", tbname, arguments->start_time,
sprintf(command, "select * from %s where _c0 >= %" PRId64 " and _c0 <= %" PRId64 " order by _c0 asc", tbname, arguments->start_time,
arguments->end_time);
if (taos_query(taos, command) != 0) {
fprintf(stderr, "failed to run command %s, reason: %s\n", command, taos_errstr(taos));
......@@ -933,13 +933,13 @@ int taosDumpTableData(FILE *fp, char *tbname, struct arguments *arguments) {
pstr += sprintf(pstr, "%d", *((int *)row[col]));
break;
case TSDB_DATA_TYPE_BIGINT:
pstr += sprintf(pstr, "%ld", *((int64_t *)row[col]));
pstr += sprintf(pstr, "%" PRId64 "", *((int64_t *)row[col]));
break;
case TSDB_DATA_TYPE_FLOAT:
pstr += sprintf(pstr, "%f", *((float *)row[col]));
pstr += sprintf(pstr, "%f", GET_FLOAT_VAL(row[col]));
break;
case TSDB_DATA_TYPE_DOUBLE:
pstr += sprintf(pstr, "%f", *((double *)row[col]));
pstr += sprintf(pstr, "%f", GET_DOUBLE_VAL(row[col]));
break;
case TSDB_DATA_TYPE_BINARY:
*(pstr++) = '\'';
......@@ -952,7 +952,7 @@ int taosDumpTableData(FILE *fp, char *tbname, struct arguments *arguments) {
pstr += sprintf(pstr, "\'%s\'", tbuf);
break;
case TSDB_DATA_TYPE_TIMESTAMP:
pstr += sprintf(pstr, "%ld", *(int64_t *)row[col]);
pstr += sprintf(pstr, "%" PRId64 "", *(int64_t *)row[col]);
break;
default:
break;
......@@ -1134,7 +1134,7 @@ int taosDumpIn(struct arguments *arguments) {
}
taosReplaceCtrlChar(tcommand);
if (taos_query(taos, tcommand) != 0)
fprintf(stderr, "linenu: %ld failed to run command %s reason:%s \ncontinue...\n", linenu, command,
fprintf(stderr, "linenu: %" PRId64 " failed to run command %s reason:%s \ncontinue...\n", linenu, command,
taos_errstr(taos));
pstr = command;
......@@ -1182,7 +1182,7 @@ int taosDumpIn(struct arguments *arguments) {
}
taosReplaceCtrlChar(tcommand);
if (taos_query(taos, tcommand) != 0)
fprintf(stderr, "linenu:%ld failed to run command %s reason: %s \ncontinue...\n", linenu, command,
fprintf(stderr, "linenu:%" PRId64 " failed to run command %s reason: %s \ncontinue...\n", linenu, command,
taos_errstr(taos));
}
......@@ -1205,7 +1205,7 @@ int taosDumpIn(struct arguments *arguments) {
}
taosReplaceCtrlChar(lcommand);
if (taos_query(taos, tcommand) != 0)
fprintf(stderr, "linenu:%ld failed to run command %s reason:%s \ncontinue...\n", linenu, command,
fprintf(stderr, "linenu:%" PRId64 " failed to run command %s reason:%s \ncontinue...\n", linenu, command,
taos_errstr(taos));
}
......
......@@ -257,7 +257,7 @@ void httpJsonStringForTransMean(JsonBuf* buf, char* sVal, int maxLen) {
void httpJsonInt64(JsonBuf* buf, int64_t num) {
httpJsonItemToken(buf);
httpJsonTestBuf(buf, MAX_NUM_STR_SZ);
buf->lst += snprintf(buf->lst, MAX_NUM_STR_SZ, "%ld", num);
buf->lst += snprintf(buf->lst, MAX_NUM_STR_SZ, "%" PRId64, num);
}
void httpJsonTimestamp(JsonBuf* buf, int64_t t, bool us) {
......
......@@ -67,10 +67,7 @@ bool restProcessSqlRequest(HttpContext* pContext, int timestampFmt) {
return false;
}
/*
* for async test
* /
// for async test
/*
if (httpCheckUsedbSql(sql)) {
httpSendErrorResp(pContext, HTTP_NO_EXEC_USEDB);
......
......@@ -572,7 +572,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
orderTagsLen = orderTagsLen < TSDB_MAX_TAGS ? orderTagsLen : TSDB_MAX_TAGS;
table_cmd->tagNum = stable_cmd->tagNum = (int8_t)orderTagsLen;
table_cmd->timestamp = stable_cmd->timestamp = httpAddToSqlCmdBuffer(pContext, "%ld", timestamp->valueint);
table_cmd->timestamp = stable_cmd->timestamp = httpAddToSqlCmdBuffer(pContext, "%" PRId64, timestamp->valueint);
// stable name
char *stname = tgGetStableName(name->valuestring, fields, fieldsSize);
......@@ -593,7 +593,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
if (tag->type == cJSON_String)
stable_cmd->tagValues[i] = table_cmd->tagValues[i] = httpAddToSqlCmdBuffer(pContext, "'%s'", tag->valuestring);
else if (tag->type == cJSON_Number)
stable_cmd->tagValues[i] = table_cmd->tagValues[i] = httpAddToSqlCmdBuffer(pContext, "%ld", tag->valueint);
stable_cmd->tagValues[i] = table_cmd->tagValues[i] = httpAddToSqlCmdBuffer(pContext, "%" PRId64, tag->valueint);
else if (tag->type == cJSON_True)
stable_cmd->tagValues[i] = table_cmd->tagValues[i] = httpAddToSqlCmdBuffer(pContext, "1");
else if (tag->type == cJSON_False)
......@@ -614,7 +614,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
if (tag->type == cJSON_String)
httpAddToSqlCmdBufferNoTerminal(pContext, "_%s", tag->valuestring);
else if (tag->type == cJSON_Number)
httpAddToSqlCmdBufferNoTerminal(pContext, "_%ld", tag->valueint);
httpAddToSqlCmdBufferNoTerminal(pContext, "_%" PRId64, tag->valueint);
else if (tag->type == cJSON_False)
httpAddToSqlCmdBufferNoTerminal(pContext, "_0");
else if (tag->type == cJSON_True)
......@@ -670,7 +670,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
cJSON *tag = orderedTags[i];
if (i != orderTagsLen - 1) {
if (tag->type == cJSON_Number)
httpAddToSqlCmdBufferNoTerminal(pContext, "%ld,", tag->valueint);
httpAddToSqlCmdBufferNoTerminal(pContext, "%" PRId64 ",", tag->valueint);
else if (tag->type == cJSON_String)
httpAddToSqlCmdBufferNoTerminal(pContext, "'%s',", tag->valuestring);
else if (tag->type == cJSON_False)
......@@ -682,7 +682,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
}
} else {
if (tag->type == cJSON_Number)
httpAddToSqlCmdBufferNoTerminal(pContext, "%ld)", tag->valueint);
httpAddToSqlCmdBufferNoTerminal(pContext, "%" PRId64 ")", tag->valueint);
else if (tag->type == cJSON_String)
httpAddToSqlCmdBufferNoTerminal(pContext, "'%s')", tag->valuestring);
else if (tag->type == cJSON_False)
......@@ -695,7 +695,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
}
}
httpAddToSqlCmdBufferNoTerminal(pContext, " values(%ld,", timestamp->valueint);
httpAddToSqlCmdBufferNoTerminal(pContext, " values(%" PRId64 ",", timestamp->valueint);
for (int i = 0; i < fieldsSize; ++i) {
cJSON *field = cJSON_GetArrayItem(fields, i);
if (i != fieldsSize - 1) {
......
......@@ -465,8 +465,11 @@ int mgmtCfgDynamicOptions(SDnodeObj *pDnode, char *msg) {
}
int mgmtSendCfgDnodeMsg(char *cont) {
#ifdef CLUSTER
char * pMsg, *pStart;
int msgLen = 0;
#endif
SDnodeObj *pDnode;
SCfgMsg * pCfg = (SCfgMsg *)cont;
uint32_t ip;
......
......@@ -4605,27 +4605,27 @@ static void printBinaryData(int32_t functionId, char *data, int32_t srcDataType)
if (functionId == TSDB_FUNC_FIRST_DST || functionId == TSDB_FUNC_LAST_DST) {
switch (srcDataType) {
case TSDB_DATA_TYPE_BINARY:
printf("%ld,%s\t", *(TSKEY *)data, (data + TSDB_KEYSIZE + 1));
printf("%" PRId64 ",%s\t", *(TSKEY *)data, (data + TSDB_KEYSIZE + 1));
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_BOOL:
printf("%ld,%d\t", *(TSKEY *)data, *(int8_t *)(data + TSDB_KEYSIZE + 1));
printf("%" PRId64 ",%d\t", *(TSKEY *)data, *(int8_t *)(data + TSDB_KEYSIZE + 1));
break;
case TSDB_DATA_TYPE_SMALLINT:
printf("%ld,%d\t", *(TSKEY *)data, *(int16_t *)(data + TSDB_KEYSIZE + 1));
printf("%" PRId64 ",%d\t", *(TSKEY *)data, *(int16_t *)(data + TSDB_KEYSIZE + 1));
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_TIMESTAMP:
printf("%ld,%ld\t", *(TSKEY *)data, *(TSKEY *)(data + TSDB_KEYSIZE + 1));
printf("%" PRId64 ",%" PRId64 "\t", *(TSKEY *)data, *(TSKEY *)(data + TSDB_KEYSIZE + 1));
break;
case TSDB_DATA_TYPE_INT:
printf("%ld,%d\t", *(TSKEY *)data, *(int32_t *)(data + TSDB_KEYSIZE + 1));
printf("%" PRId64 ",%d\t", *(TSKEY *)data, *(int32_t *)(data + TSDB_KEYSIZE + 1));
break;
case TSDB_DATA_TYPE_FLOAT:
printf("%ld,%f\t", *(TSKEY *)data, *(float *)(data + TSDB_KEYSIZE + 1));
printf("%" PRId64 ",%f\t", *(TSKEY *)data, *(float *)(data + TSDB_KEYSIZE + 1));
break;
case TSDB_DATA_TYPE_DOUBLE:
printf("%ld,%lf\t", *(TSKEY *)data, *(double *)(data + TSDB_KEYSIZE + 1));
printf("%" PRId64 ",%lf\t", *(TSKEY *)data, *(double *)(data + TSDB_KEYSIZE + 1));
break;
}
} else if (functionId == TSDB_FUNC_AVG) {
......@@ -4634,7 +4634,7 @@ static void printBinaryData(int32_t functionId, char *data, int32_t srcDataType)
printf("%lf,%lf\t", *(double *)data, *(double *)(data + sizeof(double)));
} else if (functionId == TSDB_FUNC_TWA) {
data += 1;
printf("%lf,%ld,%ld,%ld\t", *(double *)data, *(int64_t *)(data + 8), *(int64_t *)(data + 16),
printf("%lf,%" PRId64 ",%" PRId64 ",%" PRId64 "\t", *(double *)data, *(int64_t *)(data + 8), *(int64_t *)(data + 16),
*(int64_t *)(data + 24));
} else if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) {
switch (srcDataType) {
......@@ -4647,7 +4647,7 @@ static void printBinaryData(int32_t functionId, char *data, int32_t srcDataType)
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_TIMESTAMP:
printf("%ld\t", *(int64_t *)data);
printf("%" PRId64 "\t", *(int64_t *)data);
break;
case TSDB_DATA_TYPE_INT:
printf("%d\t", *(int *)data);
......@@ -4663,7 +4663,7 @@ static void printBinaryData(int32_t functionId, char *data, int32_t srcDataType)
if (srcDataType == TSDB_DATA_TYPE_FLOAT || srcDataType == TSDB_DATA_TYPE_DOUBLE) {
printf("%lf\t", *(float *)data);
} else {
printf("%ld\t", *(int64_t *)data);
printf("%" PRId64 "\t", *(int64_t *)data);
}
} else {
printf("%s\t", data);
......@@ -4695,7 +4695,7 @@ void UNUSED_FUNC displayInterResult(SData **pdata, SQuery *pQuery, int32_t numOf
}
case TSDB_DATA_TYPE_TIMESTAMP:
case TSDB_DATA_TYPE_BIGINT:
printf("%ld\t", *(int64_t *)(pdata[i]->data + pQuery->pSelectExpr[i].resBytes * j));
printf("%" PRId64 "\t", *(int64_t *)(pdata[i]->data + pQuery->pSelectExpr[i].resBytes * j));
break;
case TSDB_DATA_TYPE_INT:
printf("%d\t", *(int32_t *)(pdata[i]->data + pQuery->pSelectExpr[i].resBytes * j));
......
......@@ -323,7 +323,7 @@ void tTagsPrints(SMeterSidExtInfo *pMeterInfo, tTagSchema *pSchema, tOrderIdx *p
printf("%f, ", GET_TAG_VAL(pMeterInfo, colIndex, pSchema, float));
break;
case TSDB_DATA_TYPE_BIGINT:
printf("%ld, ", GET_TAG_VAL(pMeterInfo, colIndex, pSchema, int64_t));
printf("%" PRId64 ", ", GET_TAG_VAL(pMeterInfo, colIndex, pSchema, int64_t));
break;
case TSDB_DATA_TYPE_SMALLINT:
printf("%d, ", GET_TAG_VAL(pMeterInfo, colIndex, pSchema, int16_t));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册