Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e46896bf
T
TDengine
项目概览
慢慢CG
/
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看板
提交
e46896bf
编写于
5月 23, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] support hex/bin numeric data to insert
上级
7221f5a6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
33 deletion
+42
-33
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+1
-1
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+13
-10
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+28
-22
未找到文件。
src/client/src/tscAsync.c
浏览文件 @
e46896bf
...
@@ -48,7 +48,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
...
@@ -48,7 +48,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
pSql
->
param
=
param
;
pSql
->
param
=
param
;
pSql
->
pTscObj
=
pObj
;
pSql
->
pTscObj
=
pObj
;
pSql
->
maxRetry
=
TSDB_MAX_REPLICA_NUM
;
pSql
->
maxRetry
=
TSDB_MAX_REPLICA_NUM
;
pSql
->
fp
=
fp
;
pSql
->
fp
=
fp
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
tscError
(
"failed to malloc payload"
);
tscError
(
"failed to malloc payload"
);
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
e46896bf
...
@@ -947,18 +947,21 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
...
@@ -947,18 +947,21 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
index
=
pCtx
->
preAggVals
.
statis
.
maxIndex
;
index
=
pCtx
->
preAggVals
.
statis
.
maxIndex
;
}
}
/**
TSKEY
key
=
TSKEY_INITIAL_VAL
;
* NOTE: work around the bug caused by invalid pre-calculated function.
if
(
pCtx
->
ptsList
!=
NULL
)
{
* Here the selectivity + ts will not return correct value.
/**
*
* NOTE: work around the bug caused by invalid pre-calculated function.
* The following codes of 3 lines will be removed later.
* Here the selectivity + ts will not return correct value.
*/
*
if
(
index
<
0
||
index
>=
pCtx
->
size
+
pCtx
->
startOffset
)
{
* The following codes of 3 lines will be removed later.
index
=
0
;
*/
if
(
index
<
0
||
index
>=
pCtx
->
size
+
pCtx
->
startOffset
)
{
index
=
0
;
}
key
=
pCtx
->
ptsList
[
index
];
}
}
TSKEY
key
=
pCtx
->
ptsList
[
index
];
if
(
pCtx
->
inputType
>=
TSDB_DATA_TYPE_TINYINT
&&
pCtx
->
inputType
<=
TSDB_DATA_TYPE_BIGINT
)
{
if
(
pCtx
->
inputType
>=
TSDB_DATA_TYPE_TINYINT
&&
pCtx
->
inputType
<=
TSDB_DATA_TYPE_BIGINT
)
{
int64_t
val
=
GET_INT64_VAL
(
tval
);
int64_t
val
=
GET_INT64_VAL
(
tval
);
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_TINYINT
)
{
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_TINYINT
)
{
...
...
src/client/src/tscParseInsert.c
浏览文件 @
e46896bf
...
@@ -42,35 +42,42 @@ enum {
...
@@ -42,35 +42,42 @@ enum {
static
int32_t
tscAllocateMemIfNeed
(
STableDataBlocks
*
pDataBlock
,
int32_t
rowSize
,
int32_t
*
numOfRows
);
static
int32_t
tscAllocateMemIfNeed
(
STableDataBlocks
*
pDataBlock
,
int32_t
rowSize
,
int32_t
*
numOfRows
);
static
int32_t
tscToInteger
(
SSQLToken
*
pToken
,
int64_t
*
value
,
char
**
endPtr
)
{
static
int32_t
tscToInteger
(
SSQLToken
*
pToken
,
int64_t
*
value
,
char
**
endPtr
)
{
// int32_t numType = isValidNumber(pToken);
if
(
pToken
->
n
==
0
)
{
// if (TK_ILLEGAL == numType) {
return
TK_ILLEGAL
;
// return numType;
}
// }
int32_t
radix
=
10
;
int32_t
radix
=
10
;
if
(
pToken
->
type
==
TK_HEX
)
{
radix
=
16
;
int32_t
radixList
[
3
]
=
{
16
,
8
,
2
};
}
else
if
(
pToken
->
type
==
TK_OCT
)
{
if
(
pToken
->
type
==
TK_HEX
||
pToken
->
type
==
TK_OCT
||
pToken
->
type
==
TK_BIN
)
{
radix
=
8
;
radix
=
radixList
[
pToken
->
type
-
TK_HEX
];
}
else
if
(
pToken
->
type
==
TK_BIN
)
{
radix
=
2
;
}
}
errno
=
0
;
errno
=
0
;
*
value
=
strtoll
(
pToken
->
z
,
endPtr
,
radix
);
*
value
=
strtoll
(
pToken
->
z
,
endPtr
,
radix
);
// not a valid integer number, return error
if
((
pToken
->
type
==
TK_STRING
||
pToken
->
type
==
TK_ID
)
&&
((
*
endPtr
-
pToken
->
z
)
!=
pToken
->
n
))
{
return
TK_ILLEGAL
;
}
return
pToken
->
type
;
return
pToken
->
type
;
}
}
static
int32_t
tscToDouble
(
SSQLToken
*
pToken
,
double
*
value
,
char
**
endPtr
)
{
static
int32_t
tscToDouble
(
SSQLToken
*
pToken
,
double
*
value
,
char
**
endPtr
)
{
// int32_t numType = isValidNumber(pToken);
if
(
pToken
->
n
==
0
)
{
// if (TK_ILLEGAL == numType) {
return
TK_ILLEGAL
;
// return numType;
}
// }
errno
=
0
;
errno
=
0
;
*
value
=
strtod
(
pToken
->
z
,
endPtr
);
*
value
=
strtod
(
pToken
->
z
,
endPtr
);
return
pToken
->
type
;
// not a valid integer number, return error
if
((
pToken
->
type
==
TK_STRING
||
pToken
->
type
==
TK_ID
)
&&
((
*
endPtr
-
pToken
->
z
)
!=
pToken
->
n
))
{
return
TK_ILLEGAL
;
}
else
{
return
pToken
->
type
;
}
}
}
int
tsParseTime
(
SSQLToken
*
pToken
,
int64_t
*
time
,
char
**
next
,
char
*
error
,
int16_t
timePrec
)
{
int
tsParseTime
(
SSQLToken
*
pToken
,
int64_t
*
time
,
char
**
next
,
char
*
error
,
int16_t
timePrec
)
{
...
@@ -422,9 +429,9 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
...
@@ -422,9 +429,9 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
return
-
1
;
return
-
1
;
}
}
i
f
(((
sToken
.
type
!=
TK_NOW
)
&&
(
sToken
.
type
!=
TK_INTEGER
)
&&
(
sToken
.
type
!=
TK_STRING
)
&&
i
nt16_t
type
=
sToken
.
type
;
(
sToken
.
type
!=
TK_FLOAT
)
&&
(
sToken
.
type
!=
TK_BOOL
)
&&
(
sToken
.
type
!=
TK_NULL
))
||
if
((
type
!=
TK_NOW
&&
type
!=
TK_INTEGER
&&
type
!=
TK_STRING
&&
type
!=
TK_FLOAT
&&
type
!=
TK_BOOL
&&
(
sToken
.
n
==
0
)
||
(
sToken
.
type
==
TK_RP
))
{
type
!=
TK_NULL
&&
type
!=
TK_HEX
&&
type
!=
TK_OCT
&&
type
!=
TK_BIN
)
||
(
sToken
.
n
==
0
)
||
(
type
==
TK_RP
))
{
tscInvalidSQLErrMsg
(
error
,
"invalid data or symbol"
,
sToken
.
z
);
tscInvalidSQLErrMsg
(
error
,
"invalid data or symbol"
,
sToken
.
z
);
*
code
=
TSDB_CODE_INVALID_SQL
;
*
code
=
TSDB_CODE_INVALID_SQL
;
return
-
1
;
return
-
1
;
...
@@ -1306,8 +1313,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
...
@@ -1306,8 +1313,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
SQueryInfo
*
pQueryInfo
=
NULL
;
SQueryInfo
*
pQueryInfo
=
NULL
;
tscGetQueryInfoDetailSafely
(
pCmd
,
pCmd
->
clauseIndex
,
&
pQueryInfo
);
tscGetQueryInfoDetailSafely
(
pCmd
,
pCmd
->
clauseIndex
,
&
pQueryInfo
);
uint16_t
type
=
(
sToken
.
type
==
TK_INSERT
)
?
TSDB_QUERY_TYPE_INSERT
:
TSDB_QUERY_TYPE_IMPORT
;
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_INSERT
);
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
type
);
sToken
=
tStrGetToken
(
pSql
->
sqlstr
,
&
index
,
false
,
0
,
NULL
);
sToken
=
tStrGetToken
(
pSql
->
sqlstr
,
&
index
,
false
,
0
,
NULL
);
if
(
sToken
.
type
!=
TK_INTO
)
{
if
(
sToken
.
type
!=
TK_INTO
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录