Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
60629d31
TDengine
项目概览
冷面1992
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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,发现更多精彩内容 >>
提交
60629d31
编写于
12月 05, 2019
作者:
L
lihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TBASE-1288]
上级
b9087725
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
46 addition
and
37 deletion
+46
-37
src/util/src/tcrc32c.c
src/util/src/tcrc32c.c
+3
-1
src/util/src/textbuffer.c
src/util/src/textbuffer.c
+29
-23
src/util/src/thistogram.c
src/util/src/thistogram.c
+2
-2
src/util/src/tskiplist.c
src/util/src/tskiplist.c
+3
-3
src/util/src/tstrbuild.c
src/util/src/tstrbuild.c
+2
-2
src/util/src/ttypes.c
src/util/src/ttypes.c
+7
-6
未找到文件。
src/util/src/tcrc32c.c
浏览文件 @
60629d31
...
...
@@ -26,7 +26,7 @@
#include "tcrc32c.h"
//todo : use the original source code
#pragma GCC diagnostic ignored "-Wunused-function"
//
#pragma GCC diagnostic ignored "-Wunused-function"
#define POLY 0x82f63b78
#define LONG_SHIFT 8192
...
...
@@ -1093,6 +1093,7 @@ static uint32_t short_shifts[4][256] = {
0xe1a734e7
,
0xc41cc13c
,
0x140cd014
,
0x31b725cf
,
0x5f7b3ba2
,
0x7ac0ce79
,
0x82e30778
,
0xa758f2a3
,
0xc994ecce
,
0xec2f1915
}};
#if 0
static uint32_t append_trivial(uint32_t crc, crc_stream input, size_t length) {
for (size_t i = 0; i < length; ++i) {
crc = crc ^ input[i];
...
...
@@ -1130,6 +1131,7 @@ static uint32_t append_adler_table(uint32_t crci, crc_stream input,
}
return (uint32_t)(crc ^ 0xffffffff);
}
#endif
/* Table-driven software version as a fall-back. This is about 15 times slower
than using the hardware instructions. This assumes little-endian integers,
...
...
src/util/src/textbuffer.c
浏览文件 @
60629d31
...
...
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include "os.h"
#include "taos.h"
#include "taosmsg.h"
...
...
@@ -23,7 +23,7 @@
#include "ttypes.h"
#include "tutil.h"
#pragma GCC diagnostic ignored "-Wformat"
//
#pragma GCC diagnostic ignored "-Wformat"
#define COLMODEL_GET_VAL(data, schema, allrow, rowId, colId) \
(data + (schema)->colOffset[colId] * (allrow) + (rowId) * (schema)->pFields[colId].bytes)
...
...
@@ -1017,7 +1017,7 @@ static void UNUSED_FUNC tSortDataPrint(int32_t type, char *prefix, char *startx,
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
printf
(
"%s:(%
lld, %lld, %lld
)
\n
"
,
prefix
,
*
(
int64_t
*
)
startx
,
*
(
int64_t
*
)
midx
,
*
(
int64_t
*
)
endx
);
printf
(
"%s:(%
"
PRId64
", %"
PRId64
", %"
PRId64
"
)
\n
"
,
prefix
,
*
(
int64_t
*
)
startx
,
*
(
int64_t
*
)
midx
,
*
(
int64_t
*
)
endx
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
printf
(
"%s:(%f, %f, %f)
\n
"
,
prefix
,
*
(
float
*
)
startx
,
*
(
float
*
)
midx
,
*
(
float
*
)
endx
);
...
...
@@ -1093,7 +1093,7 @@ static UNUSED_FUNC void tRowModelDisplay(tOrderDescriptor *pDescriptor, int32_t
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
printf
(
"%
lld
\t
"
,
*
(
int64_t
*
)
startx
);
printf
(
"%
"
PRId64
"
\t
"
,
*
(
int64_t
*
)
startx
);
break
;
case
TSDB_DATA_TYPE_BINARY
:
printf
(
"%s
\t
"
,
startx
);
...
...
@@ -1264,7 +1264,7 @@ static tFilePage *loadIntoBucketFromDisk(tMemBucket *pMemBucket, int32_t segIdx,
assert
(
pPage
->
numOfElems
>
0
);
tColModelAppend
(
pDesc
->
pSchema
,
buffer
,
pPage
->
data
,
0
,
pPage
->
numOfElems
,
pPage
->
numOfElems
);
printf
(
"id: %d count: %
d
\n
"
,
j
,
buffer
->
numOfElems
);
printf
(
"id: %d count: %
"
PRIu64
"
\n
"
,
j
,
buffer
->
numOfElems
);
}
}
tfree
(
pPage
);
...
...
@@ -1376,10 +1376,16 @@ static void printBinaryData(char *data, int32_t len) {
}
if
(
len
==
50
)
{
// probably the avg intermediate result
printf
(
"%lf,%
d
\t
"
,
*
(
double
*
)
data
,
*
(
int64_t
*
)(
data
+
sizeof
(
double
)));
printf
(
"%lf,%
"
PRId64
"
\t
"
,
*
(
double
*
)
data
,
*
(
int64_t
*
)(
data
+
sizeof
(
double
)));
}
else
if
(
data
[
8
]
==
','
)
{
// in TSDB_FUNC_FIRST_DST/TSDB_FUNC_LAST_DST,
// the value is seperated by ','
printf
(
"%ld,%0x
\t
"
,
*
(
int64_t
*
)
data
,
data
+
sizeof
(
int64_t
)
+
1
);
//printf("%" PRId64 ",%0x\t", *(int64_t *)data, data + sizeof(int64_t) + 1);
printf
(
"%"
PRId64
", HEX: "
,
*
(
int64_t
*
)
data
);
int32_t
tmp_len
=
len
-
sizeof
(
int64_t
)
-
1
;
for
(
int32_t
i
=
0
;
i
<
tmp_len
;
++
i
)
{
printf
(
"%0x "
,
*
(
data
+
sizeof
(
int64_t
)
+
1
+
i
));
}
printf
(
"
\t
"
);
}
else
if
(
isCharString
)
{
printf
(
"%s
\t
"
,
data
);
}
...
...
@@ -1389,26 +1395,26 @@ static void printBinaryData(char *data, int32_t len) {
static
void
printBinaryDataEx
(
char
*
data
,
int32_t
len
,
SSrcColumnInfo
*
param
)
{
if
(
param
->
functionId
==
TSDB_FUNC_LAST_DST
)
{
switch
(
param
->
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
printf
(
"%
lld
,%d
\t
"
,
*
(
int64_t
*
)
data
,
*
(
int8_t
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
case
TSDB_DATA_TYPE_TINYINT
:
printf
(
"%
"
PRId64
"
,%d
\t
"
,
*
(
int64_t
*
)
data
,
*
(
int8_t
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
printf
(
"%
lld
,%d
\t
"
,
*
(
int64_t
*
)
data
,
*
(
int16_t
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
case
TSDB_DATA_TYPE_SMALLINT
:
printf
(
"%
"
PRId64
"
,%d
\t
"
,
*
(
int64_t
*
)
data
,
*
(
int16_t
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
printf
(
"%
lld,%lld
\t
"
,
*
(
int64_t
*
)
data
,
*
(
int64_t
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
case
TSDB_DATA_TYPE_BIGINT
:
printf
(
"%
"
PRId64
",%"
PRId64
"
\t
"
,
*
(
int64_t
*
)
data
,
*
(
int64_t
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
printf
(
"%
lld,%d
\t
"
,
*
(
int64_t
*
)
data
,
*
(
float
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
case
TSDB_DATA_TYPE_FLOAT
:
printf
(
"%
"
PRId64
",%f
\t
"
,
*
(
int64_t
*
)
data
,
*
(
float
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
printf
(
"%
lld,%d
\t
"
,
*
(
int64_t
*
)
data
,
*
(
double
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
case
TSDB_DATA_TYPE_DOUBLE
:
printf
(
"%
"
PRId64
",%f
\t
"
,
*
(
int64_t
*
)
data
,
*
(
double
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
break
;
case
TSDB_DATA_TYPE_BINARY
:
printf
(
"%
lld
,%s
\t
"
,
*
(
int64_t
*
)
data
,
(
data
+
TSDB_KEYSIZE
+
1
));
case
TSDB_DATA_TYPE_BINARY
:
printf
(
"%
"
PRId64
"
,%s
\t
"
,
*
(
int64_t
*
)
data
,
(
data
+
TSDB_KEYSIZE
+
1
));
break
;
case
TSDB_DATA_TYPE_INT
:
default:
printf
(
"%
lld
,%d
\t
"
,
*
(
int64_t
*
)
data
,
*
(
int32_t
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
default:
printf
(
"%
"
PRId64
"
,%d
\t
"
,
*
(
int64_t
*
)
data
,
*
(
int32_t
*
)
(
data
+
TSDB_KEYSIZE
+
1
));
break
;
}
}
else
if
(
param
->
functionId
==
TSDB_FUNC_AVG
)
{
printf
(
"%f,%
lld
\t
"
,
*
(
double
*
)
data
,
*
(
int64_t
*
)
(
data
+
sizeof
(
double
)
+
1
));
printf
(
"%f,%
"
PRId64
"
\t
"
,
*
(
double
*
)
data
,
*
(
int64_t
*
)
(
data
+
sizeof
(
double
)
+
1
));
}
else
{
// functionId == TSDB_FUNC_MAX_DST | TSDB_FUNC_TAG
switch
(
param
->
type
)
{
...
...
@@ -1420,13 +1426,13 @@ static void printBinaryDataEx(char *data, int32_t len, SSrcColumnInfo *param) {
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
printf
(
"%
lld
\t
"
,
*
(
int64_t
*
)
data
);
printf
(
"%
"
PRId64
"
\t
"
,
*
(
int64_t
*
)
data
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
printf
(
"%
d
\t
"
,
*
(
float
*
)
data
);
printf
(
"%
f
\t
"
,
*
(
float
*
)
data
);
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
printf
(
"%
d
\t
"
,
*
(
double
*
)
data
);
printf
(
"%
f
\t
"
,
*
(
double
*
)
data
);
break
;
case
TSDB_DATA_TYPE_BINARY
:
printf
(
"%s
\t
"
,
data
);
...
...
@@ -1434,7 +1440,7 @@ static void printBinaryDataEx(char *data, int32_t len, SSrcColumnInfo *param) {
case
TSDB_DATA_TYPE_INT
:
default:
printf
(
"%
d
\t
"
,
*
(
double
*
)
data
);
printf
(
"%
f
\t
"
,
*
(
double
*
)
data
);
break
;
}
}
...
...
@@ -1450,7 +1456,7 @@ void tColModelDisplay(tColModel *pModel, void *pData, int32_t numOfRows, int32_t
switch
(
type
)
{
case
TSDB_DATA_TYPE_BIGINT
:
printf
(
"%
lld
\t
"
,
*
(
int64_t
*
)
val
);
printf
(
"%
"
PRId64
"
\t
"
,
*
(
int64_t
*
)
val
);
break
;
case
TSDB_DATA_TYPE_INT
:
printf
(
"%d
\t
"
,
*
(
int32_t
*
)
val
);
...
...
@@ -1468,7 +1474,7 @@ void tColModelDisplay(tColModel *pModel, void *pData, int32_t numOfRows, int32_t
printf
(
"%lf
\t
"
,
*
(
double
*
)
val
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
printf
(
"%
lld
\t
"
,
*
(
int64_t
*
)
val
);
printf
(
"%
"
PRId64
"
\t
"
,
*
(
int64_t
*
)
val
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
printf
(
"%d
\t
"
,
*
(
int8_t
*
)
val
);
...
...
@@ -1501,7 +1507,7 @@ void tColModelDisplayEx(tColModel *pModel, void *pData, int32_t numOfRows, int32
switch
(
pModel
->
pFields
[
j
].
type
)
{
case
TSDB_DATA_TYPE_BIGINT
:
printf
(
"%
lld
\t
"
,
*
(
int64_t
*
)
val
);
printf
(
"%
"
PRId64
"
\t
"
,
*
(
int64_t
*
)
val
);
break
;
case
TSDB_DATA_TYPE_INT
:
printf
(
"%d
\t
"
,
*
(
int32_t
*
)
val
);
...
...
@@ -1519,7 +1525,7 @@ void tColModelDisplayEx(tColModel *pModel, void *pData, int32_t numOfRows, int32
printf
(
"%lf
\t
"
,
*
(
double
*
)
val
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
printf
(
"%
lld
\t
"
,
*
(
int64_t
*
)
val
);
printf
(
"%
"
PRId64
"
\t
"
,
*
(
int64_t
*
)
val
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
printf
(
"%d
\t
"
,
*
(
int8_t
*
)
val
);
...
...
src/util/src/thistogram.c
浏览文件 @
60629d31
...
...
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include "os.h"
#include "taosmsg.h"
...
...
@@ -447,7 +447,7 @@ void tHistogramPrint(SHistogramInfo* pHisto) {
printf
(
"total entries: %d, elements: %d
\n
"
,
pHisto
->
numOfEntries
,
pHisto
->
numOfElems
);
#if defined(USE_ARRAYLIST)
for
(
int32_t
i
=
0
;
i
<
pHisto
->
numOfEntries
;
++
i
)
{
printf
(
"%d: (%f, %
lld
)
\n
"
,
i
+
1
,
pHisto
->
elems
[
i
].
val
,
pHisto
->
elems
[
i
].
num
);
printf
(
"%d: (%f, %
"
PRId64
"
)
\n
"
,
i
+
1
,
pHisto
->
elems
[
i
].
val
,
pHisto
->
elems
[
i
].
num
);
}
#else
tSkipListNode
*
pNode
=
pHisto
->
pList
->
pHead
.
pForward
[
0
];
...
...
src/util/src/tskiplist.c
浏览文件 @
60629d31
...
...
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <float.h>
#include <math.h>
#include <stdbool.h>
...
...
@@ -570,7 +570,7 @@ int32_t tSkipListIterateList(tSkipList *pSkipList, tSkipListNode ***pRes, bool (
char
*
tmp
=
realloc
((
*
pRes
),
num
*
POINTER_BYTES
);
assert
(
tmp
!=
NULL
);
*
pRes
=
tmp
;
*
pRes
=
(
tSkipListNode
**
)
tmp
;
}
return
num
;
...
...
@@ -688,7 +688,7 @@ void tSkipListPrint(tSkipList *pSkipList, int16_t nlevel) {
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_BIGINT
:
fprintf
(
stdout
,
"%d: %
lld
\n
"
,
id
++
,
p
->
key
.
i64Key
);
fprintf
(
stdout
,
"%d: %
"
PRId64
"
\n
"
,
id
++
,
p
->
key
.
i64Key
);
break
;
case
TSDB_DATA_TYPE_BINARY
:
fprintf
(
stdout
,
"%d: %s
\n
"
,
id
++
,
p
->
key
.
pz
);
...
...
src/util/src/tstrbuild.c
浏览文件 @
60629d31
...
...
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include "os.h"
#include "tstrbuild.h"
...
...
@@ -70,7 +70,7 @@ void taosStringBuilderAppendNull(SStringBuilder* sb) { taosStringBuilderAppendSt
void
taosStringBuilderAppendInteger
(
SStringBuilder
*
sb
,
int64_t
v
)
{
char
buf
[
64
];
size_t
len
=
sprintf
(
buf
,
"%
lld"
,
v
);
size_t
len
=
sprintf
(
buf
,
"%
"
PRId64
,
v
);
taosStringBuilderAppendStringLen
(
sb
,
buf
,
len
);
}
...
...
src/util/src/ttypes.c
浏览文件 @
60629d31
...
...
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include "os.h"
#include "taos.h"
#include "tsdb.h"
...
...
@@ -213,7 +213,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
return
sprintf
(
dst
,
"%d"
,
(
int32_t
)
pVar
->
i64Key
);
case
TSDB_DATA_TYPE_BIGINT
:
return
sprintf
(
dst
,
"%
lld"
,
pVar
->
i64Key
);
return
sprintf
(
dst
,
"%
"
PRId64
,
pVar
->
i64Key
);
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
...
...
@@ -224,6 +224,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
}
}
#if 0
static int32_t doConvertToInteger(tVariant *pVariant, char *pDest, int32_t type, bool releaseVariantPtr) {
if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
setNull(pDest, type, tDataTypeDesc[type].nSize);
...
...
@@ -337,7 +338,7 @@ static int32_t doConvertToInteger(tVariant *pVariant, char *pDest, int32_t type,
return 0;
}
#endif
static
FORCE_INLINE
int32_t
convertToBoolImpl
(
char
*
pStr
,
int32_t
len
)
{
if
((
strncasecmp
(
pStr
,
"true"
,
len
)
==
0
)
&&
(
len
==
4
))
{
return
TSDB_TRUE
;
...
...
@@ -386,7 +387,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
}
else
{
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_TINYINT
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
sprintf
(
pBuf
==
NULL
?
*
pDest
:
pBuf
,
"%
lld"
,
pVariant
->
i64Key
);
sprintf
(
pBuf
==
NULL
?
*
pDest
:
pBuf
,
"%
"
PRId64
,
pVariant
->
i64Key
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
||
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
sprintf
(
pBuf
==
NULL
?
*
pDest
:
pBuf
,
"%lf"
,
pVariant
->
dKey
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BOOL
)
{
...
...
@@ -411,7 +412,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
int32_t
nLen
=
0
;
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_TINYINT
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
nLen
=
sprintf
(
pDst
,
"%
lld"
,
pVariant
->
i64Key
);
nLen
=
sprintf
(
pDst
,
"%
"
PRId64
,
pVariant
->
i64Key
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
||
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
nLen
=
sprintf
(
pDst
,
"%lf"
,
pVariant
->
dKey
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BINARY
)
{
...
...
@@ -437,7 +438,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
char
*
tmp
=
realloc
(
pVariant
->
wpz
,
(
*
pDestSize
+
1
)
*
TSDB_NCHAR_SIZE
);
assert
(
tmp
!=
NULL
);
pVariant
->
wpz
=
tmp
;
pVariant
->
wpz
=
(
wchar_t
*
)
tmp
;
}
else
{
taosMbsToUcs4
(
pDst
,
nLen
,
*
pDest
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录