Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
TDengine
提交
d5b707a4
T
TDengine
项目概览
dgr6878
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
8
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,发现更多精彩内容 >>
未验证
提交
d5b707a4
编写于
5月 11, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
5月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1870 from taosdata/feature/query
[td-225] fix bugs for nchar handling
上级
fead5b90
f1d26db0
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
51 addition
and
40 deletion
+51
-40
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-2
src/query/src/qast.c
src/query/src/qast.c
+4
-1
src/query/src/tvariant.c
src/query/src/tvariant.c
+8
-2
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+5
-2
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+2
-2
src/util/src/tcompare.c
src/util/src/tcompare.c
+22
-26
tests/script/general/parser/nchar.sim
tests/script/general/parser/nchar.sim
+2
-0
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+6
-5
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
d5b707a4
...
...
@@ -5563,8 +5563,8 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
*
(
VarDataLenT
*
)
tagVal
=
pList
->
a
[
i
].
pVar
.
nLen
;
ret
=
tVariantDump
(
&
(
pList
->
a
[
i
].
pVar
),
tagVal
+
VARSTR_HEADER_SIZE
,
pTagSchema
[
i
].
type
);
ret
=
tVariantDump
(
&
(
pList
->
a
[
i
].
pVar
),
varDataVal
(
tagVal
),
pTagSchema
[
i
].
type
)
;
varDataSetLen
(
tagVal
,
pList
->
a
[
i
].
pVar
.
nLen
);
}
else
{
ret
=
tVariantDump
(
&
(
pList
->
a
[
i
].
pVar
),
tagVal
,
pTagSchema
[
i
].
type
);
}
...
...
src/query/src/qast.c
浏览文件 @
d5b707a4
...
...
@@ -540,8 +540,11 @@ static int32_t setQueryCond(tQueryInfo *queryColInfo, SQueryCond* pCond) {
static
void
tQueryIndexColumn
(
SSkipList
*
pSkipList
,
tQueryInfo
*
pQueryInfo
,
SArray
*
result
)
{
SSkipListIterator
*
iter
=
NULL
;
SQueryCond
cond
=
{
0
};
setQueryCond
(
pQueryInfo
,
&
cond
);
if
(
setQueryCond
(
pQueryInfo
,
&
cond
)
!=
TSDB_CODE_SUCCESS
)
{
//todo handle error
}
if
(
cond
.
start
!=
NULL
)
{
iter
=
tSkipListCreateIterFromVal
(
pSkipList
,
(
char
*
)
cond
.
start
->
v
,
pSkipList
->
keyInfo
.
type
,
TSDB_ORDER_ASC
);
...
...
src/query/src/tvariant.c
浏览文件 @
d5b707a4
...
...
@@ -389,6 +389,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
return
0
;
}
// todo handle the error
static
int32_t
toNchar
(
tVariant
*
pVariant
,
char
**
pDest
,
int32_t
*
pDestSize
)
{
char
tmpBuf
[
40
]
=
{
0
};
...
...
@@ -424,7 +425,12 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
pVariant
->
wpz
=
(
wchar_t
*
)
tmp
;
}
else
{
taosMbsToUcs4
(
pDst
,
nLen
,
*
pDest
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
,
NULL
);
size_t
output
=
-
1
;
taosMbsToUcs4
(
pDst
,
nLen
,
*
pDest
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
,
&
output
);
if
(
pDestSize
!=
NULL
)
{
*
pDestSize
=
output
;
}
}
return
0
;
...
...
@@ -779,7 +785,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, char type) {
}
case
TSDB_DATA_TYPE_NCHAR
:
{
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
*
(
uint32_t
*
)
payload
=
TSDB_DATA_NCHAR_NULL
;
*
(
uint32_t
*
)
payload
=
TSDB_DATA_NCHAR_NULL
;
}
else
{
if
(
pVariant
->
nType
!=
TSDB_DATA_TYPE_NCHAR
)
{
toNchar
(
pVariant
,
&
payload
,
&
pVariant
->
nLen
);
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
d5b707a4
...
...
@@ -8,7 +8,7 @@
#define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here
#define TSDB_META_FILE_NAME "META"
const
int32_t
DEFAULT_TAG_INDEX_COLUMN
=
0
;
const
int32_t
DEFAULT_TAG_INDEX_COLUMN
=
0
;
// skip list built based on the first column of tags
static
int
tsdbFreeTable
(
STable
*
pTable
);
static
int32_t
tsdbCheckTableCfg
(
STableCfg
*
pCfg
);
...
...
@@ -548,7 +548,10 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
STable
*
pSTable
=
tsdbGetTableByUid
(
pMeta
,
pTable
->
superUid
);
assert
(
pSTable
!=
NULL
);
char
*
key
=
dataRowTuple
(
pTable
->
tagVal
);
// key
STSchema
*
pSchema
=
tsdbGetTableTagSchema
(
pMeta
,
pTable
);
STColumn
*
pCol
=
&
pSchema
->
columns
[
DEFAULT_TAG_INDEX_COLUMN
];
char
*
key
=
tdGetRowDataOfCol
(
pTable
->
tagVal
,
pCol
->
type
,
TD_DATA_ROW_HEAD_SIZE
+
pCol
->
offset
);
bool
ret
=
tSkipListRemove
(
pSTable
->
pIndex
,
key
);
assert
(
ret
);
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
d5b707a4
...
...
@@ -626,7 +626,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf
for
(
int32_t
k
=
start
;
k
<
pQueryHandle
->
realNumOfRows
+
start
;
++
k
)
{
char
*
p
=
tdGetColDataOfRow
(
src
,
k
);
memcpy
(
dst
,
p
,
varDataTLen
(
p
));
dst
+=
varDataTLen
(
p
)
;
dst
+=
bytes
;
}
}
...
...
@@ -1311,8 +1311,8 @@ void filterPrepare(void* expr, void* param) {
}
else
{
pInfo
->
q
=
calloc
(
1
,
pSchema
->
bytes
);
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
varDataSetLen
(
pInfo
->
q
,
pCond
->
nLen
);
tVariantDump
(
pCond
,
varDataVal
(
pInfo
->
q
),
pSchema
->
type
);
varDataSetLen
(
pInfo
->
q
,
pCond
->
nLen
);
// the length may be changed after dump, so assign its value after dump
}
else
{
tVariantDump
(
pCond
,
pInfo
->
q
,
pSchema
->
type
);
}
...
...
src/util/src/tcompare.c
浏览文件 @
d5b707a4
...
...
@@ -67,33 +67,29 @@ int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight) {
if
(
len1
!=
len2
)
{
return
len1
>
len2
?
1
:-
1
;
}
else
{
return
(
int32_t
)
strncmp
(
varDataVal
(
pLeft
),
varDataVal
(
pRight
),
len1
);
int32_t
ret
=
strncmp
(
varDataVal
(
pLeft
),
varDataVal
(
pRight
),
len1
);
if
(
ret
==
0
)
{
return
0
;
}
else
{
return
ret
>
0
?
1
:-
1
;
}
}
}
int32_t
compareWStrVal
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
// SSkipListKey *pL = (SSkipListKey *)pLeft;
// SSkipListKey *pR = (SSkipListKey *)pRight;
//
// if (pL->nLen == 0 && pR->nLen == 0) {
// return 0;
// }
//
// // handle only one-side bound compare situation, there is only lower bound or only upper bound
// if (pL->nLen == -1) {
// return 1; // no lower bound, lower bound is minimum, always return -1;
// } else if (pR->nLen == -1) {
// return -1; // no upper bound, upper bound is maximum situation, always return 1;
// }
//
// int32_t ret = wcscmp(((SSkipListKey *)pLeft)->wpz, ((SSkipListKey *)pRight)->wpz);
//
// if (ret == 0) {
// return 0;
// } else {
// return ret > 0 ? 1 : -1;
// }
int32_t
compareLenPrefixedWStr
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
len1
=
varDataLen
(
pLeft
);
int32_t
len2
=
varDataLen
(
pRight
);
if
(
len1
!=
len2
)
{
return
len1
>
len2
?
1
:-
1
;
}
else
{
int32_t
ret
=
wcsncmp
(
varDataVal
(
pLeft
),
varDataVal
(
pRight
),
len1
);
if
(
ret
==
0
)
{
return
0
;
}
else
{
return
ret
>
0
?
1
:
-
1
;
}
}
}
/*
...
...
@@ -284,7 +280,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
if
(
optr
==
TSDB_RELATION_LIKE
)
{
comparFn
=
compareWStrPatternComp
;
}
else
{
comparFn
=
compare
WStrVal
;
comparFn
=
compare
LenPrefixedWStr
;
}
break
;
...
...
@@ -326,7 +322,7 @@ __compar_fn_t getKeyComparFunc(int32_t keyType) {
break
;
case
TSDB_DATA_TYPE_NCHAR
:
comparFn
=
compare
WStrVal
;
comparFn
=
compare
LenPrefixedWStr
;
break
;
default:
...
...
tests/script/general/parser/nchar.sim
浏览文件 @
d5b707a4
...
...
@@ -194,8 +194,10 @@ sql reset query cache
sql select * from $mt where tgcol = '1'
step2:
if $rows != 100 then
print expect 100, actual: $rows
return -1
endi
sql select * from $mt where tgcol > '0'
#print rows = $rows
if $rows != 100 then
...
...
tests/script/general/parser/testSuite.sim
浏览文件 @
d5b707a4
...
...
@@ -35,6 +35,12 @@ run general/parser/first_last.sim
sleep 2000
run general/parser/import_file.sim
sleep 2000
run general/parser/lastrow.sim
sleep 2000
run general/parser/nchar.sim
sleep 2000
run general/parser/null_char.sim
sleep 2000
run general/parser/fill.sim
sleep 2000
run general/parser/fill_stb.sim
...
...
@@ -42,7 +48,6 @@ sleep 2000
run general/parser/tags_dynamically_specifiy.sim
sleep 2000
run general/parser/interp.sim
run general/parser/lastrow.sim
sleep 2000
run general/parser/limit.sim
sleep 2000
...
...
@@ -54,10 +59,6 @@ run general/parser/limit2.sim
sleep 2000
run general/parser/mixed_blocks.sim
sleep 2000
run general/parser/nchar.sim
sleep 2000
run general/parser/null_char.sim
sleep 2000
run general/parser/selectResNum.sim
sleep 2000
run general/parser/select_across_vnodes.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录