Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
a4b7ba95
T
TDengine
项目概览
小楼昨夜-听风雨
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a4b7ba95
编写于
9月 29, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
9月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3716 from taosdata/feature/os
Feature/os
上级
7bd9338e
4d554b67
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
101 addition
and
172 deletion
+101
-172
cmake/define.inc
cmake/define.inc
+3
-0
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+3
-3
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+4
-4
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+2
-3
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-3
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-2
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
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+8
-8
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+5
-5
src/plugins/http/src/httpGcJson.c
src/plugins/http/src/httpGcJson.c
+4
-4
src/plugins/http/src/httpRestJson.c
src/plugins/http/src/httpRestJson.c
+2
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+6
-6
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+2
-2
src/sync/test/syncServer.c
src/sync/test/syncServer.c
+1
-1
tests/script/general/parser/first_last_query.sim
tests/script/general/parser/first_last_query.sim
+3
-0
tests/script/general/parser/where.sim
tests/script/general/parser/where.sim
+4
-0
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+7
-21
未找到文件。
cmake/define.inc
浏览文件 @
a4b7ba95
...
...
@@ -72,18 +72,21 @@ ENDIF ()
IF
(
TD_ARM_32
)
ADD_DEFINITIONS
(
-
D_TD_ARM_32
)
ADD_DEFINITIONS
(
-
D_TD_ARM_
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
MESSAGE
(
STATUS
"arm32 is defined"
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types "
)
ENDIF
()
IF
(
TD_MIPS_64
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_64_
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
MESSAGE
(
STATUS
"mips64 is defined"
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
IF
(
TD_MIPS_32
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_32_
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
MESSAGE
(
STATUS
"mips32 is defined"
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
...
...
src/client/src/TSDBJNIConnector.c
浏览文件 @
a4b7ba95
...
...
@@ -490,13 +490,13 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
(
*
env
)
->
CallVoidMethod
(
env
,
rowobj
,
g_rowdataSetBooleanFp
,
i
,
(
jboolean
)(
*
((
char
*
)
row
[
i
])
==
1
));
break
;
case
TSDB_DATA_TYPE_TINYINT
:
(
*
env
)
->
CallVoidMethod
(
env
,
rowobj
,
g_rowdataSetByteFp
,
i
,
(
jbyte
)
*
((
char
*
)
row
[
i
]));
(
*
env
)
->
CallVoidMethod
(
env
,
rowobj
,
g_rowdataSetByteFp
,
i
,
(
jbyte
)
*
((
int8_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
(
*
env
)
->
CallVoidMethod
(
env
,
rowobj
,
g_rowdataSetShortFp
,
i
,
(
jshort
)
*
((
shor
t
*
)
row
[
i
]));
(
*
env
)
->
CallVoidMethod
(
env
,
rowobj
,
g_rowdataSetShortFp
,
i
,
(
jshort
)
*
((
int16_
t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_INT
:
(
*
env
)
->
CallVoidMethod
(
env
,
rowobj
,
g_rowdataSetIntFp
,
i
,
(
jint
)
*
(
int
*
)
row
[
i
]);
(
*
env
)
->
CallVoidMethod
(
env
,
rowobj
,
g_rowdataSetIntFp
,
i
,
(
jint
)
*
(
int
32_t
*
)
row
[
i
]);
break
;
case
TSDB_DATA_TYPE_BIGINT
:
(
*
env
)
->
CallVoidMethod
(
env
,
rowobj
,
g_rowdataSetLongFp
,
i
,
(
jlong
)
*
((
int64_t
*
)
row
[
i
]));
...
...
src/client/src/tscLocal.c
浏览文件 @
a4b7ba95
...
...
@@ -306,16 +306,16 @@ static int32_t tscGetNthFieldResult(TAOS_ROW row, TAOS_FIELD* fields, int *lengt
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
sprintf
(
result
,
"%s"
,
((((
int
)(
*
((
char
*
)
val
)))
==
1
)
?
"true"
:
"false"
));
sprintf
(
result
,
"%s"
,
((((
int
32_t
)(
*
((
char
*
)
val
)))
==
1
)
?
"true"
:
"false"
));
break
;
case
TSDB_DATA_TYPE_TINYINT
:
sprintf
(
result
,
"%d"
,
(
int
)(
*
((
char
*
)
val
)
));
sprintf
(
result
,
"%d"
,
*
((
int8_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
sprintf
(
result
,
"%d"
,
(
int
)(
*
((
short
*
)
val
)
));
sprintf
(
result
,
"%d"
,
*
((
int16_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_INT
:
sprintf
(
result
,
"%d"
,
*
((
int
*
)
val
));
sprintf
(
result
,
"%d"
,
*
((
int
32_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_BIGINT
:
sprintf
(
result
,
"%"
PRId64
,
*
((
int64_t
*
)
val
));
...
...
src/client/src/tscSQLParser.c
浏览文件 @
a4b7ba95
...
...
@@ -1699,7 +1699,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
if
(
pItem
->
pNode
->
pParam
!=
NULL
)
{
tSQLExprItem
*
pParamElem
=
&
pItem
->
pNode
->
pParam
->
a
[
0
];
SStrToken
*
pToken
=
&
pParamElem
->
pNode
->
colInfo
;
shor
t
sqlOptr
=
pParamElem
->
pNode
->
nSQLOptr
;
int16_
t
sqlOptr
=
pParamElem
->
pNode
->
nSQLOptr
;
if
((
pToken
->
z
==
NULL
||
pToken
->
n
==
0
)
&&
(
TK_INTEGER
!=
sqlOptr
))
/*select count(1) from table*/
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
...
...
src/client/src/tscServer.c
浏览文件 @
a4b7ba95
...
...
@@ -234,9 +234,8 @@ int tscSendMsgToServer(SSqlObj *pSql) {
}
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpcEpSet
*
pEpSet
)
{
uint64_t
handle
=
(
uint64_t
)
rpcMsg
->
ahandle
;
void
**
p
=
taosCacheAcquireByKey
(
tscObjCache
,
&
handle
,
sizeof
(
uint64_t
));
TSDB_CACHE_PTR_TYPE
handle
=
(
TSDB_CACHE_PTR_TYPE
)
rpcMsg
->
ahandle
;
void
**
p
=
taosCacheAcquireByKey
(
tscObjCache
,
&
handle
,
sizeof
(
TSDB_CACHE_PTR_TYPE
));
if
(
p
==
NULL
)
{
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
...
...
src/client/src/tscSql.c
浏览文件 @
a4b7ba95
...
...
@@ -719,15 +719,15 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
switch
(
fields
[
i
].
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
char
*
)
row
[
i
]));
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
int8_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
shor
t
*
)
row
[
i
]));
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
int16_
t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_INT
:
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
int
*
)
row
[
i
]));
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
int
32_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_BIGINT
:
...
...
src/client/src/tscSystem.c
浏览文件 @
a4b7ba95
...
...
@@ -141,7 +141,7 @@ void taos_init_imp(void) {
int64_t
refreshTime
=
10
;
// 10 seconds by default
if
(
tscMetaCache
==
NULL
)
{
tscMetaCache
=
taosCacheInit
(
TSDB_DATA_TYPE_BINARY
,
refreshTime
,
false
,
NULL
,
"tableMeta"
);
tscObjCache
=
taosCacheInit
(
TSDB_
DATA_TYPE_BIGINT
,
refreshTime
/
2
,
false
,
tscFreeSqlObjInCache
,
"sqlObj"
);
tscObjCache
=
taosCacheInit
(
TSDB_
CACHE_PTR_KEY
,
refreshTime
/
2
,
false
,
tscFreeSqlObjInCache
,
"sqlObj"
);
}
tscDebug
(
"client is initialized successfully"
);
...
...
src/client/src/tscUtil.c
浏览文件 @
a4b7ba95
...
...
@@ -1788,8 +1788,8 @@ void registerSqlObj(SSqlObj* pSql) {
int32_t
ref
=
T_REF_INC
(
pSql
->
pTscObj
);
tscDebug
(
"%p add to tscObj:%p, ref:%d"
,
pSql
,
pSql
->
pTscObj
,
ref
);
uint64_t
p
=
(
uint64_t
)
pSql
;
pSql
->
self
=
taosCachePut
(
tscObjCache
,
&
p
,
sizeof
(
uint64_t
),
&
p
,
sizeof
(
uint64_t
),
DEFAULT_LIFE_TIME
);
TSDB_CACHE_PTR_TYPE
p
=
(
TSDB_CACHE_PTR_TYPE
)
pSql
;
pSql
->
self
=
taosCachePut
(
tscObjCache
,
&
p
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
&
p
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
DEFAULT_LIFE_TIME
);
}
SSqlObj
*
createSimpleSubObj
(
SSqlObj
*
pSql
,
void
(
*
fp
)(),
void
*
param
,
int32_t
cmd
)
{
...
...
src/common/src/ttypes.c
浏览文件 @
a4b7ba95
...
...
@@ -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
浏览文件 @
a4b7ba95
...
...
@@ -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
浏览文件 @
a4b7ba95
...
...
@@ -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
{
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
a4b7ba95
...
...
@@ -419,16 +419,16 @@ static void dumpFieldToFile(FILE* fp, const char* val, TAOS_FIELD* field, int32_
char
buf
[
TSDB_MAX_BYTES_PER_ROW
];
switch
(
field
->
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
fprintf
(
fp
,
"%d"
,
((((
int
)(
*
((
char
*
)
val
)))
==
1
)
?
1
:
0
));
fprintf
(
fp
,
"%d"
,
((((
int
32_t
)(
*
((
char
*
)
val
)))
==
1
)
?
1
:
0
));
break
;
case
TSDB_DATA_TYPE_TINYINT
:
fprintf
(
fp
,
"%d"
,
(
int
)(
*
((
char
*
)
val
)
));
fprintf
(
fp
,
"%d"
,
*
((
int8_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
fprintf
(
fp
,
"%d"
,
(
int
)(
*
((
short
*
)
val
)
));
fprintf
(
fp
,
"%d"
,
*
((
int16_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_INT
:
fprintf
(
fp
,
"%d"
,
*
((
int
*
)
val
));
fprintf
(
fp
,
"%d"
,
*
((
int
32_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_BIGINT
:
fprintf
(
fp
,
"%"
PRId64
,
*
((
int64_t
*
)
val
));
...
...
@@ -559,16 +559,16 @@ static void printField(const char* val, TAOS_FIELD* field, int width, int32_t le
char
buf
[
TSDB_MAX_BYTES_PER_ROW
];
switch
(
field
->
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
printf
(
"%*s"
,
width
,
((((
int
)(
*
((
char
*
)
val
)))
==
1
)
?
"true"
:
"false"
));
printf
(
"%*s"
,
width
,
((((
int
32_t
)(
*
((
char
*
)
val
)))
==
1
)
?
"true"
:
"false"
));
break
;
case
TSDB_DATA_TYPE_TINYINT
:
printf
(
"%*d"
,
width
,
(
int
)(
*
((
char
*
)
val
)
));
printf
(
"%*d"
,
width
,
*
((
int8_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
printf
(
"%*d"
,
width
,
(
int
)(
*
((
short
*
)
val
)
));
printf
(
"%*d"
,
width
,
*
((
int16_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_INT
:
printf
(
"%*d"
,
width
,
*
((
int
*
)
val
));
printf
(
"%*d"
,
width
,
*
((
int
32_t
*
)
val
));
break
;
case
TSDB_DATA_TYPE_BIGINT
:
printf
(
"%*"
PRId64
,
width
,
*
((
int64_t
*
)
val
));
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
a4b7ba95
...
...
@@ -65,7 +65,7 @@ int32_t mnodeInitShow() {
mnodeAddReadMsgHandle
(
TSDB_MSG_TYPE_CM_CONNECT
,
mnodeProcessConnectMsg
);
mnodeAddReadMsgHandle
(
TSDB_MSG_TYPE_CM_USE_DB
,
mnodeProcessUseMsg
);
tsMnodeShowCache
=
taosCacheInit
(
TSDB_
DATA_TYPE_BIGINT
,
5
,
true
,
mnodeFreeShowObj
,
"show"
);
tsMnodeShowCache
=
taosCacheInit
(
TSDB_
CACHE_PTR_KEY
,
5
,
true
,
mnodeFreeShowObj
,
"show"
);
return
0
;
}
...
...
@@ -378,8 +378,8 @@ static bool mnodeCheckShowFinished(SShowObj *pShow) {
}
static
bool
mnodeAccquireShowObj
(
SShowObj
*
pShow
)
{
uint64_t
handleVal
=
(
uint64_t
)
pShow
;
SShowObj
**
ppShow
=
taosCacheAcquireByKey
(
tsMnodeShowCache
,
&
handleVal
,
sizeof
(
int64_t
));
TSDB_CACHE_PTR_TYPE
handleVal
=
(
TSDB_CACHE_PTR_TYPE
)
pShow
;
SShowObj
**
ppShow
=
taosCacheAcquireByKey
(
tsMnodeShowCache
,
&
handleVal
,
sizeof
(
TSDB_CACHE_PTR_TYPE
));
if
(
ppShow
)
{
mDebug
(
"%p, show is accquired from cache, data:%p, index:%d"
,
pShow
,
ppShow
,
pShow
->
index
);
return
true
;
...
...
@@ -393,8 +393,8 @@ static void* mnodePutShowObj(SShowObj *pShow) {
if
(
tsMnodeShowCache
!=
NULL
)
{
pShow
->
index
=
atomic_add_fetch_32
(
&
tsShowObjIndex
,
1
);
uint64_t
handleVal
=
(
uint64_t
)
pShow
;
SShowObj
**
ppShow
=
taosCachePut
(
tsMnodeShowCache
,
&
handleVal
,
sizeof
(
int64_t
),
&
pShow
,
sizeof
(
int64_t
),
DEFAULT_SHOWHANDLE_LIFE_SPAN
);
TSDB_CACHE_PTR_TYPE
handleVal
=
(
TSDB_CACHE_PTR_TYPE
)
pShow
;
SShowObj
**
ppShow
=
taosCachePut
(
tsMnodeShowCache
,
&
handleVal
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
&
pShow
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
DEFAULT_SHOWHANDLE_LIFE_SPAN
);
pShow
->
ppShow
=
(
void
**
)
ppShow
;
mDebug
(
"%p, show is put into cache, data:%p index:%d"
,
pShow
,
ppShow
,
pShow
->
index
);
return
pShow
;
...
...
src/plugins/http/src/httpGcJson.c
浏览文件 @
a4b7ba95
...
...
@@ -148,10 +148,10 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
len
+=
snprintf
(
target
+
len
,
HTTP_GC_TARGET_SIZE
-
len
,
"%s:%"
PRId64
,
fields
[
i
].
name
,
*
((
int64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
len
+=
snprintf
(
target
+
len
,
HTTP_GC_TARGET_SIZE
-
len
,
"%s:%.5f"
,
fields
[
i
].
name
,
*
((
float
*
)
row
[
i
]));
len
+=
snprintf
(
target
+
len
,
HTTP_GC_TARGET_SIZE
-
len
,
"%s:%.5f"
,
fields
[
i
].
name
,
GET_FLOAT_VAL
(
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
len
+=
snprintf
(
target
+
len
,
HTTP_GC_TARGET_SIZE
-
len
,
"%s:%.9f"
,
fields
[
i
].
name
,
*
((
double
*
)
row
[
i
]));
len
+=
snprintf
(
target
+
len
,
HTTP_GC_TARGET_SIZE
-
len
,
"%s:%.9f"
,
fields
[
i
].
name
,
GET_DOUBLE_VAL
(
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
...
...
@@ -210,10 +210,10 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
httpJsonInt64
(
jsonBuf
,
*
((
int64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
httpJsonFloat
(
jsonBuf
,
*
((
float
*
)
row
[
i
]));
httpJsonFloat
(
jsonBuf
,
GET_FLOAT_VAL
(
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
httpJsonDouble
(
jsonBuf
,
*
((
double
*
)
row
[
i
]));
httpJsonDouble
(
jsonBuf
,
GET_DOUBLE_VAL
(
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
...
...
src/plugins/http/src/httpRestJson.c
浏览文件 @
a4b7ba95
...
...
@@ -124,10 +124,10 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
httpJsonInt64
(
jsonBuf
,
*
((
int64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
httpJsonFloat
(
jsonBuf
,
*
((
float
*
)
row
[
i
]));
httpJsonFloat
(
jsonBuf
,
GET_FLOAT_VAL
(
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
httpJsonDouble
(
jsonBuf
,
*
((
double
*
)
row
[
i
]));
httpJsonDouble
(
jsonBuf
,
GET_DOUBLE_VAL
(
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
...
...
src/query/src/qExecutor.c
浏览文件 @
a4b7ba95
...
...
@@ -7032,7 +7032,7 @@ void* qOpenQueryMgmt(int32_t vgId) {
return
NULL
;
}
pQueryMgmt
->
qinfoPool
=
taosCacheInit
(
TSDB_
DATA_TYPE_BIGINT
,
REFRESH_HANDLE_INTERVAL
,
true
,
freeqinfoFn
,
cacheName
);
pQueryMgmt
->
qinfoPool
=
taosCacheInit
(
TSDB_
CACHE_PTR_KEY
,
REFRESH_HANDLE_INTERVAL
,
true
,
freeqinfoFn
,
cacheName
);
pQueryMgmt
->
closed
=
false
;
pQueryMgmt
->
vgId
=
vgId
;
...
...
@@ -7101,23 +7101,23 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) {
qError
(
"QInfo:%p failed to add qhandle into cache, since qMgmt is colsing"
,
(
void
*
)
qInfo
);
return
NULL
;
}
else
{
uint64_t
handleVal
=
(
uint64_t
)
qInfo
;
void
**
handle
=
taosCachePut
(
pQueryMgmt
->
qinfoPool
,
&
handleVal
,
sizeof
(
int64_t
),
&
qInfo
,
POINTER_BYTES
,
DEFAULT_QHANDLE_LIFE_SPAN
);
TSDB_CACHE_PTR_TYPE
handleVal
=
(
TSDB_CACHE_PTR_TYPE
)
qInfo
;
void
**
handle
=
taosCachePut
(
pQueryMgmt
->
qinfoPool
,
&
handleVal
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
&
qInfo
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
DEFAULT_QHANDLE_LIFE_SPAN
);
// pthread_mutex_unlock(&pQueryMgmt->lock);
return
handle
;
}
}
void
**
qAcquireQInfo
(
void
*
pMgmt
,
uint64_t
key
)
{
void
**
qAcquireQInfo
(
void
*
pMgmt
,
uint64_t
_
key
)
{
SQueryMgmt
*
pQueryMgmt
=
pMgmt
;
if
(
pQueryMgmt
->
qinfoPool
==
NULL
||
pQueryMgmt
->
closed
)
{
return
NULL
;
}
void
**
handle
=
taosCacheAcquireByKey
(
pQueryMgmt
->
qinfoPool
,
&
key
,
sizeof
(
uint64_t
));
TSDB_CACHE_PTR_TYPE
key
=
(
TSDB_CACHE_PTR_TYPE
)
_key
;
void
**
handle
=
taosCacheAcquireByKey
(
pQueryMgmt
->
qinfoPool
,
&
key
,
sizeof
(
TSDB_CACHE_PTR_TYPE
));
if
(
handle
==
NULL
||
*
handle
==
NULL
)
{
return
NULL
;
}
else
{
...
...
src/sync/src/syncMain.c
浏览文件 @
a4b7ba95
...
...
@@ -491,7 +491,7 @@ static SSyncPeer *syncAddPeer(SSyncNode *pNode, const SNodeInfo *pInfo) {
uint32_t
ip
=
taosGetIpFromFqdn
(
pInfo
->
nodeFqdn
);
if
(
ip
==
-
1
)
return
NULL
;
SSyncPeer
*
pPeer
=
(
SSyncPeer
*
)
calloc
(
1
,
sizeof
(
SSyncPeer
));
SSyncPeer
*
pPeer
=
calloc
(
1
,
sizeof
(
SSyncPeer
));
if
(
pPeer
==
NULL
)
return
NULL
;
pPeer
->
nodeId
=
pInfo
->
nodeId
;
...
...
@@ -499,7 +499,7 @@ static SSyncPeer *syncAddPeer(SSyncNode *pNode, const SNodeInfo *pInfo) {
pPeer
->
ip
=
ip
;
pPeer
->
port
=
pInfo
->
nodePort
;
pPeer
->
fqdn
[
sizeof
(
pPeer
->
fqdn
)
-
1
]
=
0
;
snprintf
(
pPeer
->
id
,
sizeof
(
pPeer
->
id
),
"vgId:%d peer:%s:%
d
"
,
pNode
->
vgId
,
pPeer
->
fqdn
,
pPeer
->
port
);
snprintf
(
pPeer
->
id
,
sizeof
(
pPeer
->
id
),
"vgId:%d peer:%s:%
u
"
,
pNode
->
vgId
,
pPeer
->
fqdn
,
pPeer
->
port
);
pPeer
->
peerFd
=
-
1
;
pPeer
->
syncFd
=
-
1
;
...
...
src/sync/test/syncServer.c
浏览文件 @
a4b7ba95
...
...
@@ -109,7 +109,6 @@ int processRpcMsg(void *item) {
if
(
pCfg
->
quorum
<=
1
)
{
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
item
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
rpcMallocCont
(
msgSize
);
...
...
@@ -117,6 +116,7 @@ int processRpcMsg(void *item) {
rpcMsg
.
handle
=
pMsg
->
handle
;
rpcMsg
.
code
=
code
;
rpcSendResponse
(
&
rpcMsg
);
taosFreeQitem
(
item
);
}
return
code
;
...
...
tests/script/general/parser/first_last_query.sim
浏览文件 @
a4b7ba95
...
...
@@ -14,12 +14,14 @@ $i = 0
$db = $dbPrefix . $i
$stb = $stbPrefix . $i
print use $db
sql use $db
##### select first/last from table
## TBASE-331
print ====== select first/last from table
$tb = $tbPrefix . 0
print select first(*) from $tb
sql select first(*) from $tb
if $rows != 1 then
return -1
...
...
@@ -58,6 +60,7 @@ if $data09 != NCHAR then
return -1
endi
print select last(*) from $tb
sql select last(*) from $tb
if $rows != 1 then
return -1
...
...
tests/script/general/parser/where.sim
浏览文件 @
a4b7ba95
...
...
@@ -94,7 +94,11 @@ endi
## select specified columns
print select c1 from $mt
sql select c1 from $mt
print rows $rows
print totalNum $totalNum
if $rows != $totalNum then
return -1
endi
...
...
tests/tsim/src/simExe.c
浏览文件 @
a4b7ba95
...
...
@@ -739,36 +739,22 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
((((
int
)(
*
((
char
*
)
row
[
i
])))
==
1
)
?
"1"
:
"0"
));
break
;
case
TSDB_DATA_TYPE_TINYINT
:
sprintf
(
value
,
"%d"
,
(
int
)(
*
((
char
*
)
row
[
i
])
));
sprintf
(
value
,
"%d"
,
*
((
int8_t
*
)
row
[
i
]
));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
sprintf
(
value
,
"%d"
,
(
int
)(
*
((
short
*
)
row
[
i
])
));
sprintf
(
value
,
"%d"
,
*
((
int16_t
*
)
row
[
i
]
));
break
;
case
TSDB_DATA_TYPE_INT
:
sprintf
(
value
,
"%d"
,
*
((
int
*
)
row
[
i
]));
sprintf
(
value
,
"%d"
,
*
((
int
32_t
*
)
row
[
i
]));
break
;
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录