提交 ca6a7ba3 编写于 作者: L lihui

[TBASE-816]

上级 3e1f3df3
...@@ -466,11 +466,17 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn ...@@ -466,11 +466,17 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_BIGINT:
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetLongFp, i, (jlong) * ((int64_t *)row[i])); (*env)->CallVoidMethod(env, rowobj, g_rowdataSetLongFp, i, (jlong) * ((int64_t *)row[i]));
break; break;
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT: {
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetFloatFp, i, (jfloat) * ((float *)row[i])); float fv = 0;
fv = GET_FLOAT_VAL(row[i]);
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetFloatFp, i, (jfloat)fv);
}
break; break;
case TSDB_DATA_TYPE_DOUBLE: case TSDB_DATA_TYPE_DOUBLE: {
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble) * ((double *)row[i])); double dv = 0;
dv = GET_DOUBLE_VAL(row[i]);
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble)dv);
}
break; break;
case TSDB_DATA_TYPE_BINARY: { case TSDB_DATA_TYPE_BINARY: {
strncpy(tmp, row[i], (size_t) fields[i].bytes); // handle the case that terminated does not exist strncpy(tmp, row[i], (size_t) fields[i].bytes); // handle the case that terminated does not exist
...@@ -615,11 +621,17 @@ JNIEXPORT jobject JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp(JNI ...@@ -615,11 +621,17 @@ JNIEXPORT jobject JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp(JNI
case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_BIGINT:
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetLongFp, i, (jlong) * ((int64_t *)row[i])); (*env)->CallVoidMethod(env, rowobj, g_rowdataSetLongFp, i, (jlong) * ((int64_t *)row[i]));
break; break;
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT: {
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetFloatFp, i, (jfloat) * ((float *)row[i])); float fv = 0;
fv = GET_FLOAT_VAL(row[i]);
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetFloatFp, i, (jfloat)fv);
}
break; break;
case TSDB_DATA_TYPE_DOUBLE: case TSDB_DATA_TYPE_DOUBLE:{
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble) * ((double *)row[i])); double dv = 0;
dv = GET_DOUBLE_VAL(row[i]);
(*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble)dv);
}
break; break;
case TSDB_DATA_TYPE_BINARY: { case TSDB_DATA_TYPE_BINARY: {
strncpy(tmp, row[i], (size_t) fields[i].bytes); // handle the case that terminated does not exist strncpy(tmp, row[i], (size_t) fields[i].bytes); // handle the case that terminated does not exist
......
...@@ -39,25 +39,17 @@ static int32_t getToStringLength(const char *pData, int32_t length, int32_t type ...@@ -39,25 +39,17 @@ static int32_t getToStringLength(const char *pData, int32_t length, int32_t type
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
return length; return length;
case TSDB_DATA_TYPE_DOUBLE: { case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0; double dv = 0;
*(int64_t *)(&dv) = *(int64_t *)pData; dv = GET_DOUBLE_VAL(pData);
len = sprintf(buf, "%f", dv); len = sprintf(buf, "%lf", dv);
#else
len = sprintf(buf, "%lf", *(double *)pData);
#endif
if (strncasecmp("nan", buf, 3) == 0) { if (strncasecmp("nan", buf, 3) == 0) {
len = 4; len = 4;
} }
} break; } break;
case TSDB_DATA_TYPE_FLOAT: { case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0; float fv = 0;
*(int32_t *)(&fv) = *(int32_t *)pData; fv = GET_FLOAT_VAL(pData);
len = sprintf(buf, "%f", fv); len = sprintf(buf, "%f", fv);
#else
len = sprintf(buf, "%f", *(float *)pData);
#endif
if (strncasecmp("nan", buf, 3) == 0) { if (strncasecmp("nan", buf, 3) == 0) {
len = 4; len = 4;
} }
...@@ -201,22 +193,14 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { ...@@ -201,22 +193,14 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
taosUcs4ToMbs(pTagValue, pSchema[i].bytes, target); taosUcs4ToMbs(pTagValue, pSchema[i].bytes, target);
break; break;
case TSDB_DATA_TYPE_FLOAT: { case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0; float fv = 0;
*(int32_t *)(&fv) = *(int32_t *)pTagValue; fv = GET_FLOAT_VAL(pTagValue);
sprintf(target, "%f", fv); sprintf(target, "%f", fv);
#else
sprintf(target, "%f", *(float *)pTagValue);
#endif
} break; } break;
case TSDB_DATA_TYPE_DOUBLE: { case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0; double dv = 0;
*(int64_t *)(&dv) = *(int64_t *)pTagValue; dv = GET_DOUBLE_VAL(pTagValue);
sprintf(target, "%lf", dv); sprintf(target, "%lf", dv);
#else
sprintf(target, "%lf", *(double *)pTagValue);
#endif
} break; } break;
case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_TINYINT:
sprintf(target, "%d", *(int8_t *)pTagValue); sprintf(target, "%d", *(int8_t *)pTagValue);
......
...@@ -121,11 +121,11 @@ static int normalStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) { ...@@ -121,11 +121,11 @@ static int normalStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) {
break; break;
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT:
var->dKey = *(float*)tb->buffer; var->dKey = GET_FLOAT_VAL(tb->buffer);
break; break;
case TSDB_DATA_TYPE_DOUBLE: case TSDB_DATA_TYPE_DOUBLE:
var->dKey = *(double*)tb->buffer; var->dKey = GET_DOUBLE_VAL(tb->buffer);
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
......
...@@ -2165,7 +2165,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, int32_t colIdx, tSQLExprItem* pItem ...@@ -2165,7 +2165,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, int32_t colIdx, tSQLExprItem* pItem
if (optr == TK_PERCENTILE || optr == TK_APERCENTILE) { if (optr == TK_PERCENTILE || optr == TK_APERCENTILE) {
tVariantDump(pVariant, val, TSDB_DATA_TYPE_DOUBLE); tVariantDump(pVariant, val, TSDB_DATA_TYPE_DOUBLE);
double dp = *((double*)val); double dp = GET_DOUBLE_VAL(val);
if (dp < 0 || dp > TOP_BOTTOM_QUERY_LIMIT) { if (dp < 0 || dp > TOP_BOTTOM_QUERY_LIMIT) {
return invalidSqlErrMsg(pCmd, msg5); return invalidSqlErrMsg(pCmd, msg5);
} }
......
...@@ -887,12 +887,18 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) ...@@ -887,12 +887,18 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
len += sprintf(str + len, "%" PRId64 " ", *((int64_t *)row[i])); len += sprintf(str + len, "%" PRId64 " ", *((int64_t *)row[i]));
break; break;
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT: {
len += sprintf(str + len, "%f ", *((float *)row[i])); float fv = 0;
fv = GET_FLOAT_VAL(row[i])
len += sprintf(str + len, "%f ", fv);
}
break; break;
case TSDB_DATA_TYPE_DOUBLE: case TSDB_DATA_TYPE_DOUBLE:{
len += sprintf(str + len, "%lf ", *((double *)row[i])); double dv = 0;
dv = GET_DOUBLE_VAL(row[i])
len += sprintf(str + len, "%lf ", dv);
}
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
......
...@@ -457,25 +457,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) { ...@@ -457,25 +457,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
printf("%*" PRId64 "|", l[i], *((int64_t *)row[i])); printf("%*" PRId64 "|", l[i], *((int64_t *)row[i]));
break; break;
case TSDB_DATA_TYPE_FLOAT: { case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0; float fv = 0;
//memcpy(&fv, row[i], sizeof(float)); fv = GET_FLOAT_VAL(row[i]);
*(int32_t*)(&fv) = *(int32_t*)row[i];
printf("%*.5f|", l[i], fv); printf("%*.5f|", l[i], fv);
#else
printf("%*.5f|", l[i], *((float *)row[i]));
#endif
} }
break; break;
case TSDB_DATA_TYPE_DOUBLE: { case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0; double dv = 0;
//memcpy(&dv, row[i], sizeof(double)); dv = GET_DOUBLE_VAL(row[i]);
*(int64_t*)(&dv) = *(int64_t*)row[i];
printf("%*.9f|", l[i], dv); printf("%*.9f|", l[i], dv);
#else
printf("%*.9f|", l[i], *((double *)row[i]));
#endif
} }
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
...@@ -542,25 +532,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) { ...@@ -542,25 +532,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
printf("%" PRId64 "\n", *((int64_t *)row[i])); printf("%" PRId64 "\n", *((int64_t *)row[i]));
break; break;
case TSDB_DATA_TYPE_FLOAT: { case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0; float fv = 0;
//memcpy(&fv, row[i], sizeof(float)); fv = GET_FLOAT_VAL(row[i]);
*(int32_t*)(&fv) = *(int32_t*)row[i];
printf("%.5f\n", fv); printf("%.5f\n", fv);
#else
printf("%.5f\n", *((float *)row[i]));
#endif
} }
break; break;
case TSDB_DATA_TYPE_DOUBLE: { case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0; double dv = 0;
//memcpy(&dv, row[i], sizeof(double)); dv = GET_DOUBLE_VAL(row[i]);
*(int64_t*)(&dv) = *(int64_t*)row[i];
printf("%.9f\n", dv); printf("%.9f\n", dv);
#else
printf("%.9f\n", *((double *)row[i]));
#endif
} }
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
...@@ -630,25 +610,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) { ...@@ -630,25 +610,15 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
fprintf(fp, "%" PRId64, *((int64_t *)row[i])); fprintf(fp, "%" PRId64, *((int64_t *)row[i]));
break; break;
case TSDB_DATA_TYPE_FLOAT: { case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0; float fv = 0;
//memcpy(&fv, row[i], sizeof(float)); fv = GET_FLOAT_VAL(row[i]);
*(int32_t*)(&fv) = *(int32_t*)row[i];
fprintf(fp, "%.5f", fv); fprintf(fp, "%.5f", fv);
#else
fprintf(fp, "%.5f", *((float *)row[i]));
#endif
} }
break; break;
case TSDB_DATA_TYPE_DOUBLE: { case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0; double dv = 0;
//memcpy(&dv, row[i], sizeof(double)); dv = GET_DOUBLE_VAL(row[i]);
*(int64_t*)(&dv) = *(int64_t*)row[i];
fprintf(fp, "%.9f", dv); fprintf(fp, "%.9f", dv);
#else
fprintf(fp, "%.9f", *((double *)row[i]));
#endif
} }
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册