提交 e30cdd03 编写于 作者: A Alex Duan

fix:uniform output csv format with shell output1

上级 94d056e6
...@@ -360,13 +360,13 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i ...@@ -360,13 +360,13 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT:
int32_t width = SHELL_FLOAT_WIDTH; int32_t width = SHELL_FLOAT_WIDTH;
if (tsEnableScience) { if (tsEnableScience) {
printf("%*e", width, GET_FLOAT_VAL(val)); taosFprintfFile(pFile, "%*e", width, GET_FLOAT_VAL(val));
} else { } else {
n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.5f", width, GET_FLOAT_VAL(val)); n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.5f", width, GET_FLOAT_VAL(val));
if (n > SHELL_FLOAT_WIDTH) { if (n > SHELL_FLOAT_WIDTH) {
printf("%*e", width, GET_FLOAT_VAL(val)); taosFprintfFile(pFile, "%*e", width, GET_FLOAT_VAL(val));
} else { } else {
printf("%s", buf); taosFprintfFile(pFile, "%s", buf);
} }
} }
break; break;
...@@ -378,9 +378,9 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i ...@@ -378,9 +378,9 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i
} else { } else {
n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.9f", width, GET_DOUBLE_VAL(val)); n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.9f", width, GET_DOUBLE_VAL(val));
if (n > SHELL_DOUBLE_WIDTH) { if (n > SHELL_DOUBLE_WIDTH) {
taosFprintfFile(pFile, "%*.15e", width, GET_DOUBLE_VAL(val)); taosFprintfFile(pFile, "%*.15e", width, GET_DOUBLE_VAL(val));
} else { } else {
taosFprintfFile(pFile, "%s", buf); taosFprintfFile(pFile, "%s", buf);
} }
} }
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册