Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46246346
TDengine
提交
283d144d
TDengine
项目概览
weixin_46246346
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
283d144d
编写于
9月 28, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1530
上级
05687d1e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
124 deletion
+44
-124
src/common/src/ttypes.c
src/common/src/ttypes.c
+16
-45
src/common/src/tvariant.c
src/common/src/tvariant.c
+6
-52
src/inc/taosdef.h
src/inc/taosdef.h
+18
-9
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+4
-18
未找到文件。
src/common/src/ttypes.c
浏览文件 @
283d144d
...
...
@@ -235,15 +235,10 @@ static void getStatics_f(const TSKEY *primaryKey, const void *pData, int32_t num
double
csum
=
0
;
csum
=
GET_DOUBLE_VAL
(
sum
);
csum
+=
dsum
;
#ifdef _TD_ARM_32
SET_DOUBLE_VAL_ALIGN
(
sum
,
&
csum
);
SET_DOUBLE_VAL_ALIGN
(
max
,
&
fmax
);
SET_DOUBLE_VAL_ALIGN
(
min
,
&
fmin
);
#else
*
(
double
*
)
sum
=
csum
;
*
(
double
*
)
max
=
fmax
;
*
(
double
*
)
min
=
fmin
;
#endif
SET_DOUBLE_VAL
(
sum
,
csum
);
SET_DOUBLE_VAL
(
max
,
fmax
);
SET_DOUBLE_VAL
(
min
,
fmin
);
}
static
void
getStatics_d
(
const
TSKEY
*
primaryKey
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
...
...
@@ -281,16 +276,9 @@ static void getStatics_d(const TSKEY *primaryKey, const void *pData, int32_t num
csum
=
GET_DOUBLE_VAL
(
sum
);
csum
+=
dsum
;
#ifdef _TD_ARM_32
SET_DOUBLE_VAL_ALIGN
(
sum
,
&
csum
);
SET_DOUBLE_VAL_ALIGN
(
max
,
&
dmax
);
SET_DOUBLE_VAL_ALIGN
(
min
,
&
dmin
);
#else
*
(
double
*
)
sum
=
csum
;
*
(
double
*
)
max
=
dmax
;
*
(
double
*
)
min
=
dmin
;
#endif
SET_DOUBLE_PTR
(
sum
,
&
csum
);
SET_DOUBLE_PTR
(
max
,
&
dmax
);
SET_DOUBLE_PTR
(
min
,
&
dmin
);
}
static
void
getStatics_bin
(
const
TSKEY
*
primaryKey
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
...
...
@@ -493,46 +481,29 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) {
*
((
int32_t
*
)
val
)
=
GET_INT32_VAL
(
src
);
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
#ifdef _TD_ARM_32
float
fv
=
GET_FLOAT_VAL
(
src
);
SET_FLOAT_VAL_ALIGN
(
val
,
&
fv
);
#else
*
((
float
*
)
val
)
=
GET_FLOAT_VAL
(
src
);
#endif
case
TSDB_DATA_TYPE_FLOAT
:
SET_FLOAT_VAL
(
val
,
GET_FLOAT_VAL
(
src
));
break
;
};
case
TSDB_DATA_TYPE_DOUBLE
:
{
#ifdef _TD_ARM_32
double
dv
=
GET_DOUBLE_VAL
(
src
);
SET_DOUBLE_VAL_ALIGN
(
val
,
&
dv
);
#else
*
((
double
*
)
val
)
=
GET_DOUBLE_VAL
(
src
);
#endif
case
TSDB_DATA_TYPE_DOUBLE
:
SET_DOUBLE_VAL
(
val
,
GET_DOUBLE_VAL
(
src
));
break
;
};
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
{
case
TSDB_DATA_TYPE_BIGINT
:
*
((
int64_t
*
)
val
)
=
GET_INT64_VAL
(
src
);
break
;
};
case
TSDB_DATA_TYPE_SMALLINT
:
{
case
TSDB_DATA_TYPE_SMALLINT
:
*
((
int16_t
*
)
val
)
=
GET_INT16_VAL
(
src
);
break
;
};
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
{
case
TSDB_DATA_TYPE_TINYINT
:
*
((
int8_t
*
)
val
)
=
GET_INT8_VAL
(
src
);
break
;
};
case
TSDB_DATA_TYPE_BINARY
:
{
case
TSDB_DATA_TYPE_BINARY
:
varDataCopy
(
val
,
src
);
break
;
};
case
TSDB_DATA_TYPE_NCHAR
:
{
case
TSDB_DATA_TYPE_NCHAR
:
varDataCopy
(
val
,
src
);
break
;
};
default:
{
memcpy
(
val
,
src
,
len
);
break
;
...
...
src/common/src/tvariant.c
浏览文件 @
283d144d
...
...
@@ -709,46 +709,21 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu
return
-
1
;
}
#ifdef _TD_ARM_32
//memcpy(&payload, &value, sizeof(float));
float
fv
=
(
float
)
value
;
SET_FLOAT_VAL_ALIGN
(
payload
,
&
fv
);
#else
*
((
float
*
)
payload
)
=
(
float
)
value
;
#endif
SET_FLOAT_VAL
(
payload
,
value
);
}
}
else
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_BOOL
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
#ifdef _TD_ARM_32
//memcpy(&payload, &pVariant->i64Key, sizeof(float));
float
fv
=
(
float
)
pVariant
->
i64Key
;
SET_FLOAT_VAL_ALIGN
(
payload
,
&
fv
);
#else
*
((
float
*
)
payload
)
=
(
float
)
pVariant
->
i64Key
;
#endif
SET_FLOAT_VAL
(
payload
,
pVariant
->
i64Key
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
||
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
#ifdef _TD_ARM_32
//memcpy(&payload, &pVariant->dKey, sizeof(float));
float
fv
=
(
float
)
pVariant
->
dKey
;
SET_FLOAT_VAL_ALIGN
(
payload
,
&
fv
);
#else
*
((
float
*
)
payload
)
=
(
float
)
pVariant
->
dKey
;
#endif
SET_FLOAT_VAL
(
payload
,
pVariant
->
dKey
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
*
((
int32_t
*
)
payload
)
=
TSDB_DATA_FLOAT_NULL
;
return
0
;
}
#ifdef _TD_ARM_32
float
fv
=
GET_FLOAT_VAL
(
payload
);
if
(
isinf
(
fv
)
||
isnan
(
fv
)
||
fv
>
FLT_MAX
||
fv
<
-
FLT_MAX
)
{
return
-
1
;
}
#else
if
(
isinf
(
*
((
float
*
)
payload
))
||
isnan
(
*
((
float
*
)
payload
))
||
*
((
float
*
)
payload
)
>
FLT_MAX
||
*
((
float
*
)
payload
)
<
-
FLT_MAX
)
{
return
-
1
;
}
#endif
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
...
...
@@ -765,42 +740,21 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu
return
-
1
;
}
#ifdef _TD_ARM_32
SET_DOUBLE_VAL_ALIGN
(
payload
,
&
value
);
#else
*
((
double
*
)
payload
)
=
value
;
#endif
SET_DOUBLE_VAL
(
payload
,
value
);
}
}
else
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_BOOL
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
#ifdef _TD_ARM_32
double
dv
=
(
double
)(
pVariant
->
i64Key
);
SET_DOUBLE_VAL_ALIGN
(
payload
,
&
dv
);
#else
*
((
double
*
)
payload
)
=
(
double
)
pVariant
->
i64Key
;
#endif
SET_DOUBLE_VAL
(
payload
,
pVariant
->
i64Key
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
||
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
#ifdef _TD_ARM_32
double
dv
=
(
double
)(
pVariant
->
dKey
);
SET_DOUBLE_VAL_ALIGN
(
payload
,
&
dv
);
#else
*
((
double
*
)
payload
)
=
pVariant
->
dKey
;
#endif
SET_DOUBLE_VAL
(
payload
,
pVariant
->
dKey
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
*
((
int64_t
*
)
payload
)
=
TSDB_DATA_DOUBLE_NULL
;
return
0
;
}
#ifdef _TD_ARM_32
double
dv
=
GET_DOUBLE_VAL
(
payload
);
if
(
isinf
(
dv
)
||
isnan
(
dv
)
||
dv
>
DBL_MAX
||
dv
<
-
DBL_MAX
)
{
return
-
1
;
}
#else
if
(
isinf
(
*
((
double
*
)
payload
))
||
isnan
(
*
((
double
*
)
payload
))
||
*
((
double
*
)
payload
)
>
DBL_MAX
||
*
((
double
*
)
payload
)
<
-
DBL_MAX
)
{
return
-
1
;
}
#endif
break
;
}
...
...
src/inc/taosdef.h
浏览文件 @
283d144d
...
...
@@ -132,21 +132,30 @@ do { \
#define GET_INT32_VAL(x) (*(int32_t *)(x))
#define GET_INT64_VAL(x) (*(int64_t *)(x))
#ifdef _TD_ARM_32
#define GET_FLOAT_VAL(x) taos_align_get_float(x)
#define GET_DOUBLE_VAL(x) taos_align_get_double(x)
float
taos_align_get_float
(
const
char
*
pBuf
);
double
taos_align_get_double
(
const
char
*
pBuf
);
//#define __float_align_declear() float __underlyFloat = 0.0;
//#define __float_align_declear()
//#define GET_FLOAT_VAL_ALIGN(x) (*(int32_t*)&(__underlyFloat) = *(int32_t*)(x); __underlyFloat);
// notes: src must be float or double type variable !!!
#define SET_FLOAT_VAL_ALIGN(dst, src) (*(int32_t*) dst = *(int32_t*)src);
#define SET_DOUBLE_VAL_ALIGN(dst, src) (*(int64_t*) dst = *(int64_t*)src);
//#define SET_FLOAT_VAL_ALIGN(dst, src) (*(int32_t*) dst = *(int32_t*)src);
//#define SET_DOUBLE_VAL_ALIGN(dst, src) (*(int64_t*) dst = *(int64_t*)src);
float
taos_align_get_float
(
const
char
*
pBuf
);
double
taos_align_get_double
(
const
char
*
pBuf
);
#define GET_FLOAT_VAL(x) taos_align_get_float(x)
#define GET_DOUBLE_VAL(x) taos_align_get_double(x)
#define SET_FLOAT_VAL(x, y) { float z = (float)(y); (*(int32_t*) x = *(int32_t*)z); }
#define SET_DOUBLE_VAL(x, y) { double z = (double)(y); (*(int64_t*) x = *(int64_t*)z); }
#define SET_FLOAT_PTR(x, y) { (*(int32_t*) x = *(int32_t*)y); }
#define SET_DOUBLE_PTR(x, y) { (*(int64_t*) x = *(int64_t*)y); }
#else
#define GET_FLOAT_VAL(x) (*(float *)(x))
#define GET_DOUBLE_VAL(x) (*(double *)(x))
#define GET_FLOAT_VAL(x) (*(float *)(x))
#define GET_DOUBLE_VAL(x) (*(double *)(x))
#define SET_FLOAT_VAL(x, y) { (*(float *)(x)) = (float)(y); }
#define SET_DOUBLE_VAL(x, y) { (*(double *)(x)) = (double)(y); }
#define SET_FLOAT_PTR(x, y) { (*(float *)(x)) = (*(float *)(y)); }
#define SET_DOUBLE_PTR(x, y) { (*(double *)(x)) = (*(double *)(y)); }
#endif
typedef
struct
tDataTypeDescriptor
{
...
...
tests/tsim/src/simExe.c
浏览文件 @
283d144d
...
...
@@ -750,25 +750,11 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
case
TSDB_DATA_TYPE_BIGINT
:
sprintf
(
value
,
"%"
PRId64
,
*
((
int64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:{
#ifdef _TD_ARM_32
float
fv
=
0
;
*
(
int32_t
*
)(
&
fv
)
=
*
(
int32_t
*
)
row
[
i
];
sprintf
(
value
,
"%.5f"
,
fv
);
#else
sprintf
(
value
,
"%.5f"
,
*
((
float
*
)
row
[
i
]));
#endif
}
case
TSDB_DATA_TYPE_FLOAT
:
sprintf
(
value
,
"%.5f"
,
GET_FLOAT_VAL
(
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
{
#ifdef _TD_ARM_32
double
dv
=
0
;
*
(
int64_t
*
)(
&
dv
)
=
*
(
int64_t
*
)
row
[
i
];
sprintf
(
value
,
"%.9lf"
,
dv
);
#else
sprintf
(
value
,
"%.9lf"
,
*
((
double
*
)
row
[
i
]));
#endif
}
case
TSDB_DATA_TYPE_DOUBLE
:
sprintf
(
value
,
"%.9lf"
,
GET_DOUBLE_VAL
(
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录